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


PHP ContainerBuilder::shouldReceive方法代码示例

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


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

示例1: testProcessAbortsOnMissingCommandAttribute

 /**
  * @expectedException \Exception
  */
 public function testProcessAbortsOnMissingCommandAttribute()
 {
     $definition = \Mockery::mock(Definition::class);
     $this->container->shouldReceive('has')->with('tactician.handler.locator.symfony')->once()->andReturn(true);
     $this->container->shouldReceive('findDefinition')->with('tactician.handler.locator.symfony')->once()->andReturn($definition);
     $this->container->shouldReceive('findTaggedServiceIds')->with('tactician.handler')->once()->andReturn(['service_id_1' => [['not_command' => 'my_command']], 'service_id_2' => [['command' => 'my_command']]]);
     $definition->shouldReceive('addArgument')->never();
     $this->compiler->process($this->container);
 }
开发者ID:nejcpenko,项目名称:tactician-bundle,代码行数:12,代码来源:CommandHandlerPassTest.php

示例2: testDoNotProcessWhenTacticianDoctrineIsNotInstalled

 public function testDoNotProcessWhenTacticianDoctrineIsNotInstalled()
 {
     if (class_exists(TransactionMiddleware::class)) {
         $this->markTestSkipped('"league/tactician-doctrine" is installed');
     }
     $this->container->shouldReceive('hasParameter')->with('doctrine.entity_managers')->andReturn(true);
     $this->container->shouldNotReceive('getParameter')->withAnyArgs();
     $this->container->shouldNotReceive('setDefinition')->withAnyArgs();
     $this->container->shouldNotReceive('setAlias')->withAnyArgs();
     $this->compiler->process($this->container);
 }
开发者ID:nejcpenko,项目名称:tactician-bundle,代码行数:11,代码来源:DoctrineMiddlewarePassTest.php

示例3: setup

 /**
  * Prepares the mocks
  */
 public function setup()
 {
     $this->setup = true;
     $this->containerParameters = array();
     $containerParameters =& $this->containerParameters;
     $this->containerDefinitions = array();
     $containerDefinitions =& $this->containerDefinitions;
     $this->containerAliases = array();
     $containerAliases =& $this->containerAliases;
     $this->containerBuilderMock = m::mock('Symfony\\Component\\DependencyInjection\\ContainerBuilder');
     $this->containerBuilderMock->shouldReceive('addResource')->andReturn();
     $this->containerBuilderMock->shouldReceive('setParameter')->andReturnUsing(function ($key, $value) use(&$containerParameters) {
         $containerParameters[$key] = $value;
     });
     $this->containerBuilderMock->shouldReceive('setDefinition')->andReturnUsing(function ($id, $definition) use(&$containerDefinitions) {
         $containerDefinitions[$id] = $definition;
     });
     $this->containerBuilderMock->shouldReceive('setAlias')->andReturnUsing(function ($alias, $id) use(&$containerAliases) {
         $containerAliases[$alias] = $id;
     });
 }
开发者ID:javihgil,项目名称:extra-bundle,代码行数:24,代码来源:ExtensionTestCase.php

示例4: testProcessWithDefinitionFailure

 public function testProcessWithDefinitionFailure()
 {
     $contextConfig = ['context1' => ['tag' => 'tag1'], 'context2' => ['tag' => 'tag2']];
     $taggedServices = ['tag1' => ['id1' => [], 'id2' => []], 'tag2' => ['id3' => []]];
     $this->container->shouldReceive('getParameter')->with('dms_chainlink.contexts')->once()->andReturn($contextConfig);
     $this->container->shouldReceive('setDefinition')->with('/^dms_chainlink\\.context\\..*/', m::type('Symfony\\Component\\DependencyInjection\\Definition'))->twice();
     $this->container->shouldReceive('setAlias')->with(m::anyOf('context1', 'context2'), m::anyOf(HandleTagsPass::SERVICE_PREFIX . 'context1', HandleTagsPass::SERVICE_PREFIX . 'context2'))->twice();
     $this->container->shouldReceive('hasDefinition')->with(m::anyOf(HandleTagsPass::SERVICE_PREFIX . 'context1', HandleTagsPass::SERVICE_PREFIX . 'context2'))->twice()->andReturn(false);
     $this->container->shouldReceive('getDefinition')->never();
     $this->container->shouldReceive('getDefinition')->never();
     $this->container->shouldReceive('findTaggedServiceIds')->never();
     $this->pass->process($this->container);
 }
开发者ID:symbid,项目名称:chainlink-bundle,代码行数:13,代码来源:HandleTagsPassTest.php


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