Arrange, Act, Assert

Every test follows the same three-step dance.

Arrange — set up the world
$user = User::factory()->create(['name' => 'John']);
Act — do the thing
$response = $this->get('/users');
Assert — check the result
$response->assertOk();

$this->assertDatabaseHas('users', [
    'name' => 'John Doe',
    'email' => '[email protected]',
]);