mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
parent
7e187a4e41
commit
94d9bcd674
2 changed files with 19 additions and 0 deletions
|
@ -76,6 +76,12 @@ class FlashHelperTest extends CakeTestCase {
|
||||||
'message' => 'Recorded',
|
'message' => 'Recorded',
|
||||||
'element' => 'flash_classy',
|
'element' => 'flash_classy',
|
||||||
'params' => array()
|
'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';
|
$expected = 'this is the plugin element';
|
||||||
$this->assertContains($expected, $result);
|
$this->assertContains($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that the default element fallbacks to the Flash/default element.
|
||||||
|
*/
|
||||||
|
public function testFlashFallback() {
|
||||||
|
$result = $this->Flash->render('default');
|
||||||
|
$expected = '<div class="message">Default</div>';
|
||||||
|
$this->assertContains($expected, $result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,10 @@ class FlashHelper extends AppHelper {
|
||||||
CakeSession::delete("Message.$key");
|
CakeSession::delete("Message.$key");
|
||||||
$flash['key'] = $key;
|
$flash['key'] = $key;
|
||||||
|
|
||||||
|
if ($flash['element'] === 'default') {
|
||||||
|
$flash['element'] = 'Flash/default';
|
||||||
|
}
|
||||||
|
|
||||||
return $this->_View->element($flash['element'], $flash);
|
return $this->_View->element($flash['element'], $flash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue