Browse Source

Rename FlashHelper's 'out' to 'render'

Bryan Crowe 11 years ago
parent
commit
a5a5eb4313
2 changed files with 12 additions and 12 deletions
  1. 6 6
      src/View/Helper/FlashHelper.php
  2. 6 6
      tests/TestCase/View/Helper/FlashHelperTest.php

+ 6 - 6
src/View/Helper/FlashHelper.php

@@ -39,14 +39,14 @@ class FlashHelper extends Helper {
 /**
  * Used to render the message set in FlashCompnet::set()
  *
- * In your view: $this->Flash->out('somekey');
+ * In your view: $this->Flash->render('somekey');
  * Will default to flash if no param is passed
  *
  * You can pass additional information into the flash message generation. This allows you
  * to consolidate all the parameters for a given type of flash message into the view.
  *
  * {{{
- * echo $this->Flash->out('flash', ['class' => 'new-flash']);
+ * echo $this->Flash->render('flash', ['class' => 'new-flash']);
  * }}}
  *
  * The above would generate a flash message with a custom class name. Using $attrs['params'] you
@@ -54,7 +54,7 @@ class FlashHelper extends Helper {
  * when the element is rendered:
  *
  * {{{
- * echo $this->Flash->out('flash', ['params' => ['name' => $user['User']['name']]]);
+ * echo $this->Flash->render('flash', ['params' => ['name' => $user['User']['name']]]);
  * }}}
  *
  * This would pass the current user's name into the flash message, so you could create personalized
@@ -64,14 +64,14 @@ class FlashHelper extends Helper {
  * custom elements allows you to fully customize how flash messages are generated.
  *
  * {{{
- * echo $this->Flash->out('flash', [element' => 'my_custom_element']);
+ * echo $this->Flash->render('flash', [element' => 'my_custom_element']);
  * }}}
  *
  * If you want to use an element from a plugin for rendering your flash message
  * you can use the dot notation for the plugin's element name:
  *
  * {{{
- * echo $this->Flash->out('flash', [
+ * echo $this->Flash->render('flash', [
  *   'element' => 'MyPlugin.my_custom_element',
  * ]);
  * }}}
@@ -81,7 +81,7 @@ class FlashHelper extends Helper {
  *    Supports the 'params', and 'element' keys that are used in the helper.
  * @return string
  */
-	public function out($key = 'flash', $attrs = []) {
+	public function render($key = 'flash', $attrs = []) {
 		$flash = $this->request->session()->read("Message.$key");
 		$this->request->session()->delete("Message.$key");
 

+ 6 - 6
tests/TestCase/View/Helper/FlashHelperTest.php

@@ -89,15 +89,15 @@ class FlashHelperTest extends TestCase {
  * @return void
  */
 	public function testFlash() {
-		$result = $this->Flash->out();
+		$result = $this->Flash->render();
 		$expected = '<div id="flash-message" class="message-info">This is a calling</div>';
 		$this->assertEquals($expected, $result);
 
 		$expected = '<div id="classy-message" class="message-positive">Recorded</div>';
-		$result = $this->Flash->out('classy');
+		$result = $this->Flash->render('classy');
 		$this->assertEquals($expected, $result);
 
-		$result = $this->Flash->out('notification');
+		$result = $this->Flash->render('notification');
 		$result = str_replace("\r\n", "\n", $result);
 		$expected = "<div id=\"notificationLayout\">\n\t<h1>Alert!</h1>\n\t<h3>Notice!</h3>\n\t<p>This is a test of the emergency broadcasting system</p>\n</div>";
 		$this->assertEquals($expected, $result);
@@ -109,7 +109,7 @@ class FlashHelperTest extends TestCase {
  * @return void
  */
 	public function testFlashAttributes() {
-		$result = $this->Flash->out('flash', array('class' => 'crazy'));
+		$result = $this->Flash->render('flash', array('class' => 'crazy'));
 		$expected = '<div id="flash-message" class="message-crazy">This is a calling</div>';
 		$this->assertEquals($expected, $result);
 	}
@@ -120,7 +120,7 @@ class FlashHelperTest extends TestCase {
  * @return void
  */
 	public function testFlashElementInAttrs() {
-		$result = $this->Flash->out('notification', array(
+		$result = $this->Flash->render('notification', array(
 			'element' => 'flash_helper',
 			'params' => array('title' => 'Notice!', 'name' => 'Alert!')
 		));
@@ -136,7 +136,7 @@ class FlashHelperTest extends TestCase {
 	public function testFlashWithPluginElement() {
 		Plugin::load('TestPlugin');
 
-		$result = $this->Flash->out('flash', array('element' => 'TestPlugin.plugin_element'));
+		$result = $this->Flash->render('flash', array('element' => 'TestPlugin.plugin_element'));
 		$expected = 'this is the plugin element using params[plugin]';
 		$this->assertEquals($expected, $result);
 	}