public function testDelegatorFactory()
{
$authServiceClassName = 'ZfcRbac\\Service\\AuthorizationService';
$delegator = new AuthorizationServiceDelegatorFactory();
$serviceLocator = $this->getMock('Zend\\ServiceManager\\ServiceLocatorInterface');
$authorizationService = $this->getMock('ZfcRbac\\Service\\AuthorizationService', [], [], '', false);
$callback = function () {
return new AuthorizationAwareFake();
};
$serviceLocator->expects($this->once())->method('get')->with($authServiceClassName)->will($this->returnValue($authorizationService));
$decoratedInstance = $delegator->createDelegatorWithName($serviceLocator, 'name', 'requestedName', $callback);
$this->assertEquals($authorizationService, $decoratedInstance->getAuthorizationService());
}