/**
  * @return void
  */
 public function setUp()
 {
     $this->mockSecurityContext = $this->getMockBuilder(\TYPO3\Flow\Security\Context::class)->disableOriginalConstructor()->getMock();
     $this->mockObjectManager = $this->createMock(\TYPO3\Flow\Object\ObjectManagerInterface::class);
     $this->mockJoinPoint = $this->getMockBuilder(\TYPO3\Flow\Aop\JoinPoint::class)->disableOriginalConstructor()->getMock();
     $this->privilegeManager = new PrivilegeManager($this->mockObjectManager, $this->mockSecurityContext);
     $this->grantPrivilege = $this->getMockBuilder(\TYPO3\Flow\Security\Authorization\Privilege\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(array()));
     $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(\TYPO3\Flow\Security\Authorization\Privilege\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(array()));
     $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(\TYPO3\Flow\Security\Authorization\Privilege\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(array()));
     $this->abstainPrivilege->expects($this->any())->method('isGranted')->will($this->returnValue(false));
     $this->abstainPrivilege->expects($this->any())->method('isDenied')->will($this->returnValue(false));
 }
 /**
  * Add a privilege to this role.
  *
  * @param PrivilegeInterface $privilege
  * @return void
  */
 public function addPrivilege($privilege)
 {
     $this->privileges[$privilege->getCacheEntryIdentifier()] = $privilege;
 }