Esempio n. 1
0
 public function testValidCollector()
 {
     // one service, with a template key, but no id
     $services = array('my_collector_service' => array(0 => array('template' => 'foo', 'id' => 'my_collector')));
     $container = $this->createContainerMock($services);
     // fake the getDefinition() to return a Profiler definition
     $container->expects($this->atLeastOnce())->method('getDefinition');
     // assert that the data_collector.templates parameter should be set
     $container->expects($this->once())->method('setParameter')->with('data_collector.templates', array('my_collector_service' => array('my_collector', 'foo')));
     $profilerPass = new ProfilerPass();
     $profilerPass->process($container);
     // grab the method calls off of the "profiler" definition
     $methodCalls = $this->profilerDefinition->getMethodCalls();
     $this->assertCount(1, $methodCalls);
     $this->assertEquals('add', $methodCalls[0][0]);
     // grab the method part of the first call
 }
Esempio n. 2
0
 public function testValidCollector()
 {
     // one service, with a template key, but no id
     $services = array('my_collector_service' => array(0 => array('template' => 'foo', 'id' => 'my_collector')));
     $container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerBuilder');
     $container->expects($this->atLeastOnce())->method('findTaggedServiceIds')->will($this->returnValue($services));
     // fake the getDefinition() to return a Profiler definition
     $definition = new Definition('ProfilerClass');
     $container->expects($this->atLeastOnce())->method('getDefinition')->will($this->returnValue($definition));
     // assert that the data_collector.templates parameter should be set
     $container->expects($this->once())->method('setParameter')->with('data_collector.templates', array('my_collector_service' => array('my_collector', 'foo')));
     $profilerPass = new ProfilerPass();
     $profilerPass->process($container);
     // grab the method calls off of the "profiler" definition
     $methodCalls = $definition->getMethodCalls();
     $this->assertCount(1, $methodCalls);
     $this->assertEquals('add', $methodCalls[0][0]);
     // grab the method part of the first call
 }