diff --git a/lib/Cake/Test/Case/View/Helper/FlashHelperTest.php b/lib/Cake/Test/Case/View/Helper/FlashHelperTest.php index b3d1d7440..21dd987f2 100644 --- a/lib/Cake/Test/Case/View/Helper/FlashHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FlashHelperTest.php @@ -76,6 +76,12 @@ class FlashHelperTest extends CakeTestCase { 'message' => 'Recorded', 'element' => 'flash_classy', 'params' => array() + ), + 'default' => array( + 'key' => 'default', + 'message' => 'Default', + 'element' => 'default', + 'params' => array() ) ) )); @@ -154,4 +160,13 @@ class FlashHelperTest extends CakeTestCase { $expected = 'this is the plugin element'; $this->assertContains($expected, $result); } + +/** + * Test that the default element fallbacks to the Flash/default element. + */ + public function testFlashFallback() { + $result = $this->Flash->render('default'); + $expected = '
Default
'; + $this->assertContains($expected, $result); + } } diff --git a/lib/Cake/View/Helper/FlashHelper.php b/lib/Cake/View/Helper/FlashHelper.php index ec26631fa..23582353c 100644 --- a/lib/Cake/View/Helper/FlashHelper.php +++ b/lib/Cake/View/Helper/FlashHelper.php @@ -86,6 +86,10 @@ class FlashHelper extends AppHelper { CakeSession::delete("Message.$key"); $flash['key'] = $key; + if ($flash['element'] === 'default') { + $flash['element'] = 'Flash/default'; + } + return $this->_View->element($flash['element'], $flash); } }