Beispiel #1
0
 /**
  * Runs the test for a Tag:: element with parameters
  *
  * @param string    $function
  * @param mixed     $options
  * @param string    $expected
  * @param boolean   $xhtml
  * @param string    $set
  */
 public function fieldParameter($function, $options, $expected, $xhtml, $set = '')
 {
     PhTTag::resetInput();
     if ($xhtml) {
         PhTTag::setDocType(PhTTag::XHTML10_STRICT);
     } else {
         PhTTag::setDocType(PhTTag::HTML5);
     }
     $expected .= $xhtml ? ' />' : '>';
     if ($set) {
         PhTTag::displayTo('x_name', 'x_value');
     }
     $actual = PhTTag::$function($options);
     if ($set) {
         PhTTag::$set('x_name', '');
     }
     expect($actual)->equals($expected);
 }
Beispiel #2
0
 /**
  * Tests tagHtmlClose with EOL
  *
  * @author Nikolaos Dimopoulos <*****@*****.**>
  * @since  2014-09-05
  */
 public function testTagHtmlCloseEol()
 {
     $this->specify("tagHtmlClose with EOL returns invalid HTML Strict", function () {
         PhTTag::resetInput();
         $name = 'canvas';
         $expected = '</canvas>' . PHP_EOL;
         PhTTag::setDocType(PhTTag::XHTML10_STRICT);
         $actual = PhTTag::tagHtmlClose($name, true);
         expect($actual)->equals($expected);
     });
     $this->specify("tagHtmlClose with EOL returns invalid HTML XHTML", function () {
         PhTTag::resetInput();
         $name = 'canvas';
         $expected = '</canvas>' . PHP_EOL;
         PhTTag::setDocType(PhTTag::HTML5);
         $actual = PhTTag::tagHtmlClose($name, true);
         expect($actual)->equals($expected);
     });
 }
Beispiel #3
0
 /**
  * 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" />';
         PhTTag::setDocType(PhTTag::XHTML10_STRICT);
         $actual = PhTTag::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">';
         PhTTag::setDocType(PhTTag::HTML5);
         $actual = PhTTag::image($options, false);
         expect($actual)->equals($expected);
     });
 }
Beispiel #4
0
 /**
  * Runs a doctype test, one for each doctype
  *
  * @param integer $doctype
  */
 protected function runDoctypeTest($doctype)
 {
     PhTTag::resetInput();
     PhTTag::setDocType($doctype);
     $expected = $this->docTypeToString($doctype);
     $actual = PhTTag::getDocType();
     PhTTag::setDocType(PhTTag::HTML5);
     expect($actual)->equals($expected);
 }
 /**
  * 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 () {
         PhTTag::resetInput();
         $options = ['css/phalcon.css', 'rel' => 'stylesheet/less'];
         $expected = '<link rel="stylesheet/less" type="text/css" ' . 'href="/css/phalcon.css" />' . PHP_EOL;
         PhTTag::setDocType(PhTTag::XHTML10_STRICT);
         $actual = PhTTag::stylesheetLink($options);
         expect($actual)->equals($expected);
     });
     $this->specify("stylesheetLink overriding rel local returns invalid HTML Strict", function () {
         PhTTag::resetInput();
         $options = ['css/phalcon.css', 'rel' => 'stylesheet/less'];
         $expected = '<link rel="stylesheet/less" type="text/css" ' . 'href="/css/phalcon.css">' . PHP_EOL;
         PhTTag::setDocType(PhTTag::HTML5);
         $actual = PhTTag::stylesheetLink($options);
         expect($actual)->equals($expected);
     });
 }