Skip to content
Permalink
Browse files

Added strict comparison & created new testcase for duplicate Flash me…

…ssages
  • Loading branch information...
visualex committed Dec 6, 2016
1 parent 08e17ed commit a6342a15f511f2abe0c5d3aaa8f1670d6c1727ef
@@ -114,7 +114,7 @@ public function set($message, array $options = [])
if ($options['duplicate'] === false) {
foreach ($messages as $existingMessage) {
if ($existingMessage['message'] == $message) {
if ($existingMessage['message'] === $message) {
return;
}
}
@@ -109,12 +109,17 @@ public function testSet()
$result = $this->Session->read('Flash.foobar');
$this->assertEquals($expected, $result);
}
public function testDuplicateIgnored()
{
$this->assertNull($this->Session->read('Flash.flash'));
$this->Flash->config('duplicate', false);
$this->Flash->set('This test message should appear once only');
$this->Flash->set('This test message should appear once only');
$result = array_slice($this->Session->read('Flash.flash'), -2);
$this->assertNotEquals($result[0], $result[1]);
$result = $this->Session->read('Flash.flash');
$this->assertCount(1, $result);
}
/**

0 comments on commit a6342a1

Please sign in to comment.
You can’t perform that action at this time.