Ejemplo n.º 1
0
 /**
  * Sets up the fixture
  */
 protected function setUp()
 {
     $mockUser = $this->getMockBuilder('\\Nethgui\\Authorization\\UserInterface')->disableOriginalConstructor()->setMethods(array('authenticate', 'getAuthorizationAttribute', 'asAuthorizationString', 'isAuthenticated', 'getCredential', 'getCredentials', 'hasCredential', 'getLanguageCode'))->getMock();
     $mockSession = $this->getMockBuilder('\\Nethgui\\Utility\\SessionInterface')->disableOriginalConstructor()->setMethods(array('retrieve', 'store', 'login', 'logout'))->getMock();
     $mockSession->expects($this->atLeastOnce())->method('retrieve')->with($this->anything())->will($this->returnValue(new \ArrayObject()));
     $pdpMock = $this->getMock('Nethgui\\Authorization\\PolicyDecisionPointInterface');
     $pdpMock->expects($this->any())->method('authorize')->will($this->returnValue(\Nethgui\Authorization\LazyAccessControlResponse::createSuccessResponse()));
     $this->globalsMock = $this->getMock('\\Nethgui\\Utility\\PhpWrapper');
     $this->object = new \Nethgui\System\NethPlatform($mockUser);
     $this->object->setSession($mockSession);
     $this->object->setPhpWrapper($this->globalsMock);
     $this->object->setPolicyDecisionPoint($pdpMock);
 }
 public function testCreateSuccessResponse()
 {
     $i = \Nethgui\Authorization\LazyAccessControlResponse::createSuccessResponse();
     $this->assertTrue($i->isAllowed());
 }