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


PHP Definition::getMethodCalls方法代码示例

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


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

示例1: then_references_are_replaced_with_services

 private function then_references_are_replaced_with_services()
 {
     $methodCalls = $this->apiDefinition->getMethodCalls();
     $defaultParams = $methodCalls[0][1][0];
     $this->assertSame('my_value', $defaultParams['my_param']);
     $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Reference', $defaultParams[0]);
     $this->assertSame('my_param_service', (string) $defaultParams[0]);
 }
开发者ID:devhelp,项目名称:piwik-bundle,代码行数:8,代码来源:InsertParamsServicesTest.php

示例2: testMapperPassWithTwoTaggedLoaders

 public function testMapperPassWithTwoTaggedLoaders()
 {
     $serviceIds = array('test_loader_1' => array(), 'test_loader_2' => array());
     $this->builder->expects($this->once())->method('hasDefinition')->with('twig')->will($this->returnValue(true));
     $this->builder->expects($this->once())->method('findTaggedServiceIds')->with('twig.loader')->will($this->returnValue($serviceIds));
     $this->builder->expects($this->once())->method('getDefinition')->with('twig.loader.chain')->will($this->returnValue($this->chainLoader));
     $this->builder->expects($this->once())->method('setAlias')->with('twig.loader', 'twig.loader.chain');
     $this->pass->process($this->builder);
     $calls = $this->chainLoader->getMethodCalls();
     $this->assertCount(2, $calls);
     $this->assertEquals('addLoader', $calls[0][0]);
 }
开发者ID:Chaireeee,项目名称:chaireeee,代码行数:12,代码来源:TwigLoaderPassTest.php

示例3: commandBusContainsMiddlewares

 private function commandBusContainsMiddlewares($expectedMiddlewareIds)
 {
     $actualMiddlewareIds = [];
     foreach ($this->mainBusDefinition->getMethodCalls() as $methodCall) {
         list($method, $arguments) = $methodCall;
         $this->assertSame('appendMiddleware', $method);
         $this->assertCount(1, $arguments);
         $referencedService = $arguments[0];
         $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Reference', $referencedService);
         $actualMiddlewareIds[] = (string) $referencedService;
     }
     $this->assertEquals($expectedMiddlewareIds, $actualMiddlewareIds);
 }
开发者ID:hmlb,项目名称:ddd-bundle,代码行数:13,代码来源:ConfigureMiddlewaresTest.php

示例4: testProcess

 public function testProcess()
 {
     $container = new ContainerBuilder();
     $simpleFactory = new Definition();
     $simpleProcessor = new Definition('Test\\SimpleProcessor');
     $simpleProcessor->addTag('processor');
     $abstractProcessor = new Definition();
     $abstractProcessor->setAbstract(true);
     $abstractProcessor->addTag('processor');
     $lazyProcessor = new Definition('Test\\LazyProcessor');
     $lazyProcessor->setLazy(true);
     $lazyProcessor->addTag('processor');
     $withArgumentsProcessor = new Definition('Test\\WithArgumentsProcessor', ['test']);
     $withArgumentsProcessor->addTag('processor');
     $container->addDefinitions(['simple_factory' => $simpleFactory, 'simple_processor' => $simpleProcessor, 'abstract_processor' => $abstractProcessor, 'lazy_processor' => $lazyProcessor, 'with_arguments_processor' => $withArgumentsProcessor]);
     $compilerPass = new CleanUpProcessorsCompilerPass('simple_factory', 'processor');
     $compilerPass->process($container);
     $this->assertFalse($container->hasDefinition('simple_processor'));
     $this->assertTrue($container->hasDefinition('abstract_processor'));
     $this->assertTrue($container->hasDefinition('lazy_processor'));
     $this->assertTrue($container->hasDefinition('with_arguments_processor'));
     $methodCalls = $simpleFactory->getMethodCalls();
     $this->assertCount(1, $methodCalls);
     $this->assertEquals(['addProcessor', ['simple_processor', 'Test\\SimpleProcessor']], $methodCalls[0]);
 }
开发者ID:ramunasd,项目名称:platform,代码行数:25,代码来源:CleanUpProcessorsCompilerPassTest.php

示例5: callMethodFirst

 /**
  * @param Definition $definition
  * @param string $methodName
  * @param array $arguments
  */
 private function callMethodFirst(Definition $definition, $methodName, array $arguments)
 {
     $newMethodCall = array($methodName, $arguments);
     $currentMethodCalls = $definition->getMethodCalls();
     array_unshift($currentMethodCalls, $newMethodCall);
     $definition->setMethodCalls($currentMethodCalls);
 }
开发者ID:phatj,项目名称:CrudAbstractDataBundle,代码行数:12,代码来源:CrudTagCompilerPass.php

