Merge branch 'flash-plugin' into 2.7

Fixes the plugin option not working with `__call` on FlashComponent as
documented.

Fixes #7570
This commit is contained in:
mark_story 2015-10-17 20:59:47 -04:00
commit d220616b5a
2 changed files with 14 additions and 6 deletions

View file

@ -76,13 +76,11 @@ class FlashComponent extends Component {
$message = $message->getMessage();
}
list($plugin, $element) = pluginSplit($options['element']);
if ($plugin) {
$options['element'] = $plugin . '.Flash/' . $element;
} else {
$options['element'] = 'Flash/' . $element;
list($plugin, $element) = pluginSplit($options['element'], true);
if (!empty($options['plugin'])) {
$plugin = $options['plugin'] . '.';
}
$options['element'] = $plugin . 'Flash/' . $element;
CakeSession::write('Message.' . $options['key'], array(
'message' => $message,

View file

@ -158,6 +158,16 @@ class FlashComponentTest extends CakeTestCase {
$result = CakeSession::read('Message.flash');
$this->assertEquals($expected, $result);
$this->Flash->alert('It worked', array('plugin' => 'MyPlugin'));
$expected = array(
'message' => 'It worked',
'key' => 'flash',
'element' => 'MyPlugin.Flash/alert',
'params' => array()
);
$result = CakeSession::read('Message.flash');
$this->assertEquals($expected, $result);
$this->Flash->error('It did not work', array('element' => 'error_thing'));
$expected = array(
'message' => 'It did not work',