8000 Improved the error message when a template is not found by javiereguiluz · Pull Request #17434 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Improved the error message when a template is not found #17434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 3, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added a test
  • Loading branch information
javiereguiluz committed Jan 27, 2016
commit 19bfa2ed8c4c216ed827670ed53e1aa408a3a00d
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,21 @@ public function testTwigErrorIfLocatorReturnsFalse()
$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');
}
}
0