From b866c0031817bb1d293f83aa465f280863165246 Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 21 Sep 2011 22:32:39 -0400 Subject: [PATCH] Renaming methods so they are shorter and still make sense. --- lib/Cake/Test/Case/View/ViewTest.php | 18 +++++++++--------- lib/Cake/View/View.php | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/Cake/Test/Case/View/ViewTest.php b/lib/Cake/Test/Case/View/ViewTest.php index e87e8950b..cff2ebcc1 100644 --- a/lib/Cake/Test/Case/View/ViewTest.php +++ b/lib/Cake/Test/Case/View/ViewTest.php @@ -937,7 +937,7 @@ class ViewTest extends CakeTestCase { echo 'Block content'; $this->View->end(); - $result = $this->View->getBlock('test'); + $result = $this->View->fetch('test'); $this->assertEquals('Block content', $result); } @@ -955,7 +955,7 @@ class ViewTest extends CakeTestCase { echo ' content'; $this->View->end(); - $result = $this->View->getBlock('test'); + $result = $this->View->fetch('test'); $this->assertEquals('Block content', $result); } @@ -965,8 +965,8 @@ class ViewTest extends CakeTestCase { * @return void */ public function testBlockSet() { - $this->View->setBlock('test', 'Block content'); - $result = $this->View->getBlock('test'); + $this->View->assign('test', 'Block content'); + $result = $this->View->fetch('test'); $this->assertEquals('Block content', $result); } @@ -976,10 +976,10 @@ class ViewTest extends CakeTestCase { * @return void */ public function testBlockAppend() { - $this->View->setBlock('test', 'Block'); + $this->View->assign('test', 'Block'); $this->View->append('test', ' content'); - $result = $this->View->getBlock('test'); + $result = $this->View->fetch('test'); $this->assertEquals('Block content', $result); } @@ -990,7 +990,7 @@ class ViewTest extends CakeTestCase { */ public function testBlockAppendUndefined() { $this->View->append('test', 'Unknown'); - $result = $this->View->getBlock('test'); + $result = $this->View->fetch('test'); $this->assertEquals('Unknown', $result); } @@ -1001,7 +1001,7 @@ class ViewTest extends CakeTestCase { * @return void */ public function testBlockSetArrayException() { - $this->View->setBlock('test', array(1, 2, 3)); + $this->View->assign('test', array(1, 2, 3)); } /** @@ -1021,7 +1021,7 @@ class ViewTest extends CakeTestCase { */ public function testBlocks() { $this->View->append('test', 'one'); - $this->View->setBlock('test1', 'one'); + $this->View->assign('test1', 'one'); $this->assertEquals(array('test', 'test1'), $this->View->blocks()); } diff --git a/lib/Cake/View/View.php b/lib/Cake/View/View.php index 691d0a390..a3a223a1b 100644 --- a/lib/Cake/View/View.php +++ b/lib/Cake/View/View.php @@ -568,20 +568,20 @@ class View extends Object { * @return void * @throws CakeException when you use non-string values. */ - public function setBlock($name, $value) { + public function assign($name, $value) { if (!is_string($value)) { - throw new CakeException(__d('cake_dev', 'You can only append strings.')); + throw new CakeException(__d('cake_dev', 'Blocks can only contain strings.')); } $this->_blocks[$name] = $value; } /** - * Get the content for a block. + * Fetch the content for a block. * * @param string $name Name of the block * @return The block content or '' if the block does not exist. */ - public function getBlock($name) { + public function fetch($name) { if (!isset($this->_blocks[$name])) { return ''; }