diff --git a/lib/Cake/Test/Case/Controller/Component/FlashComponentTest.php b/lib/Cake/Test/Case/Controller/Component/FlashComponentTest.php index dac0ec090..f427be195 100644 --- a/lib/Cake/Test/Case/Controller/Component/FlashComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/FlashComponentTest.php @@ -68,6 +68,27 @@ class FlashComponentTest extends CakeTestCase { ); $result = CakeSession::read('Message.flash'); $this->assertEquals($expected, $result); + CakeSession::delete('Message.flash'); + + $this->Flash->set('This is the first message'); + $this->Flash->set('This is the second message'); + $expected = array( + array( + 'message' => 'This is the first message', + 'key' => 'flash', + 'element' => 'Flash/default', + 'params' => array() + ), + array( + 'message' => 'This is the second message', + 'key' => 'flash', + 'element' => 'Flash/default', + 'params' => array() + ) + ); + $result = CakeSession::read('Message.flash'); + $this->assertEquals($expected, $result); + CakeSession::delete('Message.flash'); $this->Flash->set('This is a test message', array( 'element' => 'test', @@ -83,6 +104,7 @@ class FlashComponentTest extends CakeTestCase { ); $result = CakeSession::read('Message.flash'); $this->assertEquals($expected, $result); + CakeSession::delete('Message.flash'); $this->Flash->set('This is a test message', array('element' => 'MyPlugin.alert')); $expected = array( @@ -95,6 +117,7 @@ class FlashComponentTest extends CakeTestCase { ); $result = CakeSession::read('Message.flash'); $this->assertEquals($expected, $result); + CakeSession::delete('Message.flash'); $this->Flash->set('This is a test message', array('key' => 'foobar')); $expected = array( @@ -107,6 +130,7 @@ class FlashComponentTest extends CakeTestCase { ); $result = CakeSession::read('Message.foobar'); $this->assertEquals($expected, $result); + CakeSession::delete('Message.foobar'); } /** @@ -128,6 +152,7 @@ class FlashComponentTest extends CakeTestCase { ); $result = CakeSession::read('Message.flash'); $this->assertEquals($expected, $result); + CakeSession::delete('Message.flash'); } /** @@ -150,6 +175,7 @@ class FlashComponentTest extends CakeTestCase { ); $result = CakeSession::read('Message.flash'); $this->assertEquals($expected, $result); + CakeSession::delete('Message.flash'); } /** @@ -162,32 +188,41 @@ class FlashComponentTest extends CakeTestCase { $this->Flash->success('It worked'); $expected = array( - 'message' => 'It worked', - 'key' => 'flash', - 'element' => 'Flash/success', - 'params' => array() + array( + 'message' => 'It worked', + 'key' => 'flash', + 'element' => 'Flash/success', + 'params' => array() + ) ); $result = CakeSession::read('Message.flash'); $this->assertEquals($expected, $result); + CakeSession::delete('Message.flash'); $this->Flash->alert('It worked', array('plugin' => 'MyPlugin')); $expected = array( - 'message' => 'It worked', - 'key' => 'flash', - 'element' => 'MyPlugin.Flash/alert', - 'params' => array() + array( + 'message' => 'It worked', + 'key' => 'flash', + 'element' => 'MyPlugin.Flash/alert', + 'params' => array() + ) ); $result = CakeSession::read('Message.flash'); $this->assertEquals($expected, $result); + CakeSession::delete('Message.flash'); $this->Flash->error('It did not work', array('element' => 'error_thing')); $expected = array( - 'message' => 'It did not work', - 'key' => 'flash', - 'element' => 'Flash/error', - 'params' => array() + array( + 'message' => 'It did not work', + 'key' => 'flash', + 'element' => 'Flash/error', + 'params' => array() + ) ); $result = CakeSession::read('Message.flash'); $this->assertEquals($expected, $result, 'Element is ignored in magic call.'); + CakeSession::delete('Message.flash'); } } diff --git a/lib/Cake/Test/Case/View/Helper/FlashHelperTest.php b/lib/Cake/Test/Case/View/Helper/FlashHelperTest.php index b3d1d7440..e78cda0c6 100644 --- a/lib/Cake/Test/Case/View/Helper/FlashHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FlashHelperTest.php @@ -57,25 +57,37 @@ class FlashHelperTest extends CakeTestCase { CakeSession::write(array( 'Message' => array( 'flash' => array( - 'key' => 'flash', - 'message' => 'This is a calling', - 'element' => 'Flash/default', - 'params' => array() + array( + 'key' => 'flash', + 'message' => 'This is the first Message', + 'element' => 'Flash/default', + 'params' => array() + ), + array( + 'key' => 'flash', + 'message' => 'This is the second Message', + 'element' => 'Flash/default', + 'params' => array() + ) ), 'notification' => array( - 'key' => 'notification', - 'message' => 'Broadcast message testing', - 'element' => 'flash_helper', - 'params' => array( - 'title' => 'Notice!', - 'name' => 'Alert!' + array( + 'key' => 'notification', + 'message' => 'Broadcast message testing', + 'element' => 'flash_helper', + 'params' => array( + 'title' => 'Notice!', + 'name' => 'Alert!' + ) ) ), 'classy' => array( - 'key' => 'classy', - 'message' => 'Recorded', - 'element' => 'flash_classy', - 'params' => array() + array( + 'key' => 'classy', + 'message' => 'Recorded', + 'element' => 'flash_classy', + 'params' => array() + ) ) ) )); @@ -99,7 +111,7 @@ class FlashHelperTest extends CakeTestCase { */ public function testFlash() { $result = $this->Flash->render(); - $expected = '
This is a calling
'; + $expected = '
This is the first Message
This is the second Message
'; $this->assertContains($expected, $result); $expected = '
Recorded
';