Level 5
$responst to $this
Summer Sale! All accounts are 50% off this week.
I am new to unit testing. I am trying to match the updated record but everytime i run i get following error
BadMethodCallException: Method Illuminate\Http\Response::assertEquals does not exist.
and this is my test
/** @test */
public function a_book_can_be_updated()
{
$this->post('/books',[
'title'=>'cool title',
'author'=>'victor'
]);
$book = Book::first();
$reponse = $this->patch('/books/'.$book->id,[
'title'=> 'a new title',
'author'=>'new author'
]);
$reponse->assertEquals('a new title',Book::first()->title);
$reponse->assertEquals('new author',Book::first()->author);
}
update method
public function update(Book $book)
{
$data = request()->validate([
'title'=>'required',
'author'=>'required'
]);
$responst to $this
Please or to participate in this conversation.