Common = new CommonHelper($View);
$this->Html = new CommonHelper($View);
}
/**
* CommonHelperTest::testFlash()
*
* @return void
*/
public function testFlash() {
$this->Common->addFlashMessage(h('Foo & bar'), 'success');
$result = $this->Common->flash();
$expected = '
Foo & bar
';
$this->assertEquals($expected, $result);
$this->Common->addFlashMessage('I am an error', 'error');
$this->Common->addFlashMessage('I am a warning', 'warning');
$this->Common->addFlashMessage('I am some info', 'info');
$this->Common->addFlashMessage('I am also some info');
$this->Common->addFlashMessage('I am sth custom', 'custom');
$result = $this->Common->flash();
$this->assertTextContains('message error', $result);
$this->assertTextContains('message warning', $result);
$this->assertTextContains('message info', $result);
$this->assertTextContains('message custom', $result);
$result = substr_count($result, 'message info');
$this->assertSame(2, $result);
}
/**
* Test that you can define your own order or just output a subpart of
* the types.
*
* @return void
*/
public function testFlashWithTypes() {
$this->Common->addFlashMessage('I am an error', 'error');
$this->Common->addFlashMessage('I am a warning', 'warning');
$this->Common->addFlashMessage('I am some info', 'info');
$this->Common->addFlashMessage('I am also some info');
$this->Common->addFlashMessage('I am sth custom', 'custom');
$result = $this->Common->flash(array('warning', 'error'));
$expected = '