当前位置: 首页>>代码示例>>PHP>>正文


PHP ServiceLocatorInterface::expects方法代码示例

本文整理汇总了PHP中Zend\ServiceManager\ServiceLocatorInterface::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP ServiceLocatorInterface::expects方法的具体用法?PHP ServiceLocatorInterface::expects怎么用?PHP ServiceLocatorInterface::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\ServiceManager\ServiceLocatorInterface的用法示例。


在下文中一共展示了ServiceLocatorInterface::expects方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testCreateServiceWithConfig

 /**
  * @covers Eye4web\ZfcUser\Pm\Factory\Options\ModuleOptionsFactory::createService
  */
 public function testCreateServiceWithConfig()
 {
     $config = ['eye4web' => ['zfc-user' => ['pm' => []]]];
     $this->serviceLocator->expects($this->at(0))->method('get')->with('Config')->willReturn($config);
     $result = $this->factory->createService($this->serviceLocator);
     $this->assertInstanceOf('Eye4web\\ZfcUser\\Pm\\Options\\ModuleOptionsInterface', $result);
 }
开发者ID:bsethwalker,项目名称:Eye4webZfcUserPm,代码行数:10,代码来源:ModuleOptionsFactoryTest.php

示例2: setUp

 public function setUp()
 {
     $this->serviceLocatorMock = $this->getMockForAbstractClass('Zend\\ServiceManager\\ServiceLocatorInterface', ['get']);
     $this->serviceLocatorMock->expects($this->exactly(2))->method('get')->with('config')->will($this->returnValue(['navInstallerTitles' => ['install' => 'SomeTitle'], 'navInstaller' => [['key1' => 'value1'], ['key2' => 'value2'], ['nav' => 'abc', 'key3' => 'value3'], ['nav' => ''], ['nav' => false], ['main' => 'abc', 'key3' => 'value3'], ['main' => ''], ['main' => false]]]));
     $this->deploymentConfig = $this->getMock('Magento\\Framework\\App\\DeploymentConfig', [], [], '', false);
     $this->navigation = new Navigation($this->serviceLocatorMock, $this->deploymentConfig);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:7,代码来源:NavigationTest.php

示例3: testCreateService

 /**
  * @covers Eye4web\ZfcUser\Settings\Factory\Service\UserSettingsServiceFactory::createService
  */
 public function testCreateService()
 {
     $userSettingMapper = $this->getMockBuilder('Eye4web\\ZfcUser\\Settings\\Mapper\\DoctrineORM\\UserSettingMapper')->disableOriginalConstructor()->getMock();
     $this->serviceLocator->expects($this->at(0))->method('get')->with('Eye4web\\ZfcUser\\Settings\\Mapper\\DoctrineORM\\UserSettingMapper')->willReturn($userSettingMapper);
     $result = $this->factory->createService($this->serviceLocator);
     $this->assertInstanceOf('Eye4web\\ZfcUser\\Settings\\Service\\UserSettingsService', $result);
 }
开发者ID:jzlosman,项目名称:ZfcUserSettings,代码行数:10,代码来源:UserSettingsServiceFactoryTest.php

示例4: testGet

 public function testGet()
 {
     $this->locator->expects($this->once())->method('get')->with(InitParamListener::BOOTSTRAP_PARAM)->willReturn([]);
     $objectManager = $this->object->get();
     $this->assertInstanceOf('Magento\\Framework\\ObjectManagerInterface', $objectManager);
     $this->assertSame($objectManager, $this->object->get());
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:7,代码来源:ObjectManagerProviderTest.php

示例5: testGetRolesWithInheritance

 /**
  * @covers \BjyAuthorize\Provider\Role\ZendDb::getRoles
  */
 public function testGetRolesWithInheritance()
 {
     $this->tableGateway->expects($this->any())->method('selectWith')->will($this->returnValue(array(array('id' => 1, 'role_id' => 'guest', 'is_default' => 1, 'parent_id' => null), array('id' => 2, 'role_id' => 'user', 'is_default' => 0, 'parent_id' => 1))));
     $this->serviceLocator->expects($this->any())->method('get')->will($this->returnValue($this->tableGateway));
     $provider = new ZendDb(array(), $this->serviceLocator);
     $this->assertEquals($provider->getRoles(), array(new Role('guest'), new Role('user', 'guest')));
 }
开发者ID:pbrilius,项目名称:BjyAuthorize,代码行数:10,代码来源:ZendDbTest.php

示例6: testCreateService

 public function testCreateService()
 {
     $aclmock = $this->getMock('LearnZF2Acl\\Model\\Acl');
     $this->serviceLocator->expects($this->at(0))->method('get')->with('aclmodel')->willReturn($aclmock);
     $result = $this->factory->createService($this->controllerManager);
     $this->assertInstanceOf('LearnZF2Acl\\Controller\\AclController', $result);
 }
开发者ID:jkhaled,项目名称:LearnZF2,代码行数:7,代码来源:AclControllerFactoryTest.php

示例7: setUp

 public function setUp()
 {
     $this->newEntry = $this->getMockBuilder(stdClass::class)->setMethods(['getId'])->getMock();
     $this->formElementManager = $this->getMockBuilder(ServiceLocatorInterface::class)->getMock();
     $this->formElementManager->expects($this->any())->method('get')->with($this->formService)->willReturn(new CoreForm());
     $this->collectionContainer = new CollectionContainer($this->formService, $this->newEntry);
     $this->collectionContainer->setFormElementManager($this->formElementManager);
 }
开发者ID:cross-solution,项目名称:yawik,代码行数:8,代码来源:CollectionContainerTest.php

示例8: setUp

 /**
  * Prepare the object to be tested.
  */
 protected function setUp()
 {
     $this->serviceLocator = $this->getMock('Zend\\ServiceManager\\ServiceLocatorInterface');
     $this->options = $this->getMockBuilder('ZfcUser\\Options\\ModuleOptions')->disableOriginalConstructor()->getMock();
     $this->serviceLocator->expects($this->any())->method('get')->with('zfcuser_module_options')->will($this->returnValue($this->options));
     $this->eventManager = new \Zend\EventManager\EventManager();
     $this->factory = new AdapterChainServiceFactory();
 }
开发者ID:aapthi,项目名称:video-collections,代码行数:11,代码来源:AdapterChainServiceFactoryTest.php

示例9: setUp

 /**
  * {@inheritDoc}
  *
  * @covers \BjyAuthorize\Guard\Controller::__construct
  */
 public function setUp()
 {
     parent::setUp();
     $this->serviceLocator = $locator = $this->getMock('Zend\\ServiceManager\\ServiceLocatorInterface');
     $this->authorize = $authorize = $this->getMock('BjyAuthorize\\Service\\Authorize', array(), array(), '', false);
     $this->controllerGuard = new Controller(array(), $this->serviceLocator);
     $this->serviceLocator->expects($this->any())->method('get')->with('BjyAuthorize\\Service\\Authorize')->will($this->returnValue($authorize));
 }
开发者ID:kler,项目名称:BjyAuthorize,代码行数:13,代码来源:ControllerTest.php

示例10: testMethods

 /**
  * Test methods
  */
 public function testMethods()
 {
     $helper = $this->appService;
     $this->assertSame($this->serviceLocatorMock, $helper->getServiceLocator());
     $this->assertSame($this->serviceLocatorMock, $helper());
     $this->serviceLocatorMock->expects($this->once())->method('get')->with('ExampleService')->will($this->returnValue(new \stdClass()));
     $this->assertInstanceOf('stdClass', $helper('ExampleService'));
 }
开发者ID:gridguyz,项目名称:core,代码行数:11,代码来源:AppServiceTest.php

示例11: testCreateService

 /**
  * @covers Eye4web\ZfcUser\Pm\Factory\View\Helper\ZfcUserPmHelperFactory::createService
  */
 public function testCreateService()
 {
     $pmService = $this->getMockBuilder('Eye4web\\ZfcUser\\Pm\\Service\\PmService')->disableOriginalConstructor()->getMock();
     $this->serviceLocator->expects($this->at(0))->method('get')->with('Eye4web\\ZfcUser\\Pm\\Service\\PmService')->willReturn($pmService);
     $user = $this->getMockForAbstractClass('ZfcUser\\Mapper\\UserInterface');
     $this->serviceLocator->expects($this->at(1))->method('get')->with('zfcuser_user_mapper')->will($this->returnValue($user));
     $result = $this->factory->createService($this->helperManager);
     $this->assertInstanceOf('Eye4web\\ZfcUser\\Pm\\View\\Helper\\ZfcUserPmHelper', $result);
 }
开发者ID:bsethwalker,项目名称:Eye4webZfcUserPm,代码行数:12,代码来源:ZfcUserPmHelperFactoryTest.php

示例12: testCreateService

 public function testCreateService()
 {
     $formElementManager = $this->getMockBuilder('Zend\\Form\\FormElementManager')->disableOriginalConstructor()->getMock();
     $captchaForm = $this->getMockBuilder('LearnZF2Captcha\\Form\\CaptchaForm')->disableOriginalConstructor()->getMock();
     $formElementManager->expects($this->once())->method('get')->with('LearnZF2Captcha\\Form\\CaptchaForm')->willReturn($captchaForm);
     $this->serviceLocator->expects($this->once())->method('get')->with('FormElementManager')->willReturn($formElementManager);
     $result = $this->factory->createService($this->controllerManager);
     $this->assertInstanceOf('LearnZF2Captcha\\Controller\\CaptchaController', $result);
 }
开发者ID:jkhaled,项目名称:LearnZF2,代码行数:9,代码来源:CaptchaControllerFactoryTest.php

示例13: testCreateService

 public function testCreateService()
 {
     $userSettingService = $this->getMockBuilder('Eye4web\\ZfcUser\\Settings\\Service\\UserSettingsService')->disableOriginalConstructor()->getMock();
     $this->serviceLocator->expects($this->at(0))->method('get')->with('Eye4web\\ZfcUser\\Settings\\Service\\UserSettingsService')->willReturn($userSettingService);
     $zfcUserIdentityViewHelper = $this->getMockBuilder('ZfcUser\\View\\Helper\\ZfcUserIdentity')->disableOriginalConstructor()->getMock();
     $this->viewHelperManager->expects($this->once())->method('get')->with('ZfcUserIdentity')->willReturn($zfcUserIdentityViewHelper);
     $result = $this->factory->createService($this->viewHelperManager);
     $this->assertInstanceOf('Eye4web\\ZfcUser\\Settings\\View\\Helper\\UserSettingHelper', $result);
 }
开发者ID:jzlosman,项目名称:ZfcUserSettings,代码行数:9,代码来源:UserSettingHelperFactoryTest.php

示例14: testCreateService

 public function testCreateService()
 {
     $mockFormElementManager = $this->getMock('Zend\\Form\\FormElementManager');
     $this->serviceLocator->expects($this->at(0))->method('get')->with('FormElementManager')->willReturn($mockFormElementManager);
     $mockLogForm = $this->getMock('LearnZF2Log\\Form\\LogForm');
     $mockFormElementManager->expects($this->at(0))->method('get')->with('LearnZF2Log\\Form\\LogForm')->willReturn($mockLogForm);
     $result = $this->factory->createService($this->controllerManager);
     $this->assertInstanceOf('LearnZF2Log\\Controller\\IndexController', $result);
 }
开发者ID:jkhaled,项目名称:LearnZF2,代码行数:9,代码来源:IndexControllerFactoryTest.php

示例15: testCreateService

 public function testCreateService()
 {
     $userSettingService = $this->getMockBuilder('Eye4web\\ZfcUser\\Settings\\Service\\UserSettingsService')->disableOriginalConstructor()->getMock();
     $this->serviceLocator->expects($this->at(0))->method('get')->with('Eye4web\\ZfcUser\\Settings\\Service\\UserSettingsService')->willReturn($userSettingService);
     $zfcuser_auth_service = $this->getMockBuilder('Zend\\Authentication\\AuthenticationService')->disableOriginalConstructor()->getMock();
     $this->serviceLocator->expects($this->at(1))->method('get')->with('zfcuser_auth_service')->willReturn($zfcuser_auth_service);
     $result = $this->factory->createService($this->controllerPluginManager);
     $this->assertInstanceOf('Eye4web\\ZfcUser\\Settings\\Controller\\Plugin\\UserSettingPlugin', $result);
 }
开发者ID:jzlosman,项目名称:ZfcUserSettings,代码行数:9,代码来源:UserSettingPluginFactoryTest.php


注:本文中的Zend\ServiceManager\ServiceLocatorInterface::expects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。