本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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());
}
示例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')));
}
示例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);
}
示例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);
}
示例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();
}
示例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));
}
示例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'));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}