Move some tests into their own subfodlers
This commit is contained in:
parent
0dd6adfa0e
commit
e1aa814d8c
18 changed files with 29 additions and 31 deletions
79
tests/Feature/Admin/NotesTest.php
Normal file
79
tests/Feature/Admin/NotesTest.php
Normal file
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature\Admin;
|
||||
|
||||
use Tests\TestCase;
|
||||
use App\Jobs\SendWebMentions;
|
||||
use Illuminate\Support\Facades\Queue;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
class NotesTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
public function test_index_page()
|
||||
{
|
||||
$response = $this->withSession([
|
||||
'loggedin' => true,
|
||||
])->get('/admin/notes');
|
||||
$response->assertViewIs('admin.notes.index');
|
||||
}
|
||||
|
||||
public function test_create_page()
|
||||
{
|
||||
$response = $this->withSession([
|
||||
'loggedin' => true,
|
||||
])->get('/admin/notes/create');
|
||||
$response->assertViewIs('admin.notes.create');
|
||||
}
|
||||
|
||||
public function test_create_a_new_note()
|
||||
{
|
||||
$this->withSession([
|
||||
'loggedin' => true,
|
||||
])->post('/admin/notes', [
|
||||
'content' => 'A new test note',
|
||||
]);
|
||||
$this->assertDatabaseHas('notes', [
|
||||
'note' => 'A new test note',
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_edit_page()
|
||||
{
|
||||
$response = $this->withSession([
|
||||
'loggedin' => true,
|
||||
])->get('/admin/notes/1/edit');
|
||||
$response->assertViewIs('admin.notes.edit');
|
||||
}
|
||||
|
||||
public function test_edit_a_note()
|
||||
{
|
||||
Queue::fake();
|
||||
|
||||
$this->withSession([
|
||||
'loggedin' => true,
|
||||
])->post('/admin/notes/1', [
|
||||
'_method' => 'PUT',
|
||||
'content' => 'An edited note',
|
||||
'webmentions' => true,
|
||||
]);
|
||||
|
||||
$this->assertDatabaseHas('notes', [
|
||||
'note' => 'An edited note',
|
||||
]);
|
||||
Queue::assertPushed(SendWebMentions::class);
|
||||
}
|
||||
|
||||
public function test_delete_note()
|
||||
{
|
||||
$this->withSession([
|
||||
'loggedin' => true,
|
||||
])->post('/admin/notes/1', [
|
||||
'_method' => 'DELETE',
|
||||
]);
|
||||
$this->assertSoftDeleted('notes', [
|
||||
'id' => '1',
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue