Merge pull request #1441 from ravage84/ViewTestsCleanup

Added missing test + minor cleanup of ViewTests.php
This commit is contained in:
Mark Story 2013-07-19 19:40:09 -07:00
commit 1402796047

View file

@ -106,7 +106,7 @@ class TestThemeView extends View {
*
* @param string $name
* @param array $params
* @return void
* @return string The given name
*/
public function renderElement($name, $params = array()) {
return $name;
@ -115,8 +115,8 @@ class TestThemeView extends View {
/**
* getViewFileName method
*
* @param string $name
* @return void
* @param string $name Controller action to find template filename for
* @return string Template filename
*/
public function getViewFileName($name = null) {
return $this->_getViewFileName($name);
@ -125,8 +125,8 @@ class TestThemeView extends View {
/**
* getLayoutFileName method
*
* @param string $name
* @return void
* @param string $name The name of the layout to find.
* @return string Filename for layout file (.ctp).
*/
public function getLayoutFileName($name = null) {
return $this->_getLayoutFileName($name);
@ -144,8 +144,8 @@ class TestView extends View {
/**
* getViewFileName method
*
* @param string $name
* @return void
* @param string $name Controller action to find template filename for
* @return string Template filename
*/
public function getViewFileName($name = null) {
return $this->_getViewFileName($name);
@ -154,8 +154,8 @@ class TestView extends View {
/**
* getLayoutFileName method
*
* @param string $name
* @return void
* @param string $name The name of the layout to find.
* @return string Filename for layout file (.ctp).
*/
public function getLayoutFileName($name = null) {
return $this->_getLayoutFileName($name);
@ -164,9 +164,9 @@ class TestView extends View {
/**
* paths method
*
* @param string $plugin
* @param boolean $cached
* @return void
* @param string $plugin Optional plugin name to scan for view files.
* @param boolean $cached Set to true to force a refresh of view paths.
* @return array paths
*/
public function paths($plugin = null, $cached = true) {
return $this->_paths($plugin, $cached);
@ -200,6 +200,7 @@ class TestAfterHelper extends Helper {
/**
* beforeLayout method
*
* @param string $viewFile
* @return void
*/
public function beforeLayout($viewFile) {
@ -209,6 +210,7 @@ class TestAfterHelper extends Helper {
/**
* afterLayout method
*
* @param string $layoutFile
* @return void
*/
public function afterLayout($layoutFile) {
@ -529,7 +531,7 @@ class ViewTest extends CakeTestCase {
$View = new TestView($this->Controller);
ob_start();
$result = $View->getViewFileName('does_not_exist');
$View->getViewFileName('does_not_exist');
$this->ThemeController->plugin = null;
$this->ThemeController->name = 'Pages';
@ -557,8 +559,8 @@ class ViewTest extends CakeTestCase {
$View = new TestView($this->Controller);
ob_start();
$result = $View->getLayoutFileName();
$expected = ob_get_clean();
$View->getLayoutFileName();
ob_get_clean();
$this->ThemeController->plugin = null;
$this->ThemeController->name = 'Posts';
@ -567,7 +569,7 @@ class ViewTest extends CakeTestCase {
$this->ThemeController->theme = 'my_theme';
$View = new TestThemeView($this->ThemeController);
$result = $View->getLayoutFileName();
$View->getLayoutFileName();
}
/**
@ -762,7 +764,7 @@ class ViewTest extends CakeTestCase {
$result = Cache::read('element__test_element_cache_callbacks_param_foo', 'test_view');
$this->assertEquals($expected, $result);
$result = $View->element('test_element', array(
$View->element('test_element', array(
'param' => 'one',
'foo' => 'two'
), array(
@ -772,7 +774,7 @@ class ViewTest extends CakeTestCase {
$this->assertEquals($expected, $result);
$View->elementCache = 'default';
$result = $View->element('test_element', array(
$View->element('test_element', array(
'param' => 'one',
'foo' => 'two'
), array(
@ -1310,6 +1312,17 @@ class ViewTest extends CakeTestCase {
$this->assertEquals('Block content', $result);
}
/**
* Test resetting a block's content.
*
* @return void
*/
public function testBlockReset() {
$this->View->assign('test', '');
$result = $this->View->fetch('test', 'This should not be returned');
$this->assertSame('', $result);
}
/**
* Test appending to a block with append.
*