lithium\test\Report::render PHP Method

render() public method

Renders the test output (e.g. layouts and filter templates).
public render ( string $template, string | array $data = [] ) : string
$template string name of the template (i.e. `'layout'`).
$data string | array array from `_data()` method.
return string
    public function render($template, $data = array())
    {
        $config = $this->_config;
        if ($template === 'stats' && !$data) {
            $data = $this->stats();
        }
        $template = Libraries::locate('test.templates', $template, array('filter' => false, 'type' => 'file', 'suffix' => ".{$config['format']}.php"));
        $params = compact('template', 'data', 'config');
        return $this->_filter(__METHOD__, $params, function ($self, $params, $chain) {
            extract($params['data']);
            ob_start();
            include $params['template'];
            return ob_get_clean();
        });
    }

Usage Example

Example #1
0
 public function testRender()
 {
     $report = new Report(array('title' => '\\lithium\\tests\\mocks\\test\\MockUnitTest', 'group' => new Group(array('data' => array('\\lithium\\tests\\mocks\\test\\MockUnitTest'))), 'format' => 'txt'));
     $report->run();
     $result = $report->render('result', $report->stats());
     $this->assertPattern('#2.*2.*passes.*0.*fails.*0.*exceptions#s', $result);
 }
All Usage Examples Of lithium\test\Report::render