src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/HttpRenderingStrategyPassTest.php
/**
     * Tests that content rendering not implementing RenderingStrategyInterface
     * trigger an exception.
     *
     * @expectedException \InvalidArgumentException
     */
Tests that content rendering not implementing RenderingStrategyInterface
trigger an exception.


Tests that content rendering not implementing RenderingStrategyInterface trigger an exception .
public function testContentRendererWithoutInterface()
    {
        $services = array(
            'my_content_renderer' => array(),
        );
        $definition = $this->getMock('Symfony\Component\DependencyInjection\Definition');
        $definition->expects($this->atLeastOnce())
            ->method('getClass')
            ->will($this->returnValue('stdClass'));
        $builder = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder');
        $builder->expects($this->any())
            ->method('hasDefinition')
            ->will($this->returnValue(true));
        $builder->expects($this->atLeastOnce())
            ->method('findTaggedServiceIds')
            ->will($this->returnValue($services));
        $builder->expects($this->atLeastOnce())
            ->method('getDefinition')
            ->will($this->returnValue($definition));
        $pass = new HttpRenderingStrategyPass();
        $pass->process($builder);
    }
public function testContentRendererWithoutInterface ( ) { $ services = array ( 'my_content_renderer' => array ( ) , ) ; $ definition = $ this -> getMock ( 'Symfony\Component\DependencyInjection\Definition' ) ; $ definition -> expects ( $ this -> atLeastOnce ( ) ) -> method ( 'getClass' ) -> will ( $ this -> returnValue ( 'stdClass' ) ) ; $ builder = $ this -> getMock ( 'Symfony\Component\DependencyInjection\ContainerBuilder' ) ; $ builder -> expects ( $ this -> any ( ) ) -> method ( 'hasDefinition' ) -> will ( $ this -> returnValue ( true ) ) ; $ builder -> expects ( $ this -> atLeastOnce ( ) ) -> method ( 'findTaggedServiceIds' ) -> will ( $ this -> returnValue ( $ services ) ) ; $ builder -> expects ( $ this -> atLeastOnce ( ) ) -> method ( 'getDefinition' ) -> will ( $ this -> returnValue ( $ definition ) ) ; $ pass = new HttpRenderingStrategyPass ( ) ; $ pass -> process ( $ builder ) ; }
Tests that content rendering not implementing RenderingStrategyInterface
 trigger an exception.
Tests that content rendering not implementing RenderingStrategyInterface trigger an exception .
// one service, not implementing any interface // We don't test kernel.content_renderer_strategy here