/** * Tests stylesheetLink overriding the rel link local * * @issue 2142 * @author Nikolaos Dimopoulos <*****@*****.**> * @author Dreamszhu <*****@*****.**> * @since 2014-09-12 */ public function testStylesheetLinkOverrideRelLink() { $this->specify("stylesheetLink overriding rel local returns invalid HTML Strict", function () { Tag::resetInput(); $options = ['css/phalcon.css', 'rel' => 'stylesheet/less']; $expected = '<link rel="stylesheet/less" type="text/css" ' . 'href="/css/phalcon.css" />' . PHP_EOL; Tag::setDocType(Tag::XHTML10_STRICT); $actual = Tag::stylesheetLink($options); expect($actual)->equals($expected); }); $this->specify("stylesheetLink overriding rel local returns invalid HTML Strict", function () { Tag::resetInput(); $options = ['css/phalcon.css', 'rel' => 'stylesheet/less']; $expected = '<link rel="stylesheet/less" type="text/css" ' . 'href="/css/phalcon.css">' . PHP_EOL; Tag::setDocType(Tag::HTML5); $actual = Tag::stylesheetLink($options); expect($actual)->equals($expected); }); }
/** * Tests resetInput with displayTo * * @author Nikolaos Dimopoulos <*****@*****.**> * @since 2014-09-05 */ public function testResetInputWithDisplayTo() { $this->specify("resetInput with displayTo returns invalid HTML Strict", function () { Tag::setDocType(Tag::XHTML10_STRICT); $options = 'x_name'; $expected = '<input type="text" id="x_name" name="x_name" ' . 'value="x_other" />'; Tag::displayTo('x_name', 'x_other'); $actual = Tag::textField($options); Tag::resetInput(); expect($actual)->equals($expected); $expected = '<input type="text" id="x_name" name="x_name" />'; $actual = Tag::textField($options); expect($actual)->equals($expected); }); $this->specify("resetInput with displayTo returns invalid HTML XHTML", function () { Tag::setDocType(Tag::HTML5); $options = 'x_name'; $expected = '<input type="text" id="x_name" name="x_name" ' . 'value="x_other">'; Tag::displayTo('x_name', 'x_other'); $actual = Tag::textField($options); Tag::resetInput(); expect($actual)->equals($expected); $expected = '<input type="text" id="x_name" name="x_name">'; $actual = Tag::textField($options); expect($actual)->equals($expected); }); }
/** * Tests image with array parameter and remote link * * @author Nikolaos Dimopoulos <*****@*****.**> * @since 2014-09-05 */ public function testImageArrayParameterRemoteLink() { $this->specify("image with array parameter and remote link returns invalid HTML Strict", function () { $options = ['http://phalconphp.com/img/hello.gif', 'alt' => 'Hello']; $expected = '<img src="http://phalconphp.com/img/hello.gif" ' . 'alt="Hello" />'; Tag::setDocType(Tag::XHTML10_STRICT); $actual = Tag::image($options, false); expect($actual)->equals($expected); }); $this->specify("image with array parameter and local link returns invalid HTML XHTML", function () { $options = ['http://phalconphp.com/img/hello.gif', 'alt' => 'Hello']; $expected = '<img src="http://phalconphp.com/img/hello.gif" ' . 'alt="Hello">'; Tag::setDocType(Tag::HTML5); $actual = Tag::image($options, false); expect($actual)->equals($expected); }); }
/** * Tests tagHtmlClose with EOL * * @author Nikolaos Dimopoulos <*****@*****.**> * @since 2014-09-05 */ public function testTagHtmlCloseEol() { $this->specify("tagHtmlClose with EOL returns invalid HTML Strict", function () { Tag::resetInput(); $name = 'canvas'; $expected = '</canvas>' . PHP_EOL; Tag::setDocType(Tag::XHTML10_STRICT); $actual = Tag::tagHtmlClose($name, true); expect($actual)->equals($expected); }); $this->specify("tagHtmlClose with EOL returns invalid HTML XHTML", function () { Tag::resetInput(); $name = 'canvas'; $expected = '</canvas>' . PHP_EOL; Tag::setDocType(Tag::HTML5); $actual = Tag::tagHtmlClose($name, true); expect($actual)->equals($expected); }); }
/** * Runs a doctype test, one for each doctype * * @param integer $doctype */ protected function runDoctypeTest($doctype) { Tag::resetInput(); Tag::setDocType($doctype); $expected = $this->docTypeToString($doctype); $actual = Tag::getDocType(); Tag::setDocType(Tag::HTML5); expect($actual)->equals($expected); }