本文整理匯總了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);
}