Symfony\Bundle\TwigBundle\Loader\FilesystemLoader::exists PHP Method

exists() public method

The name parameter might also be a TemplateReferenceInterface.
public exists ( $name )
    public function exists($name)
    {
        return parent::exists((string) $name);
    }

Usage Example

 public function testExists()
 {
     // should return true for templates that Twig does not find, but Symfony does
     $parser = $this->getMock('Symfony\\Component\\Templating\\TemplateNameParserInterface');
     $locator = $this->getMock('Symfony\\Component\\Config\\FileLocatorInterface');
     $locator->expects($this->once())->method('locate')->will($this->returnValue($template = __DIR__ . '/../DependencyInjection/Fixtures/Resources/views/layout.html.twig'));
     $loader = new FilesystemLoader($locator, $parser);
     return $this->assertTrue($loader->exists($template));
 }