public function testRenderDelegatesToSupportedEngine() { $firstEngine =
$this->
getEngineMock('template.php', false
);
$secondEngine =
$this->
getEngineMock('template.php', true
);
$secondEngine->
expects($this->
once()) ->
method('render'
) ->
with('template.php',
['foo' => 'bar'
]) ->
willReturn('<html />'
);
$delegatingEngine =
new DelegatingEngine([$firstEngine,
$secondEngine]);
$result =
$delegatingEngine->
render('template.php',
['foo' => 'bar'
]);
$this->
assertSame('<html />',
$result);
} public function testRenderWithNoSupportedEngine() { $this->
expectException(\RuntimeException::
class);
$this->
expectExceptionMessage('No engine is able to work with the template "template.php"'
);
$firstEngine =
$this->
getEngineMock('template.php', false
);
$secondEngine =
$this->
getEngineMock('template.php', false
);