示例6: testProcess

 /**
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function testProcess()
 {
     $container = new ContainerBuilder();
     $processorBag = new Definition('Test\\ProcessorBag');
     $processor1 = new Definition('Test\\Processor1');
     $processor1->addTag('processor', ['action' => 'action1', 'group' => 'group1', 'priority' => 123]);
     $processor1->addTag('processor', ['action' => 'action2', 'group' => 'group2', 'test_attr' => 'test']);
     $processor1->addTag('processor', ['action' => 'action3', 'group' => 'group3', 'test_attr' => 'test1&test2']);
     $processor2 = new Definition('Test\\Processor2');
     $processor2->addTag('processor', ['action' => 'action1']);
     $processor3 = new Definition('Test\\Processor3');
     $processor3->addTag('processor');
     $applicableChecker1 = new Definition('Test\\ApplicableChecker1');
     $applicableChecker1->addTag('applicable_checker');
     $applicableChecker2 = new Definition('Test\\ApplicableChecker1');
     $applicableChecker2->addTag('applicable_checker', ['priority' => 123]);
     $container->addDefinitions(['processor_bag' => $processorBag, 'processor1' => $processor1, 'processor2' => $processor2, 'processor3' => $processor3, 'applicable_checker1' => $applicableChecker1, 'applicable_checker2' => $applicableChecker2]);
     $compilerPass = new LoadProcessorsCompilerPass('processor_bag', 'processor', 'applicable_checker');
     $compilerPass->process($container);
     $methodCalls = $processorBag->getMethodCalls();
     $this->assertCount(7, $methodCalls);
     $this->assertEquals(['addProcessor', ['processor1', [], 'action1', 'group1', 123]], $methodCalls[0]);
     $this->assertEquals(['addProcessor', ['processor1', ['test_attr' => 'test'], 'action2', 'group2', 0]], $methodCalls[1]);
     $this->assertEquals(['addProcessor', ['processor1', ['test_attr' => ['test1', 'test2']], 'action3', 'group3', 0]], $methodCalls[2]);
     $this->assertEquals(['addProcessor', ['processor2', [], 'action1', null, 0]], $methodCalls[3]);
     $this->assertEquals(['addProcessor', ['processor3', [], null, null, 0]], $methodCalls[4]);
     $this->assertEquals(['addApplicableChecker', [new Reference('applicable_checker1'), 0]], $methodCalls[5]);
     $this->assertEquals(['addApplicableChecker', [new Reference('applicable_checker2'), 123]], $methodCalls[6]);
 }
开发者ID:ramunasd,项目名称:platform,代码行数:32,代码来源:LoadProcessorsCompilerPassTest.php

示例7: testAddMethodCallToMonolog

 public function testAddMethodCallToMonolog()
 {
     $definition = new Definition();
     $container = $this->getContainerBuilder(['monolog.logger_prototype' => $definition], ['riemann.integration.monolog' => true]);
     $pass = new MonologIntegrationPass();
     $pass->process($container);
     self::assertCount(1, $definition->getMethodCalls());
 }
开发者ID:trademachines,项目名称:riemann-logging-bundle,代码行数:8,代码来源:MonologIntegrationPassTest.php

示例8: getLocaleDriver

 /**
  * @param Definition $definition
  *
  * @return string|null
  */
 private function getLocaleDriver(Definition $definition)
 {
     foreach ($definition->getMethodCalls() as $methodCall) {
         if ($methodCall[0] === 'setDriver') {
             return $methodCall[1][0];
         }
     }
 }
开发者ID:php-lug,项目名称:lug,代码行数:13,代码来源:RegisterValidationMetadataPass.php

示例9: testRegisterCommandHandlers

 public function testRegisterCommandHandlers()
 {
     $definition = new Definition('stdClass', ['', []]);
     $container = new ContainerBuilder();
     $container->addDefinitions(['seven_service_bus.self_binding' => $definition, 'foo' => $this->getTaggedService('service_binding', ['topic' => 'foo_topic', 'version' => '0', 'method' => 'foo_method']), 'bar' => $this->getTaggedService('service_binding', ['topic' => 'bar_topic']), 'baz' => $this->getTaggedService('service_binding', ['version' => '0', 'method' => 'baz_method'])]);
     $this->process($container);
     $calls = $definition->getMethodCalls();
     $this->assertEquals([['on', ['foo_topic', '0', 'foo', 'foo_method']], ['on', ['bar_topic', null, 'bar', null]]], $calls);
 }
开发者ID:skolodyazhnyy,项目名称:service-bus-bundle,代码行数:9,代码来源:ServiceBindingPassTest.php

