Common = new CommonHelper($View);
$this->Html = new CommonHelper($View);
}
/**
* @return void
*/
public function testMetaCanonical() {
$is = $this->Common->metaCanonical('/some/url/param1');
$this->assertEquals('', trim($is));
$is = $this->Common->metaCanonical('/some/url/param1', true);
$this->assertEquals('', trim($is));
}
/**
* @return void
*/
public function testMetaAlternate() {
$is = $this->Common->metaAlternate('/some/url/param1', 'de-de', true);
$this->out(h($is));
$this->assertEquals('', trim($is));
$is = $this->Common->metaAlternate(array('controller' => 'some', 'action' => 'url'), 'de', true);
$this->out(h($is));
$this->assertEquals('', trim($is));
$is = $this->Common->metaAlternate(array('controller' => 'some', 'action' => 'url'), array('de', 'de-ch'), true);
$this->out(h($is));
$this->assertEquals('' . PHP_EOL . '', trim($is));
$is = $this->Common->metaAlternate(array('controller' => 'some', 'action' => 'url'), array('de' => array('ch', 'at'), 'en' => array('gb', 'us')), true);
$this->out(h($is));
$this->assertEquals('' . PHP_EOL .
'' . PHP_EOL .
'' . PHP_EOL .
'', trim($is));
}
/**
* @return void
*/
public function testEsc() {
$is = $this->Common->esc('Some Cool Text with Html');
$this->assertEquals($is, 'Some Cool Text with <b>Html</b>');
$is = $this->Common->esc('Some Cool Text' . PHP_EOL . 'with Html');
$this->assertEquals($is, 'Some Cool Text
' . PHP_EOL . 'with <b>Html</b>');
$is = $this->Common->esc('Some Cool' . PHP_EOL . ' 2 indends and' . PHP_EOL . ' 5 indends' . PHP_EOL . 'YEAH');
$this->assertEquals($is, 'Some Cool
' . PHP_EOL . ' 2 indends and
' . PHP_EOL . ' 5 indends
' . PHP_EOL . 'YEAH');
$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
' . PHP_EOL . ' 1 tab and
' . PHP_EOL . ' 2 tabs
' . PHP_EOL . 'YEAH');
}
/**
* CommonHelperTest::testAsp()
*
* @return void
*/
public function testAsp() {
$res = $this->Common->asp('House', 2, true);
$expected = __('Houses');
$this->assertEquals($expected, $res);
$res = $this->Common->asp('House', 1, true);
$expected = __('House');
$this->assertEquals($expected, $res);
}
/**
* CommonHelperTest::testSp()
*
* @return void
*/
public function testSp() {
$res = $this->Common->sp('House', 'Houses', 0, true);
$expected = __('Houses');
$this->assertEquals($expected, $res);
$res = $this->Common->sp('House', 'Houses', 2, true);
$this->assertEquals($expected, $res);
$res = $this->Common->sp('House', 'Houses', 1, true);
$expected = __('House');
$this->assertEquals($expected, $res);
$res = $this->Common->sp('House', 'Houses', 1);
$expected = 'House';
$this->assertEquals($expected, $res);
}
/**
* TearDown method
*
* @return void
*/
public function tearDown() {
parent::tearDown();
unset($this->Common);
}
}