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


PHP Container::leaveScope方法代碼示例

本文整理匯總了PHP中Symfony\Component\DependencyInjection\Container::leaveScope方法的典型用法代碼示例。如果您正苦於以下問題:PHP Container::leaveScope方法的具體用法?PHP Container::leaveScope怎麽用?PHP Container::leaveScope使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\DependencyInjection\Container的用法示例。


在下文中一共展示了Container::leaveScope方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testPathsAdded

 /**
  * @covers Hearsay\RequireJSBundle\Configuration\ConfigurationBuilder::__construct
  * @covers Hearsay\RequireJSBundle\Configuration\ConfigurationBuilder::setPath
  * @covers Hearsay\RequireJSBundle\Configuration\ConfigurationBuilder::getConfiguration
  */
 public function testPathsAdded()
 {
     $mapping = $this->getMock('Hearsay\\RequireJSBundle\\Configuration\\NamespaceMappingInterface');
     $this->container->leaveScope('request');
     $this->container->setParameter('assetic.use_controller', false);
     $builder = new ConfigurationBuilder($this->container, $mapping, 'js');
     $builder->setPath('namespace', '/path/to/namespace');
     $config = $builder->getConfiguration();
     $expected = array('namespace' => '/path/to/namespace');
     $this->assertEquals($expected, $config['paths'], 'Did not find expected paths configuration');
 }
開發者ID:boskee,項目名稱:HearsayRequireJSBundle,代碼行數:16,代碼來源:ConfigurationBuilderTest.php

示例2: testReEnteringAScope

 public function testReEnteringAScope()
 {
     $event = new Event();
     $service1 = $this->getMock('Symfony\\Bundle\\FrameworkBundle\\Tests\\Service');
     $service1->expects($this->exactly(2))->method('onEvent')->with($event);
     $scope = new Scope('scope');
     $container = new Container();
     $container->addScope($scope);
     $container->enterScope('scope');
     $container->set('service.listener', $service1, 'scope');
     $dispatcher = new ContainerAwareEventDispatcher($container);
     $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent'));
     $dispatcher->dispatch('onEvent', $event);
     $service2 = $this->getMock('Symfony\\Bundle\\FrameworkBundle\\Tests\\Service');
     $service2->expects($this->once())->method('onEvent')->with($event);
     $container->enterScope('scope');
     $container->set('service.listener', $service2, 'scope');
     $dispatcher->dispatch('onEvent', $event);
     $container->leaveScope('scope');
     $dispatcher->dispatch('onEvent');
 }
開發者ID:laiello,項目名稱:mediathequescrum,代碼行數:21,代碼來源:ContainerAwareEventDispatcherTest.php

示例3: testIsScopeActive

 /**
  * @group legacy
  */
 public function testIsScopeActive()
 {
     $c = new Container();
     $this->assertFalse($c->isScopeActive('foo'));
     $c->addScope(new Scope('foo'));
     $this->assertFalse($c->isScopeActive('foo'));
     $c->enterScope('foo');
     $this->assertTrue($c->isScopeActive('foo'));
     $c->leaveScope('foo');
     $this->assertFalse($c->isScopeActive('foo'));
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:14,代碼來源:ContainerTest.php


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