Inheritance: extends Neos\Cache\CacheAwareInterface
 /**
  * @return void
  */
 public function setUp()
 {
     $this->mockSecurityContext = $this->getMockBuilder(Context::class)->disableOriginalConstructor()->getMock();
     $this->mockObjectManager = $this->getMockBuilder(ObjectManagerInterface::class)->getMock();
     $this->mockJoinPoint = $this->getMockBuilder(JoinPoint::class)->disableOriginalConstructor()->getMock();
     $this->privilegeManager = new PrivilegeManager($this->mockObjectManager, $this->mockSecurityContext);
     $this->grantPrivilege = $this->getMockBuilder(AbstractPrivilege::class)->disableOriginalConstructor()->getMock();
     $this->grantPrivilege->expects($this->any())->method('getPermission')->will($this->returnValue(PrivilegeInterface::GRANT));
     $this->grantPrivilege->expects($this->any())->method('matchesSubject')->will($this->returnValue(true));
     $this->grantPrivilege->expects($this->any())->method('getParameters')->will($this->returnValue([]));
     $this->grantPrivilege->expects($this->any())->method('isGranted')->will($this->returnValue(true));
     $this->grantPrivilege->expects($this->any())->method('isDenied')->will($this->returnValue(false));
     $this->denyPrivilege = $this->getMockBuilder(AbstractPrivilege::class)->disableOriginalConstructor()->getMock();
     $this->denyPrivilege->expects($this->any())->method('getPermission')->will($this->returnValue(PrivilegeInterface::DENY));
     $this->denyPrivilege->expects($this->any())->method('matchesSubject')->will($this->returnValue(true));
     $this->denyPrivilege->expects($this->any())->method('getParameters')->will($this->returnValue([]));
     $this->denyPrivilege->expects($this->any())->method('isGranted')->will($this->returnValue(false));
     $this->denyPrivilege->expects($this->any())->method('isDenied')->will($this->returnValue(true));
     $this->abstainPrivilege = $this->getMockBuilder(AbstractPrivilege::class)->disableOriginalConstructor()->getMock();
     $this->abstainPrivilege->expects($this->any())->method('getPermission')->will($this->returnValue(PrivilegeInterface::ABSTAIN));
     $this->abstainPrivilege->expects($this->any())->method('matchesSubject')->will($this->returnValue(true));
     $this->abstainPrivilege->expects($this->any())->method('getParameters')->will($this->returnValue([]));
     $this->abstainPrivilege->expects($this->any())->method('isGranted')->will($this->returnValue(false));
     $this->abstainPrivilege->expects($this->any())->method('isDenied')->will($this->returnValue(false));
 }
Ejemplo n.º 2
0
 /**
  * Add a privilege to this role.
  *
  * @param PrivilegeInterface $privilege
  * @return void
  */
 public function addPrivilege($privilege)
 {
     $this->privileges[$privilege->getCacheEntryIdentifier()] = $privilege;
 }