Esempio n. 1
0
 function it_requires_all_multiple_permissions(Role $role, Permission $permission, Permission $permissionA, Role $roleB)
 {
     $role->hasPermission($permission)->willReturn(false);
     $role->hasPermission($permissionA)->willReturn(true);
     $roleB->hasPermission($permission)->willReturn(false);
     $roleB->hasPermission($permissionA)->willReturn(true);
     $role->equals($roleB)->willReturn(false);
     $this->assign($role);
     $this->assign($roleB);
     $this->hasPermissions(array($permission, $permissionA))->shouldReturn(false);
 }
Esempio n. 2
0
 /**
  * Consider if role equals to another role.
  *
  * @param Role $role Role to compare with.
  *
  * @return bool
  */
 public function equals(Role $role)
 {
     return $this->getFullName() == $role->getFullName();
 }
Esempio n. 3
0
 function it_does_not_equal_to_different_role(Role $role)
 {
     $role->getFullName()->willReturn('other_role');
     $this->equals($role);
 }
Esempio n. 4
0
 /**
  * Gard that role belongs to the workflow.
  *
  * @param Role $role Role to be a valid workflow role.
  *
  * @return void
  *
  * @throws InvalidArgumentException If role is not the same workflow.
  */
 private function guardWorkflowRole(Role $role)
 {
     Assertion::eq($role->getWorkflowName(), $this->getName());
 }
Esempio n. 5
0
 function it_adds_a_role(Role $role)
 {
     $role->getName()->willReturn('acl');
     $role->getWorkflowName()->willReturn(static::NAME);
     $this->addRole($role)->shouldReturn($this);
     $this->getRole('acl')->shouldReturn($role);
     $this->getRoles()->shouldReturn(array($role));
 }