Improve exception handling and model binding
This commit is contained in:
parent
e9ca934cb4
commit
0fca80e7e4
22 changed files with 148 additions and 82 deletions
|
@ -30,4 +30,18 @@ class ArticlesTest extends TestCase
|
|||
$response = $this->get('/blog/s/2');
|
||||
$response->assertRedirect('/blog/' . date('Y') . '/' . date('m') . '/some-code-i-did');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function unknownSlugGives404()
|
||||
{
|
||||
$response = $this->get('/blog/' . date('Y') . '/' . date('m') . '/unknown-slug');
|
||||
$response->assertNotFound();
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function unknownArticleIdGives404()
|
||||
{
|
||||
$response = $this->get('/blog/s/22');
|
||||
$response->assertNotFound();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,4 +38,11 @@ class ContactsTest extends TestCase
|
|||
$response = $this->get('/contacts/aaron');
|
||||
$response->assertViewHas('image', '/assets/profile-images/aaronparecki.com/image');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function unknownContactGives404()
|
||||
{
|
||||
$response = $this->get('/contacts/unknown');
|
||||
$response->assertNotFound();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -211,4 +211,11 @@ END;
|
|||
|
||||
$this->assertEquals('Jonny Barnes', Like::find($id)->author_name);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function unknownLikeGives404()
|
||||
{
|
||||
$response = $this->get('/likes/202');
|
||||
$response->assertNotFound();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,4 +57,11 @@ class NotesControllerTest extends TestCase
|
|||
$response = $this->get('/notes/tagged/beer');
|
||||
$response->assertViewHas('tag', 'beer');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function unknownNoteGives404()
|
||||
{
|
||||
$response = $this->get('/notes/112233');
|
||||
$response->assertNotFound();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,4 +29,11 @@ class PlacesTest extends TestCase
|
|||
$response = $this->get('/places/the-bridgewater-pub');
|
||||
$response->assertViewHas('place', $place);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function unknownPlaceGives404()
|
||||
{
|
||||
$response = $this->get('/places/unknown');
|
||||
$response->assertNotFound();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue