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


PHP PluginManager::setServiceLocator方法代码示例

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


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

示例1: testCreateService

 public function testCreateService()
 {
     $pm = new ControllerPluginManager();
     $sm = new ServiceManager();
     $sm->setService('AcMailer\\Service\\MailService', new MailServiceMock());
     $pm->setServiceLocator($sm);
     $this->assertInstanceOf('AcMailer\\Controller\\Plugin\\SendMailPlugin', $this->factory->createService($pm));
 }
开发者ID:quangdungninh,项目名称:zendvnteam,代码行数:8,代码来源:SendMailPluginFactoryTest.php

示例2: createControllerManager

 protected function createControllerManager($config = [])
 {
     $pm = new ControllerPluginManager();
     $sm = new ServiceManager();
     $sm->setService('Config', $config);
     $pm->setServiceLocator($sm);
     return $pm;
 }
开发者ID:wasabiNorman,项目名称:ZF2-AcMailer,代码行数:8,代码来源:SendMailPluginAbstractFactoryTest.php

示例3: setUp

 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     $this->serviceManager = Bootstrap::getServiceManager();
     $this->entityManager = $this->serviceManager->get('doctrine.entitymanager.orm_default');
     $this->createMergedDocument = new CreateMergedDocument();
     $pluginManager = new PluginManager();
     $pluginManager->setServiceLocator($this->serviceManager);
     $this->createMergedDocument->setServiceLocator($pluginManager);
 }
开发者ID:debranova,项目名称:project,代码行数:12,代码来源:CreateMergeDocumentTest.php

示例4: testFactory

 public function testFactory()
 {
     $serviceManager = new ServiceManager();
     $pluginManager = new PluginManager();
     $pluginManager->setServiceLocator($serviceManager);
     $serviceManager->setService('ZfjRbac\\Service\\AuthorizationService', $this->getMock('ZfjRbac\\Service\\AuthorizationServiceInterface'));
     $factory = new IsGrantedPluginFactory();
     $isGranted = $factory->createService($pluginManager);
     $this->assertInstanceOf('ZfjRbac\\Mvc\\Controller\\Plugin\\IsGranted', $isGranted);
 }
开发者ID:joacub,项目名称:zfj-rbac,代码行数:10,代码来源:IsGrantedPluginFactoryTest.php

示例5: testIdentityFactoryCanInjectAuthenticationServiceIfInParentServiceManager

 public function testIdentityFactoryCanInjectAuthenticationServiceIfInParentServiceManager()
 {
     $services = new ServiceManager();
     $services->setInvokableClass('Zend\\Authentication\\AuthenticationService', 'Zend\\Authentication\\AuthenticationService');
     $pluginManager = new PluginManager();
     $pluginManager->setServiceLocator($services);
     $identity = $pluginManager->get('identity');
     $expected = $services->get('Zend\\Authentication\\AuthenticationService');
     $this->assertSame($expected, $identity->getAuthenticationService());
 }
开发者ID:rajanlamic,项目名称:IntTest,代码行数:10,代码来源:PluginManagerTest.php

示例6: testFactory

 public function testFactory()
 {
     $serviceManager = new ServiceManager();
     $serviceManager->setService(LayoutInterface::class, $this->layout);
     $serviceManager->setService(LayoutUpdaterInterface::class, $this->layoutUpdater);
     $serviceManager->setService(BlockPoolInterface::class, $this->blockPool);
     $controllerPluginManager = new PluginManager();
     $controllerPluginManager->setServiceLocator($serviceManager);
     $factory = new LayoutManagerFactory();
     $instance = $factory->createService($controllerPluginManager);
     $this->assertInstanceOf(LayoutManager::class, $instance);
 }
开发者ID:hummer2k,项目名称:conlayout,代码行数:12,代码来源:LayoutManagerTest.php

