Permalink
Browse files

Add a test for passed options when rendering elements with `Renderer:…

…:_render()`
  • Loading branch information...
1 parent b27096c commit 825f4274ad44ac76993fb6fd22d2cf1f4b6411d1 @mehlah committed Sep 16, 2012
@@ -175,6 +175,38 @@ public function testNolayout() {
unset($renderData[0]['data']['h']);
$this->assertEqual($expected, $renderData);
}
+
+ public function testElementRendering() {
+ $view = new View(array(
+ 'loader' => 'lithium\tests\mocks\template\view\adapters\TestRenderer',
+ 'paths' => array(
+ 'template' => '{:library}/tests/mocks/template/view/adapters/{:template}.html.php',
+ 'element' => array(
+ '{:library}/tests/mocks/template/view/adapters/{:controller}/_{:template}.html.php',
+ '{:library}/tests/mocks/template/view/adapters/{:template}.html.php'
+
+ ),
+ 'layout' => false
+ )
+ ));
+
+ $options = array(
+ 'template' => 'testElement',
+ 'library' => LITHIUM_LIBRARY_PATH . '/lithium'
+ );
+ $result = $view->render('all', array(), $options);
+ $expected = 'This is a rendered element';
+ $this->assertEqual($expected, $result);
+
+ $options = array(
+ 'template' => 'testElement',
+ 'library' => LITHIUM_LIBRARY_PATH . '/lithium',
+ 'controller' => 'posts'
+ );
+ $result = $view->render('all', array(), $options);
+ $expected = 'This is a rendered _element';
+ $this->assertEqual($expected, $result);
+ }
}
?>
@@ -0,0 +1 @@
+element
@@ -0,0 +1 @@
+This is a rendered <?= $this->_render('element', 'elementFile'); ?>

0 comments on commit 825f427

Please sign in to comment.