lithium\tests\mocks\template\MockHelper::testRender PHP Method

testRender() public method

public testRender ( $method, $string, $params, array $options = [] )
$options array
    public function testRender($method, $string, $params, array $options = array())
    {
        return $this->_render($method, $string, $params, $options);
    }

Usage Example

Beispiel #1
0
 public function testRender()
 {
     $params = array('context' => new MockRenderer(), 'handlers' => array('content' => function ($value) {
         return "\n{$value}\n";
     }));
     $helper = new MockHelper($params);
     $config = array('title' => 'cool', 'url' => '/here', 'options' => array('value' => 1, 'title' => 'one'));
     $expected = '<a href="/here" value="1" title="one">cool</a>';
     $result = $helper->testRender('link', 'link', $config);
     $this->assertEqual($expected, $result);
     $handlers = array('path' => function ($path) {
         return "/webroot{$path}";
     });
     $params = array('context' => new MockRenderer(compact('handlers')));
     $helper = new MockHelper($params);
     $handlers = array('url' => 'path');
     $expected = '<a href="/webroot/here" value="1" title="one">cool</a>';
     $result = $helper->testRender('link', 'link', $config, compact('handlers'));
     $this->assertEqual($expected, $result);
 }