view = new Zend_View(); $this->helper = new Zend_View_Helper_HtmlObject(); $this->helper->setView($this->view); } public function tearDown() { unset($this->helper); } public function testViewObjectIsSet() { $this->assertType('Zend_View_Interface', $this->helper->view); } public function testMakeHtmlObjectWithoutAttribsWithoutParams() { $htmlObject = $this->helper->htmlObject('datastring', 'typestring'); $this->assertContains('', $htmlObject); $this->assertContains('', $htmlObject); } public function testMakeHtmlObjectWithAttribsWithoutParams() { $attribs = array('attribkey1' => 'attribvalue1', 'attribkey2' => 'attribvalue2'); $htmlObject = $this->helper->htmlObject('datastring', 'typestring', $attribs); $this->assertContains('', $htmlObject); $this->assertContains('', $htmlObject); } public function testMakeHtmlObjectWithoutAttribsWithParamsHtml() { $this->view->doctype(Zend_View_Helper_Doctype::HTML4_STRICT); $params = array('paramname1' => 'paramvalue1', 'paramname2' => 'paramvalue2'); $htmlObject = $this->helper->htmlObject('datastring', 'typestring', array(), $params); $this->assertContains('', $htmlObject); $this->assertContains('', $htmlObject); foreach ($params as $key => $value) { $param = ''; $this->assertContains($param, $htmlObject); } } public function testMakeHtmlObjectWithoutAttribsWithParamsXhtml() { $this->view->doctype(Zend_View_Helper_Doctype::XHTML1_STRICT); $params = array('paramname1' => 'paramvalue1', 'paramname2' => 'paramvalue2'); $htmlObject = $this->helper->htmlObject('datastring', 'typestring', array(), $params); $this->assertContains('', $htmlObject); $this->assertContains('', $htmlObject); foreach ($params as $key => $value) { $param = ''; $this->assertContains($param, $htmlObject); } } public function testMakeHtmlObjectWithContent() { $htmlObject = $this->helper->htmlObject('datastring', 'typestring', array(), array(), 'testcontent'); $this->assertContains('', $htmlObject); $this->assertContains('testcontent', $htmlObject); $this->assertContains('', $htmlObject); } } // Call Zend_View_Helper_HtmlObjectTest::main() if this source file is executed directly. if (PHPUnit_MAIN_METHOD == "Zend_View_Helper_HtmlObjectTest::main") { Zend_View_Helper_HtmlObjectTest::main(); }