Added a test
This commit is contained in:
parent
88b913b0c4
commit
19bfa2ed8c
@ -98,4 +98,21 @@ class FilesystemLoaderTest extends TestCase
|
|||||||
$loader = new FilesystemLoader($locator, $parser);
|
$loader = new FilesystemLoader($locator, $parser);
|
||||||
$loader->getCacheKey('name.format.engine');
|
$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');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user