Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Renaming methods so they are shorter and still make sense.

  • Loading branch information...
commit b866c0031817bb1d293f83aa465f280863165246 1 parent 82139fe
@markstory markstory authored
Showing with 13 additions and 13 deletions.
  1. +9 −9 lib/Cake/Test/Case/View/ViewTest.php
  2. +4 −4 lib/Cake/View/View.php
View
18 lib/Cake/Test/Case/View/ViewTest.php
@@ -937,7 +937,7 @@ public function testBlockCapture() {
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 @@ public function testBlockCaptureAppend() {
echo ' content';
$this->View->end();
- $result = $this->View->getBlock('test');
+ $result = $this->View->fetch('test');
$this->assertEquals('Block content', $result);
}
@@ -965,8 +965,8 @@ public function testBlockCaptureAppend() {
* @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 @@ public function testBlockSet() {
* @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 @@ public function testBlockAppend() {
*/
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 @@ public function testBlockAppendUndefined() {
* @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 @@ public function testBlockAppendArrayException() {
*/
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());
}
View
8 lib/Cake/View/View.php
@@ -568,20 +568,20 @@ public function append($name, $value = null) {
* @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 '';
}
Please sign in to comment.
Something went wrong with that request. Please try again.