Task 9 - Filter users

This commit is contained in:
PovilasKorop
2021-11-22 12:05:31 +02:00
parent a114584904
commit 4a2753c7e8
5 changed files with 39 additions and 0 deletions
+17
View File
@@ -153,4 +153,21 @@ class RelationshipsTest extends TestCase
'start_date' => now()->toDateString()
]);
}
// TASK: show only the users who have at least one project
public function test_filter_users()
{
$user1 = User::factory()->create();
$user2 = User::factory()->create();
$project = Project::create(['name' => 'Some project']);
DB::table('project_user')->insert([
'project_id' => $project->id,
'user_id' => $user1->id,
'start_date' => now()->toDateString()
]);
$response = $this->get('/users');
$response->assertSee($user1->email);
$response->assertDontSee($user2->email);
}
}