Skip to content

Commit 19bfa2e

Browse files
committed
Added a test
1 parent 88b913b commit 19bfa2e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,21 @@ public function testTwigErrorIfLocatorReturnsFalse()
9898
$loader = new FilesystemLoader($locator, $parser);
9999
$loader->getCacheKey('name.format.engine');
100100
}
101+
102+
/**
103+
* @expectedException \Twig_Error_Loader
104+
* @expectedExceptionMessageRegExp /Unable to find template "name\.format\.engine" \(looked into: .*\/Tests\/Loader\/\.\.\/DependencyInjection\/Fixtures\/Resources\/views\)/
105+
*/
106+
public function testTwigErrorIfTemplateDoesNotExist()
107+
{
108+
$parser = $this->getMock('Symfony\Component\Templating\TemplateNameParserInterface');
109+
$locator = $this->getMock('Symfony\Component\Config\FileLocatorInterface');
110+
111+
$loader = new FilesystemLoader($locator, $parser);
112+
$loader->addPath(__DIR__.'/../DependencyInjection/Fixtures/Resources/views');
113+
114+
$method = new \ReflectionMethod('Symfony\Bundle\TwigBundle\Loader\FilesystemLoader', 'findTemplate');
115+
$method->setAccessible(true);
116+
$method->invoke($loader, 'name.format.engine');
117+
}
101118
}

0 commit comments

Comments
 (0)