8000 [Templating|FrameworkBundle] Made DelegatingEngine::getEngine() public by jakzal · Pull Request #8280 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Templating|FrameworkBundle] Made DelegatingEngine::getEngine() public #8280

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 4 commits into from
Jun 17, 2013
Merged
Show file tree
Hide file tree
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
[FrameworkBundle] Made DelegatingEngine::getEngine() public.
  • Loading branch information
jakzal committed Jun 14, 2013
commit a54cbfffc32a66913d4816801ba9aa99a013c8fb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function supports($name)
/**
* {@inheritdoc}
*/
protected function getEngine($name)
public function getEngine($name)
{
foreach ($this->engines as $i => $engine) {
if (is_string($engine)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,37 @@ public function testSupportsRetrievesEngineFromTheContainer()
$this->assertTrue($delegatingEngine->supports('template.php'));
}

public function testGetExistingEngine()
{
$firstEngine = $this->getEngineMock('template.php', false);
$secondEngine = $this->getEngineMock('template.php', true);
$container = $this->getContainerMock(array(
'engine.first' => $firstEngine,
'engine.second' => $secondEngine
));

$delegatingEngine = new DelegatingEngine($container, array('engine.first', 'engine.second'));

$this->assertSame($secondEngine, $delegatingEngine->getEngine('template.php', array('foo' => 'bar')));
}

/**
* @expectedException \RuntimeException
* @expectedExceptionMessage No engine is able to work with the template "template.php"
*/
public function testGetInvalidEngine()
{
$firstEngine = $this->getEngineMock('template.php', false);
$secondEngine = $this->getEngineMock('template.php', false);
$container = $this->getContainerMock(array(
'engine.first' => $firstEngine,
'engine.second' => $secondEngine
));

$delegatingEngine = new DelegatingEngine($container, array('engine.first', 'engine.second'));
$delegatingEngine->getEngine('template.php', array('foo' => 'bar'));
}

public function testRenderResponse()
{
$response = $this->getMock('Symfony\Component\HttpFoundation\Response');
Expand Down
0