I have issue with testing. I have to check that if user trying to get object which does not exist he must get 404 page.
Here is my route:
Route::get('/posts/{id}', 'PostController@index');
Here is my test:
public function testViewsA404PageWhenPostIsNotFound()
{
$resp = $this->get('/posts/INVALID_ID');
$resp->assertStatus(404);
$resp->assertSee("The page a you looking for could not be found");
}
DB - PostgreSQL
But I get exception:
Illuminate\Database\QueryException: SQLSTATE[22P02]: Invalid text representation
invalid input syntax for integer: "INVALID_ID" (SQL: select * from "posts" where "posts "."id" = INVALID_ID limit 1)
I saw that in one lecture course but they used MySQL as database.
Aucun commentaire:
Enregistrer un commentaire