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


PHP ServiceManager::setRetrieveFromPeeringManagerFirst方法代码示例

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


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

示例1: ServiceManager

 /**
  * @covers Zend\ServiceManager\ServiceManager::setService
  * @covers Zend\ServiceManager\ServiceManager::get
  * @covers Zend\ServiceManager\ServiceManager::retrieveFromPeeringManagerFirst
  * @covers Zend\ServiceManager\ServiceManager::setRetrieveFromPeeringManagerFirst
  * @covers Zend\ServiceManager\ServiceManager::addPeeringServiceManager
  */
 public function testRetrieveServiceFromPeeringServiceManagerIfretrieveFromPeeringManagerFirstSetToTrueAndServiceNamesAreSame()
 {
     $foo1 = "foo1";
     $boo1 = "boo1";
     $boo2 = "boo2";
     $this->serviceManager->setService($foo1, $boo1);
     $this->assertEquals($this->serviceManager->get($foo1), $boo1);
     $serviceManagerChild = new ServiceManager();
     $serviceManagerChild->setService($foo1, $boo2);
     $this->assertEquals($serviceManagerChild->get($foo1), $boo2);
     $this->assertFalse($this->serviceManager->retrieveFromPeeringManagerFirst());
     $this->serviceManager->setRetrieveFromPeeringManagerFirst(true);
     $this->assertTrue($this->serviceManager->retrieveFromPeeringManagerFirst());
     $this->serviceManager->addPeeringServiceManager($serviceManagerChild);
     $this->assertContains($serviceManagerChild, $this->readAttribute($this->serviceManager, 'peeringServiceManagers'));
     $this->assertEquals($serviceManagerChild->get($foo1), $boo2);
     $this->assertEquals($this->serviceManager->get($foo1), $boo2);
 }
开发者ID:razvansividra,项目名称:pnlzf2-1,代码行数:25,代码来源:ServiceManagerTest.php

示例2: testAllowsRetrievingFromPeeringContainerFirst

 public function testAllowsRetrievingFromPeeringContainerFirst()
 {
     $parent = new ServiceManager();
     $parent->setFactory('foo', function ($sm) {
         return 'bar';
     });
     $child = new ServiceManager();
     $child->setFactory('foo', function ($sm) {
         return 'baz';
     });
     $child->addPeeringServiceManager($parent, ServiceManager::SCOPE_PARENT);
     $child->setRetrieveFromPeeringManagerFirst(true);
     $this->assertEquals('bar', $child->get('foo'));
 }
开发者ID:Rovak,项目名称:zf2,代码行数:14,代码来源:ServiceManagerTest.php


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