Conditions | 1 |
Paths | 1 |
Total Lines | 28 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
24 | public function testSyncDuplicatedPermissionsToRole_() |
||
25 | { |
||
26 | $this->getTestingAdmin(); |
||
27 | |||
28 | $permissionA = factory(Permission::class)->create(['display_name' => 'AAA']); |
||
29 | $permissionB = factory(Permission::class)->create(['display_name' => 'BBB']); |
||
30 | |||
31 | $roleA = factory(Role::class)->create(); |
||
32 | $roleA->givePermissionTo($permissionA); |
||
33 | |||
34 | $data = [ |
||
35 | 'role_id' => $roleA->getHashedKey(), |
||
36 | 'permissions_ids' => [$permissionA->getHashedKey(), $permissionB->getHashedKey()] |
||
37 | ]; |
||
38 | |||
39 | // send the HTTP request |
||
40 | $response = $this->apiCall($this->endpoint, 'post', $data, true); |
||
41 | |||
42 | // assert response status is correct |
||
43 | $this->assertEquals('200', $response->getStatusCode()); |
||
44 | |||
45 | $this->seeInDatabase('role_has_permissions', [ |
||
46 | 'permission_id' => $permissionA->id, |
||
47 | 'permission_id' => $permissionB->id, |
||
48 | 'role_id' => $roleA->id |
||
49 | ]); |
||
50 | |||
51 | } |
||
52 | |||
54 |