當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Bootstrap::getServiceManager方法代碼示例

本文整理匯總了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);
 }
開發者ID:omusico,項目名稱:zf2-demo,代碼行數:7,代碼來源:FlashMessagesSLFactoryTest.php

示例2: testCreateService

 public function testCreateService()
 {
     $sm = clone Bootstrap::getServiceManager();
     $fm = $sm->get('formElementManager');
     $result = $this->testedObj->createService($fm);
     $this->assertInstanceOf('Auth\\Form\\Register', $result);
 }
開發者ID:utrenkner,項目名稱:YAWIK,代碼行數:7,代碼來源:RegisterFactoryTest.php

示例3: testCreateService

 public function testCreateService()
 {
     $sm = clone Bootstrap::getServiceManager();
     $fm = $sm->get('formElementManager');
     $result = $this->factory->createService($fm);
     $this->assertInstanceOf(UserStatusFieldset::class, $result);
 }
開發者ID:cross-solution,項目名稱:yawik,代碼行數:7,代碼來源:UserStatusFieldsetFactoryTest.php

示例4: testCreateService

 public function testCreateService()
 {
     $controllerManager = new ControllerManager();
     $controllerManager->setServiceLocator(Bootstrap::getServiceManager());
     $result = $this->testedObj->createService($controllerManager);
     $this->assertInstanceOf(UpdateController::class, $result);
 }
開發者ID:omusico,項目名稱:zf2-demo,代碼行數:7,代碼來源:UpdateControllerFactoryTest.php

示例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());
 }
開發者ID:omusico,項目名稱:zf2-demo,代碼行數:9,代碼來源:LoginControllerTest.php

示例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);
 }
開發者ID:cross-solution,項目名稱:yawik,代碼行數:9,代碼來源:GotoResetPasswordFactoryTest.php

示例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);
 }
開發者ID:omusico,項目名稱:zf2-demo,代碼行數:14,代碼來源:AbstractControllerTestCase.php

示例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);
 }
開發者ID:webpants,項目名稱:YAWIK,代碼行數:14,代碼來源:JobsPublisherFactoryTest.php

示例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);
 }
開發者ID:webpants,項目名稱:YAWIK,代碼行數:11,代碼來源:RegisterFactoryTest.php

示例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);
 }
開發者ID:webpants,項目名稱:YAWIK,代碼行數:11,代碼來源:AbstractControllerTestCase.php

示例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);
 }
開發者ID:webpants,項目名稱:YAWIK,代碼行數:11,代碼來源:OrganizationNameHydratorSLFactoryTest.php

示例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);
 }
開發者ID:webpants,項目名稱:YAWIK,代碼行數:11,代碼來源:GotoResetPasswordControllerTest.php

示例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);
 }
開發者ID:cross-solution,項目名稱:yawik,代碼行數:15,代碼來源:RegisterConfirmationControllerTest.php

示例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);
 }
開發者ID:cross-solution,項目名稱:yawik,代碼行數:12,代碼來源:GotoResetPasswordControllerFactoryTest.php

示例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);
 }
開發者ID:cross-solution,項目名稱:yawik,代碼行數:15,代碼來源:JobboardControllerFactoryTest.php


注:本文中的Test\Bootstrap::getServiceManager方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。