jonnybarnes.uk/tests/Feature/BookmarksTest.php

32 lines
833 B
PHP
Raw Normal View History

2017-10-13 12:31:31 +01:00
<?php
namespace Tests\Feature;
use Tests\TestCase;
use Tests\TestToken;
use App\Jobs\ProcessBookmark;
use Illuminate\Support\Facades\Queue;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class BookmarksTest extends TestCase
{
use DatabaseTransactions, TestToken;
public function test_browsershot_job_dispatches_when_bookmark_added()
{
Queue::fake();
$response = $this->withHeaders([
'Authorization' => 'Bearer ' . $this->getToken(),
])->post('/api/post', [
'h' => 'entry',
'bookmark-of' => 'https://example.org/blog-post',
]);
$response->assertJson(['response' => 'created']);
Queue::assertPushed(ProcessBookmark::class);
$this->assertDatabaseHas('bookmarks', ['url' => 'https://example.org/blog-post']);
}
}