Esempio n. 1
0
 /**
  * @depends testCreateRoleWithNoUsersAndNoParents
  */
 public function testAddingUserToRoleWithNoParentsAndNoUsers()
 {
     // create a role with no parents
     $role = $this->createRole('OneUser');
     // create a user.
     $user = UserTestHelper::createBasicUser(UserTestHelper::generateRandomUsername());
     //Add the role to user
     $this->addUserToRole($user, $role);
     // ensure we have got the user part of the role.
     $roleId = $role->id;
     $role->forgetAll();
     unset($role);
     $role = Role::getById($roleId);
     $this->assertEquals(1, $role->users->count());
     $this->assertTrue($role->users[0]->isSame($user));
     $this->roleWithOneUsers = $role;
 }