示例7: testFactory

 public function testFactory()
 {
     $serviceManager = new ServiceManager();
     $serviceManager->setService('ConLayout\\Layout\\LayoutInterface', $this->layout);
     $serviceManager->setService('ConLayout\\Updater\\LayoutUpdaterInterface', $this->updater);
     $serviceManager->setService('ConLayout\\View\\Renderer\\BlockRenderer', $this->renderer);
     $controllerPluginManager = new PluginManager();
     $controllerPluginManager->setServiceLocator($serviceManager);
     $factory = new LayoutManagerFactory();
     $instance = $factory->createService($controllerPluginManager);
     $this->assertInstanceOf('ConLayout\\Controller\\Plugin\\LayoutManager', $instance);
 }
开发者ID:adamdyson,项目名称:ConLayout,代码行数:12,代码来源:LayoutManagerTest.php

示例8: testCanDisplayListOfMessagesCustomisedByConfig

    public function testCanDisplayListOfMessagesCustomisedByConfig()
    {
        $this->seedMessages();

        $config = array(
            'view_helper_config' => array(
                'flashmessenger' => array(
                    'message_open_format' => '<div%s><ul><li>',
                    'message_separator_string' => '</li><li>',
                    'message_close_string' => '</li></ul></div>',
                ),
            ),
        );
        $sm = new ServiceManager();
        $sm->setService('Config', $config);
        $helperPluginManager = new HelperPluginManager(new Config(array(
            'factories' => array(
                'flashmessenger' => 'Zend\View\Helper\Service\FlashMessengerFactory',
            ),
        )));
        $controllerPluginManager = new PluginManager(new Config(array(
            'invokables' => array(
                'flashmessenger' => 'Zend\Mvc\Controller\Plugin\FlashMessenger',
            ),
        )));
        $helperPluginManager->setServiceLocator($sm);
        $controllerPluginManager->setServiceLocator($sm);
        $sm->setService('ControllerPluginManager', $controllerPluginManager);
        $helper = $helperPluginManager->get('flashmessenger');

        $displayInfoAssertion = '<div class="info"><ul><li>bar-info</li></ul></div>';
        $displayInfo = $helper->render(PluginFlashMessenger::NAMESPACE_INFO);
        $this->assertEquals($displayInfoAssertion, $displayInfo);
    }
开发者ID:benivaldo,项目名称:zf2-na-pratica,代码行数:34,代码来源:FlashMessengerTest.php

示例9: testCreateServiceWithoutModelManager

 /**
  * @expectedException \Zend\ServiceManager\Exception\ServiceNotCreatedException
  */
 public function testCreateServiceWithoutModelManager()
 {
     $this->pm->setServiceLocator($this->sm);
     $this->factory->createService($this->pm);
 }
开发者ID:matryoshka-model,项目名称:zf2-matryoshka-module,代码行数:8,代码来源:ObjectFactoryTest.php

示例10: testCanDisplayListOfCurrentMessagesCustomisedByConfigSeparator

 public function testCanDisplayListOfCurrentMessagesCustomisedByConfigSeparator()
 {
     $this->seedCurrentMessages();
     $config = array('view_helper_config' => array('flashmessenger' => array('message_open_format' => '<div><ul><li%s>', 'message_separator_string' => '</li><li%s>', 'message_close_string' => '</li></ul></div>')));
     $sm = new ServiceManager();
     $sm->setService('Config', $config);
     $helperPluginManager = new HelperPluginManager(new Config(array('factories' => array('flashmessenger' => 'Zend\\View\\Helper\\Service\\FlashMessengerFactory'))));
     $controllerPluginManager = new PluginManager(new Config(array('invokables' => array('flashmessenger' => 'Zend\\Mvc\\Controller\\Plugin\\FlashMessenger'))));
     $helperPluginManager->setServiceLocator($sm);
     $controllerPluginManager->setServiceLocator($sm);
     $sm->setService('ControllerPluginManager', $controllerPluginManager);
     $helper = $helperPluginManager->get('flashmessenger');
     $displayInfoAssertion = '<div><ul><li class="foo-baz foo-bar">foo</li><li class="foo-baz foo-bar">bar</li></ul></div>';
     $displayInfo = $helper->renderCurrent(PluginFlashMessenger::NAMESPACE_DEFAULT, array('foo-baz', 'foo-bar'));
     $this->assertEquals($displayInfoAssertion, $displayInfo);
 }
开发者ID:pnaq57,项目名称:zf2demo,代码行数:16,代码来源:FlashMessengerTest.php


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