@@ 29-49 (lines=21) @@ | ||
26 | /** |
|
27 | * @test |
|
28 | */ |
|
29 | public function testGetAllAdmins_() |
|
30 | { |
|
31 | // create some non-admin users |
|
32 | $users = factory(User::class, 2)->create(); |
|
33 | ||
34 | // should not be returned |
|
35 | factory(User::class)->states('client')->create(); |
|
36 | ||
37 | // send the HTTP request |
|
38 | $response = $this->makeCall(); |
|
39 | ||
40 | // assert response status is correct |
|
41 | $response->assertStatus(200); |
|
42 | ||
43 | // convert JSON response string to Object |
|
44 | $responseContent = $this->getResponseContentObject(); |
|
45 | ||
46 | // assert the returned data size is correct |
|
47 | $this->assertCount(4, |
|
48 | $responseContent->data); // 2 (fake in this test) + 1 (that is logged in) + 1 (seeded super admin) |
|
49 | } |
|
50 | ||
51 | /** |
|
52 | * @test |
@@ 29-48 (lines=20) @@ | ||
26 | /** |
|
27 | * @test |
|
28 | */ |
|
29 | public function testGetAllClientsByAdmin_() |
|
30 | { |
|
31 | // should be returned |
|
32 | factory(User::class, 3)->states('client')->create(); |
|
33 | ||
34 | // should not be returned |
|
35 | factory(User::class)->create(); |
|
36 | ||
37 | // send the HTTP request |
|
38 | $response = $this->makeCall(); |
|
39 | ||
40 | // assert response status is correct |
|
41 | $response->assertStatus(200); |
|
42 | ||
43 | // convert JSON response string to Object |
|
44 | $responseContent = $this->getResponseContentObject(); |
|
45 | ||
46 | // assert the returned data size is correct |
|
47 | $this->assertCount(3, $responseContent->data); |
|
48 | } |
|
49 | ||
50 | /** |
|
51 | * @test |