@@ 13-40 (lines=28) @@ | ||
10 | * |
|
11 | * @author Mahmoud Zalt <[email protected]> |
|
12 | */ |
|
13 | class FindPermissionTest extends TestCase |
|
14 | { |
|
15 | ||
16 | protected $endpoint = '/permission/{id}'; |
|
17 | ||
18 | protected $access = [ |
|
19 | 'roles' => 'admin', |
|
20 | 'permissions' => '', |
|
21 | ]; |
|
22 | ||
23 | public function testFindPermissionById_() |
|
24 | { |
|
25 | $this->getTestingAdmin(); |
|
26 | ||
27 | $permissionA = factory(Permission::class)->create(); |
|
28 | ||
29 | // send the HTTP request |
|
30 | $response = $this->apiCall($this->injectEndpointId($this->endpoint, $permissionA->id), 'get'); |
|
31 | ||
32 | // assert response status is correct |
|
33 | $this->assertEquals('200', $response->getStatusCode()); |
|
34 | ||
35 | $responseObject = $this->getResponseObject($response); |
|
36 | ||
37 | $this->assertEquals($permissionA->name, $responseObject->data->name); |
|
38 | } |
|
39 | ||
40 | } |
|
41 |
@@ 13-40 (lines=28) @@ | ||
10 | * |
|
11 | * @author Mahmoud Zalt <[email protected]> |
|
12 | */ |
|
13 | class FindRoleTest extends TestCase |
|
14 | { |
|
15 | ||
16 | protected $endpoint = '/role/{id}'; |
|
17 | ||
18 | protected $access = [ |
|
19 | 'roles' => 'admin', |
|
20 | 'permissions' => '', |
|
21 | ]; |
|
22 | ||
23 | public function testFindRoleById_() |
|
24 | { |
|
25 | $this->getTestingAdmin(); |
|
26 | ||
27 | $roleA = factory(Role::class)->create(); |
|
28 | ||
29 | // send the HTTP request |
|
30 | $response = $this->apiCall($this->injectEndpointId($this->endpoint, $roleA->id), 'get'); |
|
31 | ||
32 | // assert response status is correct |
|
33 | $this->assertEquals('200', $response->getStatusCode()); |
|
34 | ||
35 | $responseObject = $this->getResponseObject($response); |
|
36 | ||
37 | $this->assertEquals($roleA->name, $responseObject->data->name); |
|
38 | } |
|
39 | ||
40 | } |
|
41 |