Add Notes tests
This commit is contained in:
parent
c1e72be0c3
commit
ce19713c99
4 changed files with 233 additions and 0 deletions
57
tests/Feature/NotesControllerTest.php
Normal file
57
tests/Feature/NotesControllerTest.php
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Note;
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
class NotesControllerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Test the `/notes` page returns 200, this should
|
||||
* mean the database is being hit.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_notes_page()
|
||||
{
|
||||
$response = $this->get('/notes');
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a specific note.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_specific_note()
|
||||
{
|
||||
$response = $this->get('/notes/D');
|
||||
$response->assertViewHas('note');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that `/note/{decID}` redirects to `/notes/{nb60id}`.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_dec_id_redirect()
|
||||
{
|
||||
$response = $this->get('/note/11');
|
||||
$response->assertRedirect(config('app.url') . '/notes/B');
|
||||
}
|
||||
|
||||
/**
|
||||
* Visit the tagged page and check the tag view data.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_tagged_notes_page()
|
||||
{
|
||||
$response = $this->get('/notes/tagged/beer');
|
||||
$response->assertViewHas('tag', 'beer');
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue