Added a test

This commit is contained in:
Javier Eguiluz 2016-01-27 18:13:21 +01:00
parent 88b913b0c4
commit 19bfa2ed8c
1 changed files with 17 additions and 0 deletions

View File

@ -98,4 +98,21 @@ class FilesystemLoaderTest extends TestCase
$loader = new FilesystemLoader($locator, $parser);
$loader->getCacheKey('name.format.engine');
}
/**
* @expectedException \Twig_Error_Loader
* @expectedExceptionMessageRegExp /Unable to find template "name\.format\.engine" \(looked into: .*\/Tests\/Loader\/\.\.\/DependencyInjection\/Fixtures\/Resources\/views\)/
*/
public function testTwigErrorIfTemplateDoesNotExist()
{
$parser = $this->getMock('Symfony\Component\Templating\TemplateNameParserInterface');
$locator = $this->getMock('Symfony\Component\Config\FileLocatorInterface');
$loader = new FilesystemLoader($locator, $parser);
$loader->addPath(__DIR__.'/../DependencyInjection/Fixtures/Resources/views');
$method = new \ReflectionMethod('Symfony\Bundle\TwigBundle\Loader\FilesystemLoader', 'findTemplate');
$method->setAccessible(true);
$method->invoke($loader, 'name.format.engine');
}
}