public function UuidUserServicesTest::testUserOwnUpdatePermFail in Universally Unique IDentifier 7
Tests users Update their own account fail with no permissions.
File
- uuid_services/
uuid_services.user_services.test, line 182 - Test the UUID User Services integration.
Class
- UuidUserServicesTest
- Test the UUID User Services integration.
Code
public function testUserOwnUpdatePermFail() {
$user = $this
->drupalCreateUser([
'access user profiles',
]);
$this
->drupalLogin($user);
$user = user_load($user->uid, TRUE);
$update = array(
'uuid' => $user->uuid,
'roles' => array(
'2' => 'authenticated user',
'3' => 'administrator',
),
'status' => 1,
'pass' => $user->pass,
);
$this
->servicesPut($this->endpoint->path . '/user/' . $user->uuid, $update);
$user_after_update = user_load($user->uid, TRUE);
$this
->assertFalse(in_array('administrator', $user_after_update->roles), 'Administrator role was not added without the needed permissions');
$this
->assertEqual($user->roles, $user_after_update->roles, 'Existing roles persist after update.');
}