Skip to content

Instantly share code, notes, and snippets.

@devmsh
Created February 16, 2020 20:11
Show Gist options
  • Save devmsh/36c244e28daead53f9819a1a2b27c246 to your computer and use it in GitHub Desktop.
Save devmsh/36c244e28daead53f9819a1a2b27c246 to your computer and use it in GitHub Desktop.
Write better Laravel tests
<?php
class LoanTest extends TestCase{
public function test_can_log_a_loan()
{
// ...
$this->passportAs($user)
// ..
->assertJson([
'id' => 1,
'total' => 1000,
'payoff_at' => Carbon::today()->addYear(),
'user_id' => $user->id,
'goal' => [
'total' => 1000,
'user_id' => $user->id,
'due_date' => Carbon::today()->addYear(),
]
]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment