当前位置: 首页>>代码示例>>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;未经允许,请勿转载。