|
|
@@ -24,17 +24,6 @@ class CommonHelperTest extends MyCakeTestCase {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * CommonHelperTest::testFlashMessage()
|
|
|
- *
|
|
|
- * @return void
|
|
|
- */
|
|
|
- public function testFlashMessage() {
|
|
|
- $result = $this->Flash->message(h('Foo & bar'), 'success');
|
|
|
- $expected = '<div class="flash-messages flashMessages"><div class="message success">Foo &amp; bar</div></div>';
|
|
|
- $this->assertEquals($expected, $result);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
* CommonHelperTest::testAlternate()
|
|
|
*
|
|
|
* @return void
|
|
|
@@ -124,60 +113,6 @@ class CommonHelperTest extends MyCakeTestCase {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * CommonHelperTest::testFlash()
|
|
|
- *
|
|
|
- * @return void
|
|
|
- */
|
|
|
- public function testFlash() {
|
|
|
- $this->Common->addFlashMessage(h('Foo & bar'), 'success');
|
|
|
-
|
|
|
- $result = $this->Common->flash();
|
|
|
- $expected = '<div class="flash-messages flashMessages"><div class="message success">Foo & bar</div></div>';
|
|
|
- $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 = '<div class="flash-messages flashMessages"><div class="message warning">I am a warning</div><div class="message error">I am an error</div></div>';
|
|
|
- $this->assertEquals($expected, $result);
|
|
|
-
|
|
|
- $result = $this->Common->flash(array('info'));
|
|
|
- $expected = '<div class="flash-messages flashMessages"><div class="message info">I am some info</div><div class="message info">I am also some info</div></div>';
|
|
|
- $this->assertEquals($expected, $result);
|
|
|
-
|
|
|
- $result = $this->Common->flash();
|
|
|
- $expected = '<div class="flash-messages flashMessages"><div class="message custom">I am sth custom</div></div>';
|
|
|
- $this->assertEquals($expected, $result);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
* @return void
|
|
|
*/
|
|
|
public function testMetaCanonical() {
|
|
|
@@ -217,17 +152,19 @@ class CommonHelperTest extends MyCakeTestCase {
|
|
|
*/
|
|
|
public function testEsc() {
|
|
|
$is = $this->Common->esc('Some Cool Text with <b>Html</b>');
|
|
|
- $this->assertEquals($is, 'Some Cool Text with <b>Html</b>');
|
|
|
+ $this->assertEquals('Some Cool Text with <b>Html</b>', $is);
|
|
|
|
|
|
$is = $this->Common->esc('Some Cool Text' . PHP_EOL . 'with <b>Html</b>');
|
|
|
- $this->assertEquals($is, 'Some Cool Text<br />' . PHP_EOL . 'with <b>Html</b>');
|
|
|
+ $this->assertEquals('Some Cool Text<br />' . PHP_EOL . 'with <b>Html</b>', $is);
|
|
|
|
|
|
$is = $this->Common->esc('Some Cool' . PHP_EOL . ' 2 indends and' . PHP_EOL . ' 5 indends' . PHP_EOL . 'YEAH');
|
|
|
- $this->assertEquals($is, 'Some Cool<br />' . PHP_EOL . ' 2 indends and<br />' . PHP_EOL . ' 5 indends<br />' . PHP_EOL . 'YEAH');
|
|
|
+ $expected = 'Some Cool<br />' . PHP_EOL . ' 2 indends and<br />' . PHP_EOL . ' 5 indends<br />' . PHP_EOL . 'YEAH';
|
|
|
+ $this->assertEquals($expected, $is);
|
|
|
|
|
|
$options = array('tabsToSpaces' => 2);
|
|
|
- $is = $this->Common->esc('Some Cool' . PHP_EOL . TB . '1 tab and' . PHP_EOL . TB . TB . '2 tabs' . PHP_EOL . 'YEAH', $options);
|
|
|
- $this->assertEquals($is, 'Some Cool<br />' . PHP_EOL . ' 1 tab and<br />' . PHP_EOL . ' 2 tabs<br />' . PHP_EOL . 'YEAH');
|
|
|
+ $is = $this->Common->esc('Some Cool' . PHP_EOL . "\t" . '1 tab and' . PHP_EOL . "\t" . "\t" . '2 tabs' . PHP_EOL . 'YEAH', $options);
|
|
|
+ $expected = 'Some Cool<br />' . PHP_EOL . ' 1 tab and<br />' . PHP_EOL . ' 2 tabs<br />' . PHP_EOL . 'YEAH';
|
|
|
+ $this->assertEquals($expected, $is);
|
|
|
}
|
|
|
|
|
|
/**
|