mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace SilverStripe\View\Tests\SSViewerTest;
|
||
|
|
||
|
use SilverStripe\Dev\TestOnly;
|
||
|
use SilverStripe\View\TemplateEngine;
|
||
|
use SilverStripe\View\ViewLayerData;
|
||
|
|
||
|
/**
|
||
|
* A dummy template renderer that doesn't actually render any templates.
|
||
|
*/
|
||
|
class DummyTemplateEngine implements TemplateEngine, TestOnly
|
||
|
{
|
||
|
private string $output = '<html><head></head><body></body></html>';
|
||
|
|
||
|
public function __construct(string|array $templateCandidates = [])
|
||
|
{
|
||
|
// no-op
|
||
|
}
|
||
|
|
||
|
public function setTemplate(string|array $templateCandidates): static
|
||
|
{
|
||
|
return $this;
|
||
|
}
|
||
|
|
||
|
public function hasTemplate(string|array $templateCandidates): bool
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public function renderString(string $template, ViewLayerData $model, array $overlay = [], bool $cache = true): string
|
||
|
{
|
||
|
return $this->output;
|
||
|
}
|
||
|
|
||
|
public function render(ViewLayerData $model, array $overlay = []): string
|
||
|
{
|
||
|
return $this->output;
|
||
|
}
|
||
|
|
||
|
public function setOutput(string $output): void
|
||
|
{
|
||
|
$this->output = $output;
|
||
|
}
|
||
|
}
|