@@ 48-68 (lines=21) @@ | ||
45 | $this->assertEquals($data['roles_ids'], $responseObject->data->roles->data[0]->id); |
|
46 | } |
|
47 | ||
48 | public function testAssignUserToRoleWithRealId_() |
|
49 | { |
|
50 | $randomUser = factory(User::class)->create(); |
|
51 | ||
52 | $role = factory(Role::class)->create(); |
|
53 | ||
54 | $data = [ |
|
55 | 'roles_ids' => $role->id, |
|
56 | 'user_id' => $randomUser->id, |
|
57 | ]; |
|
58 | ||
59 | // send the HTTP request |
|
60 | $response = $this->makeCall($data); |
|
61 | ||
62 | // assert response status is correct. Note: this will return 200 if `HASH_ID=false` in the .env |
|
63 | $this->assertEquals('400', $response->getStatusCode()); |
|
64 | ||
65 | $this->assertResponseContainKeyValue([ |
|
66 | 'message' => 'Only Hashed ID\'s allowed to be passed.', |
|
67 | ], $response); |
|
68 | } |
|
69 | ||
70 | public function testAssignUserToManyRoles_() |
|
71 | { |
@@ 52-73 (lines=22) @@ | ||
49 | ]); |
|
50 | } |
|
51 | ||
52 | public function testRevokeUserFromRoleWithRealId_() |
|
53 | { |
|
54 | $roleA = factory(Role::class)->create(); |
|
55 | ||
56 | $randomUser = factory(User::class)->create(); |
|
57 | $randomUser->assignRole($roleA); |
|
58 | ||
59 | $data = [ |
|
60 | 'roles_ids' => $roleA->id, |
|
61 | 'user_id' => $randomUser->id, |
|
62 | ]; |
|
63 | ||
64 | // send the HTTP request |
|
65 | $response = $this->makeCall($data); |
|
66 | ||
67 | // assert response status is correct. Note: this will return 200 if `HASH_ID=false` in the .env |
|
68 | $this->assertEquals('400', $response->getStatusCode()); |
|
69 | ||
70 | $this->assertResponseContainKeyValue([ |
|
71 | 'message' => 'Only Hashed ID\'s allowed to be passed.', |
|
72 | ], $response); |
|
73 | } |
|
74 | ||
75 | public function testRevokeUserFromManyRoles_() |
|
76 | { |