Html = new HtmlExtHelper(new View(null)); } public function testObject() { $this->assertTrue(is_object($this->Html)); $this->assertInstanceOf('HtmlExtHelper', $this->Html); } /** * MyHelperTest::testTime() * * @return void */ public function testTime() { $time = time(); $is = $this->Html->time($time); $time = CakeTime::i18nFormat($time, '%Y-%m-%d %T'); $expected = ''; $this->assertEquals($expected, $is); } /** * MyHelperTest::testImageFromBlob() * * @return void */ public function testImageFromBlob() { $folder = CakePlugin::path('Tools') . 'Test' . DS . 'test_files' . DS . 'img' . DS; $content = file_get_contents($folder . 'hotel.png'); $is = $this->Html->imageFromBlob($content); $this->assertTrue(!empty($is)); } /** * HtmlExtHelperTest::testDefaultUrl() * * @return void */ public function testDefaultUrl() { $result = $this->Html->defaultUrl(array('controller' => 'foo')); $this->debug($result); $expected = '/foo'; $this->assertEquals($expected, $result); } /** * HtmlExtHelperTest::testDefaultLink() * * @return void */ public function testDefaultLink() { $result = $this->Html->defaultLink('Title', array('controller' => 'foo')); $this->debug($result); $expected = 'Title'; $this->assertEquals($expected, $result); $result = $this->Html->defaultLink('Title', array('admin' => true, 'controller' => 'foo')); $this->debug($result); $expected = 'Title'; $this->assertEquals($expected, $result); } /** * HtmlExtHelperTest::testCompleteUrl() * * @return void */ public function testCompleteUrl() { $result = $this->Html->completeUrl(array('controller' => 'foo')); $expected = '/foo'; $this->assertEquals($expected, $result); $this->Html->request->query = array('x' => 'y'); $result = $this->Html->completeUrl(array('controller' => 'foo')); $expected = '/foo?x=y'; $this->assertEquals($expected, $result); } /** * HtmlExtHelperTest::testCompleteLink() * * @return void */ public function testCompleteLink() { $result = $this->Html->completeLink('Title', array('controller' => 'foo')); $expected = 'Title'; $this->assertEquals($expected, $result); $this->Html->request->query = array('x' => 'y'); $result = $this->Html->completeLink('Title', array('controller' => 'foo')); $expected = 'Title'; $this->assertEquals($expected, $result); } /** * HtmlExtHelperTest::testResetCrumbs() * * @return void */ public function testResetCrumbs() { $this->Html->addCrumb('foo', '/bar'); $result = $this->Html->getCrumbList(); $expected = ''; $this->assertEquals($expected, $result); $this->Html->resetCrumbs(); $result = $this->Html->getCrumbList(); $this->assertNull($result); } }