This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/tests/unit/Symfony/Components/Templating/Renderer/RendererTest.php

45 lines
1.2 KiB
PHP

<?php
/*
* This file is part of the symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__.'/../../../../bootstrap.php';
require_once __DIR__.'/../../../../../lib/SymfonyTests/Components/Templating/SimpleHelper.php';
use Symfony\Components\Templating\Engine;
use Symfony\Components\Templating\Renderer\Renderer;
use Symfony\Components\Templating\Storage\Storage;
use Symfony\Components\Templating\Loader\FilesystemLoader;
$t = new LimeTest(1);
class ProjectTemplateRenderer extends Renderer
{
public function getEngine()
{
return $this->engine;
}
public function evaluate(Storage $template, array $parameters = array())
{
}
}
$loader = new FilesystemLoader(array(__DIR__.'/fixtures/templates/%name%.%renderer%'));
$engine = new Engine($loader);
$engine->set('foo', 'bar');
$engine->getHelperSet()->set(new SimpleHelper('foo'), 'bar');
// ->setEngine()
$t->diag('->setEngine()');
$renderer = new ProjectTemplateRenderer();
$renderer->setEngine($engine);
$t->ok($renderer->getEngine() === $engine, '->setEngine() sets the engine instance tied to this renderer');