本文整理汇总了PHP中Test\Bootstrap::getServiceManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Bootstrap::getServiceManager方法的具体用法?PHP Bootstrap::getServiceManager怎么用?PHP Bootstrap::getServiceManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Test\Bootstrap
的用法示例。
在下文中一共展示了Bootstrap::getServiceManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCreateService
public function testCreateService()
{
$helperPluginManager = new HelperPluginManager();
$helperPluginManager->setServiceLocator(Bootstrap::getServiceManager());
$result = $this->testedObj->createService($helperPluginManager);
$this->assertInstanceOf(FlashMessages::class, $result);
}
示例2: testCreateService
public function testCreateService()
{
$sm = clone Bootstrap::getServiceManager();
$fm = $sm->get('formElementManager');
$result = $this->testedObj->createService($fm);
$this->assertInstanceOf('Auth\\Form\\Register', $result);
}
示例3: testCreateService
public function testCreateService()
{
$sm = clone Bootstrap::getServiceManager();
$fm = $sm->get('formElementManager');
$result = $this->factory->createService($fm);
$this->assertInstanceOf(UserStatusFieldset::class, $result);
}
示例4: testCreateService
public function testCreateService()
{
$controllerManager = new ControllerManager();
$controllerManager->setServiceLocator(Bootstrap::getServiceManager());
$result = $this->testedObj->createService($controllerManager);
$this->assertInstanceOf(UpdateController::class, $result);
}
示例5: setUp
public function setUp()
{
$this->init('login');
$this->loginFormMock = $this->getMockBuilder(LoginForm::class)->disableOriginalConstructor()->getMock();
$this->loginService = $this->getMockBuilder(LoginService::class)->disableOriginalConstructor()->getMock();
$this->controller = new LoginController($this->loginFormMock, $this->loginService);
$this->controller->setEvent($this->event);
$this->controller->getPluginManager()->setServiceLocator(Bootstrap::getServiceManager());
}
示例6: testCreateService
public function testCreateService()
{
$sm = clone Bootstrap::getServiceManager();
$sm->setAllowOverride(true);
$repositoriesMock = $this->getMockBuilder('Core\\Repository\\RepositoryService')->disableOriginalConstructor()->getMock();
$sm->setService('repositories', $repositoriesMock);
$result = $this->testedObj->createService($sm);
$this->assertInstanceOf('Auth\\Service\\GotoResetPassword', $result);
}
示例7: prepareAuthenticateMock
/**
* @param bool $hasIdentity
* @param UserEntity $userEntity
*/
protected function prepareAuthenticateMock($hasIdentity = false, UserEntity $userEntity = null)
{
$authMock = $this->getMockBuilder(AuthenticationService::class)->disableOriginalConstructor()->getMock();
$authMock->expects($this->any())->method('hasIdentity')->will($this->returnValue($hasIdentity));
$authMock->expects($this->any())->method('getIdentity')->will($this->returnValue($userEntity));
$sm = Bootstrap::getServiceManager();
$sm->setAllowOverride(true);
$sm->setService(AuthenticationService::class, $authMock);
$sm->setAllowOverride(false);
}
示例8: testCreateService
/**
*
*/
public function testCreateService()
{
$sm = clone Bootstrap::getServiceManager();
$sm->setAllowOverride(true);
$config = $this->mockJobsOptions;
$config->method('__isset')->with('multipostingTargetUri')->willReturn(True);
$config->method('__get')->with('multipostingTargetUri')->willReturn('http://user:pass@host/path');
$sm->setService('Jobs/Options', $config);
$result = $this->testedObj->createService($sm);
$this->assertInstanceOf('Core\\Service\\RestClient', $result);
}
示例9: testCreateService
public function testCreateService()
{
$sm = clone Bootstrap::getServiceManager();
$sm->setAllowOverride(true);
$userRepositoryMock = $this->getMockBuilder('Auth\\Repository\\User')->disableOriginalConstructor()->getMock();
$repositoriesMock = $this->getMockBuilder('Core\\Repository\\RepositoryService')->disableOriginalConstructor()->getMock();
$repositoriesMock->expects($this->once())->method('get')->with('Auth/User')->willReturn($userRepositoryMock);
$sm->setService('repositories', $repositoriesMock);
$result = $this->testedObj->createService($sm);
$this->assertInstanceOf('Auth\\Service\\Register', $result);
}
示例10: init
public function init($controllerName, $actionName = 'index', $lang = 'en')
{
$this->routeMatch = new RouteMatch(array('controller' => $controllerName, 'action' => $actionName, 'lang' => $lang));
$this->event = new MvcEvent();
$this->event->setRouteMatch($this->routeMatch);
/** @var SimpleRouteStack $router */
$routerFactory = new RouterFactory();
$router = $routerFactory->createService(clone Bootstrap::getServiceManager());
$router->setDefaultParam('lang', $lang);
$this->event->setRouter($router);
}
示例11: testCreateService
public function testCreateService()
{
$sm = clone Bootstrap::getServiceManager();
$sm->setAllowOverride(true);
$organizationRepositoryMock = $this->getMockBuilder('Organizations\\Repository\\Organization')->disableOriginalConstructor()->getMock();
$repositoriesMock = $this->getMockBuilder('Core\\Repository\\RepositoryService')->disableOriginalConstructor()->getMock();
$repositoriesMock->expects($this->once())->method('get')->with('Organizations/Organization')->willReturn($organizationRepositoryMock);
$sm->setService('repositories', $repositoriesMock);
$result = $this->testedObj->createService($sm);
$this->assertInstanceOf('Jobs\\Form\\Hydrator\\OrganizationNameHydrator', $result);
}
示例12: setUp
public function setUp()
{
$this->init('goto-reset-password');
$this->serviceMock = $this->getMockBuilder('Auth\\Service\\GotoResetPassword')->disableOriginalConstructor()->getMock();
$loggerMock = $this->getMock('Zend\\Log\\LoggerInterface');
$this->controller = new GotoResetPasswordController($this->serviceMock, $loggerMock);
$this->controller->setEvent($this->event);
/** @var PluginManager $controllerPluginManager */
$controllerPluginManager = clone Bootstrap::getServiceManager()->get('ControllerPluginManager');
$this->controller->setPluginManager($controllerPluginManager);
}
示例13: setUp
/**
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function setUp()
{
$this->init('register-confirmation');
$this->serviceMock = $this->getMockBuilder('Auth\\Service\\RegisterConfirmation')->disableOriginalConstructor()->getMock();
$loggerMock = $this->getMockBuilder('Zend\\Log\\LoggerInterface')->getMockForAbstractClass();
$this->controller = new RegisterConfirmationController($this->serviceMock, $loggerMock);
$this->controller->setEvent($this->event);
/** @var PluginManager $controllerPluginManager */
$controllerPluginManager = clone Bootstrap::getServiceManager()->get('ControllerPluginManager');
$this->controller->setPluginManager($controllerPluginManager);
}
示例14: testCreateService
public function testCreateService()
{
$sm = clone Bootstrap::getServiceManager();
$sm->setAllowOverride(true);
$gotoResetPasswordMock = $this->getMockBuilder('Auth\\Service\\GotoResetPassword')->disableOriginalConstructor()->getMock();
$loggerMock = $this->getMockBuilder('Zend\\Log\\LoggerInterface')->getMock();
$sm->setService('Auth\\Service\\GotoResetPassword', $gotoResetPasswordMock);
$sm->setService('Core/Log', $loggerMock);
$controllerManager = new ControllerManager($sm);
$result = $this->testedObj->createService($controllerManager);
$this->assertInstanceOf('Auth\\Controller\\GotoResetPasswordController', $result);
}
示例15: testCreateService
/**
*
*/
public function testCreateService()
{
$sm = clone Bootstrap::getServiceManager();
$sm->setAllowOverride(true);
$jobRepositoryMock = $this->getMockBuilder('Jobs\\Repository\\Job')->disableOriginalConstructor()->getMock();
$repositoriesMock = $this->getMockBuilder('Core\\Repository\\RepositoryService')->disableOriginalConstructor()->getMock();
$repositoriesMock->expects($this->once())->method('get')->with('Jobs/Job')->willReturn($jobRepositoryMock);
$sm->setService('repositories', $repositoriesMock);
$controllerManager = new ControllerManager($sm);
$result = $this->testedObj->createService($controllerManager);
$this->assertInstanceOf('Jobs\\Controller\\JobboardController', $result);
}