當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。