mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
25126267af
Includes the following large-scale changes: - Impoved barrier between model and view layers - Improved casting of scalar to relevant DBField types - Improved capabilities for rendering arbitrary data in templates
41 lines
971 B
PHP
41 lines
971 B
PHP
<?php
|
|
|
|
namespace SilverStripe\Control\Tests\ControllerTest;
|
|
|
|
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 = 'This is my controller';
|
|
|
|
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;
|
|
}
|
|
}
|