Common = new CommonHelper($View);
$this->Html = new CommonHelper($View);
}
/**
* CommonHelperTest::testAlternate()
*
* @return void
*/
public function testAlternate() {
$result = $this->Common->alternate('one', 'two');
$this->assertEquals('one', $result);
$result = $this->Common->alternate('one', 'two');
$this->assertEquals('two', $result);
$result = $this->Common->alternate('one', 'two');
$this->assertEquals('one', $result);
}
/**
* CommonHelperTest::testMetaRobots()
*
* @return void
*/
public function testMetaRobots() {
$result = $this->Common->metaRobots();
$this->assertContains('';
$this->assertEquals($expected, $result);
}
/**
* CommonHelperTest::testMetaDescription()
*
* @return void
*/
public function testMetaDescription() {
$result = $this->Common->metaDescription('foo', 'deu');
$expected = '';
$this->assertEquals($expected, $result);
}
/**
* CommonHelperTest::testMetaKeywords()
*
* @return void
*/
public function testMetaKeywords() {
$result = $this->Common->metaKeywords('foo bar', 'deu');
$expected = '';
$this->assertEquals($expected, $result);
}
/**
* CommonHelperTest::testMetaRss()
*
* @return void
*/
public function testMetaRss() {
$result = $this->Common->metaRss('/some/url', 'some title');
$expected = '';
$this->assertEquals($expected, $result);
}
/**
* CommonHelperTest::testMetaEquiv()
*
* @return void
*/
public function testMetaEquiv() {
$result = $this->Common->metaEquiv('type', 'value');
$expected = '';
$this->assertEquals($expected, $result);
}
/**
* CommonHelperTest::testDisplayErrors()
*
* @return void
*/
public function testDisplayErrors() {
$result = $this->Common->displayErrors();
$this->assertEquals('', $result);
}
/**
* @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(['controller' => 'some', 'action' => 'url'], 'de', true);
$this->out(h($is));
$this->assertEquals('', trim($is));
$is = $this->Common->metaAlternate(['controller' => 'some', 'action' => 'url'], ['de', 'de-ch'], true);
$this->out(h($is));
$this->assertEquals('' . PHP_EOL . '', trim($is));
$is = $this->Common->metaAlternate(['controller' => 'some', 'action' => 'url'], ['de' => ['ch', 'at'], 'en' => ['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('Some Cool Text with <b>Html</b>', $is);
$is = $this->Common->esc('Some Cool Text' . PHP_EOL . 'with Html');
$this->assertEquals('Some Cool Text
' . 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');
$expected = 'Some Cool
' . PHP_EOL . ' 2 indends and
' . PHP_EOL . ' 5 indends
' . PHP_EOL . 'YEAH';
$this->assertEquals($expected, $is);
$options = ['tabsToSpaces' => 2];
$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
' . PHP_EOL . ' 1 tab and
' . PHP_EOL . ' 2 tabs
' . PHP_EOL . 'YEAH';
$this->assertEquals($expected, $is);
}
/**
* CommonHelperTest::testAsp()
*
* @return void
*/
public function testAsp() {
$res = $this->Common->asp('House', 2, true);
$expected = __d('tools', 'Houses');
$this->assertEquals($expected, $res);
$res = $this->Common->asp('House', 1, true);
$expected = __d('tools', 'House');
$this->assertEquals($expected, $res);
}
/**
* CommonHelperTest::testSp()
*
* @return void
*/
public function testSp() {
$res = $this->Common->sp('House', 'Houses', 0, true);
$expected = __d('tools', '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 = __d('tools', '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);
}
}