ZfcRbac\Factory\RedirectStrategyFactory::createService PHP Method

createService() public method

{@inheritDoc}
public createService ( Zend\ServiceManager\ServiceLocatorInterface $serviceLocator )
$serviceLocator Zend\ServiceManager\ServiceLocatorInterface
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
        return $this($serviceLocator, RedirectStrategy::class);
    }

Usage Example

コード例 #1
0
 public function testFactory()
 {
     $redirectStrategyOptions = $this->getMock('ZfcRbac\\Options\\RedirectStrategyOptions');
     $moduleOptionsMock = $this->getMock('ZfcRbac\\Options\\ModuleOptions');
     $moduleOptionsMock->expects($this->once())->method('getRedirectStrategy')->will($this->returnValue($redirectStrategyOptions));
     $authenticationServiceMock = $this->getMock('Zend\\Authentication\\AuthenticationService');
     $serviceLocatorMock = $this->getMock('Zend\\ServiceManager\\ServiceLocatorInterface');
     $serviceLocatorMock->expects($this->at(0))->method('get')->with('ZfcRbac\\Options\\ModuleOptions')->will($this->returnValue($moduleOptionsMock));
     $serviceLocatorMock->expects($this->at(1))->method('get')->with('Zend\\Authentication\\AuthenticationService')->will($this->returnValue($authenticationServiceMock));
     $factory = new RedirectStrategyFactory();
     $redirectStrategy = $factory->createService($serviceLocatorMock);
     $this->assertInstanceOf('ZfcRbac\\View\\Strategy\\RedirectStrategy', $redirectStrategy);
 }
All Usage Examples Of ZfcRbac\Factory\RedirectStrategyFactory::createService
RedirectStrategyFactory