本文整理汇总了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);
}
示例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);
}
示例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;
});
}
示例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);
}