lithium\test\Report::render()

public method

Renders the test output (e.g. layouts and filter templates).

Parameters

  • string $template

    name of the template (i.e. 'layout').

  • string|array $data

    array from _data() method.

Returns

string

Filter

This method can be filtered.

Source

	public function render($template, $data = []) {
		$config = $this->_config;

		if ($template === 'stats' && !$data) {
			$data = $this->stats();
		}
		$template = Libraries::locate('test.templates', $template, [
			'filter' => false, 'type' => 'file', 'suffix' => ".{$config['format']}.php"
		]);

		if ($template === null) {
			$message = "Templates for format `{$config['format']}` not found in `test/templates`.";
			throw new TemplateException($message);
		}
		$params = compact('template', 'data', 'config');

		return Filters::run(__CLASS__, __FUNCTION__, $params, function($params) {
			extract($params['data']);
			ob_start();
			include $params['template'];
			return ob_get_clean();
		});
	}