示例10: assertDefinitionContainsMethodCall

 protected function assertDefinitionContainsMethodCall(Definition $serviceDefinition, $expectedMethod, $expectedFirstArgument)
 {
     foreach ($serviceDefinition->getMethodCalls() as $methodCall) {
         if ($expectedMethod == $methodCall[0] && $expectedFirstArgument == $methodCall[1][0]) {
             return;
         }
     }
     $this->fail(sprintf('Failed assert that service (Class: %s) has method %s been called with first argument %s', $serviceDefinition->getClass(), $expectedMethod, $expectedFirstArgument));
 }
开发者ID:DocHoncho,项目名称:PayumBundle,代码行数:9,代码来源:AbstractStorageFactoryTest.php

示例11: getMethodCallsByName

 /**
  * @param Definition $serviceDefinition
  * @param string     $methodName
  *
  * @return array
  */
 protected function getMethodCallsByName(Definition $serviceDefinition, $methodName)
 {
     $ret = [];
     foreach ($serviceDefinition->getMethodCalls() as $methodCall) {
         list($name, $args) = $methodCall;
         if ($name === $methodName) {
             $ret[] = $args;
         }
     }
     return $ret;
 }
开发者ID:michalmrzyk,项目名称:omnipay-bundle,代码行数:17,代码来源:GatewayTagCompilerPassTest.php

示例12: createLazyDefinition

 /**
  * @param string     $registry
  * @param Definition $definition
  *
  * @return Definition
  */
 private function createLazyDefinition($registry, Definition $definition)
 {
     $lazy = new Definition(LazyServiceRegistry::class, [new Reference('service_container'), new Reference($registry)]);
     foreach ($definition->getMethodCalls() as $methodCall) {
         if ($methodCall[0] === 'offsetSet') {
             $methodCall[1][1] = (string) $methodCall[1][1];
             $lazy->addMethodCall('setLazy', $methodCall[1]);
         }
     }
     return $lazy;
 }
开发者ID:blazarecki,项目名称:lug,代码行数:17,代码来源:ConvertServiceRegistryPass.php

示例13: mergeTemplateIntoDefinition

 /**
  * Merge Template into Service Definition
  *
  * @access private
  * @param \Symfony\Component\DependencyInjection\Definition $service
  * @param \Symfony\Component\DependencyInjection\Definition $template
  * @return \Symfony\Component\DependencyInjection\Definition
  */
 private function mergeTemplateIntoDefinition(Definition $service, Definition $template)
 {
     $serviceMethodCalls = $service->getMethodCalls();
     foreach ($template->getMethodCalls() as $methodCall) {
         list($method, $arguments) = $methodCall;
         if (!isset($serviceMethodCalls[$method])) {
             $service->addMethodCall($method, $arguments);
         }
     }
     return $service;
 }
开发者ID:darsyn,项目名称:service-templates-bundle,代码行数:19,代码来源:ServiceTemplatePass.php

示例14: testProcess

 public function testProcess()
 {
     $container = new ContainerBuilder();
     $chainResolver = new Definition();
     $resolver1 = new Definition();
     $resolver2 = new Definition();
     $resolver3 = new Definition();
     $resolver4 = new Definition();
     $resolver1->addTag(RoutingOptionsResolverPass::RESOLVER_TAG_NAME, ['priority' => -100]);
     $resolver2->addTag(RoutingOptionsResolverPass::RESOLVER_TAG_NAME, ['priority' => 100]);
     $resolver3->addTag(RoutingOptionsResolverPass::RESOLVER_TAG_NAME);
     $resolver4->addTag(RoutingOptionsResolverPass::RESOLVER_TAG_NAME, ['priority' => -100]);
     $container->addDefinitions([RoutingOptionsResolverPass::CHAIN_RESOLVER_SERVICE => $chainResolver, 'resolver1' => $resolver1, 'resolver2' => $resolver2, 'resolver3' => $resolver3, 'resolver4' => $resolver4]);
     $this->compilerPass->process($container);
     $this->assertEquals([['addResolver', [new Reference('resolver2')]], ['addResolver', [new Reference('resolver3')]], ['addResolver', [new Reference('resolver1')]], ['addResolver', [new Reference('resolver4')]]], $chainResolver->getMethodCalls());
 }
开发者ID:ramunasd,项目名称:platform,代码行数:16,代码来源:RoutingOptionsResolverPassTest.php

示例15: mergeMethodCall

 /**
  * @param Definition $definition
  * @param string     $name
  * @param mixed      $value
  */
 public function mergeMethodCall(Definition $definition, $name, $value)
 {
     $methodCalls = $definition->getMethodCalls();
     foreach ($methodCalls as &$calls) {
         foreach ($calls as &$call) {
             if (is_string($call)) {
                 if ($call !== $name) {
                     continue 2;
                 }
                 continue 1;
             }
             $call = array(array_merge($call[0], $value));
         }
     }
     $definition->setMethodCalls($methodCalls);
 }
开发者ID:jayesbe,项目名称:SonataDoctrineORMAdminBundle,代码行数:21,代码来源:AddTemplatesCompilerPass.php


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