mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Implemented Enhancement: closes #4670
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6974 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
971c35708f
commit
0d9ca660b0
2 changed files with 17 additions and 1 deletions
|
@ -133,7 +133,12 @@ class SessionHelper extends CakeSession {
|
|||
$flash = parent::read('Message.' . $key);
|
||||
|
||||
if ($flash['layout'] == 'default') {
|
||||
$out = '<div id="' . $key . 'Message" class="message">' . $flash['message'] . '</div>';
|
||||
if (!empty($flash['params']['class'])) {
|
||||
$class = $flash['params']['class'];
|
||||
} else {
|
||||
$class = 'message';
|
||||
}
|
||||
$out = '<div id="' . $key . 'Message" class="' . $class . '">' . $flash['message'] . '</div>';
|
||||
} elseif ($flash['layout'] == '' || $flash['layout'] == null) {
|
||||
$out = $flash['message'];
|
||||
} else {
|
||||
|
|
|
@ -58,6 +58,11 @@ class SessionHelperTest extends CakeTestCase {
|
|||
'params' => array('title' => 'Notice!', 'name' => 'Alert!'),
|
||||
'message' => 'This is a test of the emergency broadcasting system',
|
||||
),
|
||||
'classy' => array(
|
||||
'layout' => 'default',
|
||||
'params' => array('class' => 'positive'),
|
||||
'message' => 'Recorded'
|
||||
),
|
||||
'bare' => array(
|
||||
'layout' => null,
|
||||
'message' => 'Bare message',
|
||||
|
@ -106,6 +111,12 @@ class SessionHelperTest extends CakeTestCase {
|
|||
$this->assertEqual($result, $expected);
|
||||
$this->assertFalse($this->Session->check('Message.flash'));
|
||||
|
||||
$expected = '<div id="classyMessage" class="positive">Recorded</div>';
|
||||
ob_start();
|
||||
$this->Session->flash('classy');
|
||||
$result = ob_get_clean();
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
Configure::write('viewPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS));
|
||||
$controller = new Controller();
|
||||
$this->Session->view = new View($controller);
|
||||
|
|
Loading…
Reference in a new issue