Example #1
0
 public function testGetSourceContext()
 {
     $parser = $this->getMockBuilder('Symfony\\Component\\Templating\\TemplateNameParserInterface')->getMock();
     $locator = $this->getMockBuilder('Symfony\\Component\\Config\\FileLocatorInterface')->getMock();
     $locator->expects($this->once())->method('locate')->will($this->returnValue(__DIR__ . '/../DependencyInjection/Fixtures/Resources/views/layout.html.twig'));
     $loader = new FilesystemLoader($locator, $parser);
     $loader->addPath(__DIR__ . '/../DependencyInjection/Fixtures/Resources/views', 'namespace');
     // Twig-style
     $this->assertEquals("This is a layout\n", $loader->getSourceContext('@namespace/layout.html.twig')->getCode());
     // Symfony-style
     $this->assertEquals("This is a layout\n", $loader->getSourceContext('TwigBundle::layout.html.twig')->getCode());
 }