Laravel 6 Test After Redirect
Hello All
I have this test
/**
* @test
*/
public function testUserCanUpdateProfileData()
{
$this->login();
$new = ['name' => $this->faker->name, 'email' => $this->faker->safeEmail];
$this->post('/profile', $new)->assertRedirect('/profile')->assertSee($new['name'])->assertSee($new['email']);
}
This test not working, do you know what happens?
@rdehnhardt I never attached assertSee to a redirect, so I don't know if that should ever work. What I usually would do is the following:
$this->post('/profile', $new)
->assertRedirect('/profile')
->assertSessionHasNoErrors();
$this->get('/profile')
->assertOk()
->assertSee($new['name'])
->assertSee($new['email']);
I do the same as @nakov in my tests.
$this->delete('/books/read/' . $book->id);
$response = $this->get('/books/' . $book->id);
$response->assertSee(e($book->title) . ' marked as unread.');
$this->assertEquals(0, BookRead::count());
Please or to participate in this conversation.