/**
  * 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 javascriptInclude with array parameter for a remote link
  *
  * @author Nikolaos Dimopoulos <*****@*****.**>
  * @since  2014-09-29
  */
 public function testJavascriptIncludeWithArrayRemote()
 {
     $this->specify("iavascriptInclude with array second parameter remote link returns invalid HTML", function () {
         Tag::resetInput();
         $options = ['http://my.local.com/js/phalcon.js'];
         $expected = '<script type="text/javascript" src="http://my.local.com/js/phalcon.js"></script>' . PHP_EOL;
         $actual = Tag::javascriptInclude($options, false);
         expect($actual)->equals($expected);
     });
 }
 /**
  * Tests friendlyTitle with string as a parameter with replace as boolean
  *
  * @author Nikolaos Dimopoulos <*****@*****.**>
  * @since  2014-09-11
  */
 public function testFriendlyTitleStringParameterReplaceBoolean()
 {
     $this->specify("friendlyTitle with string parameter with replace array returns incorrect text", function () {
         Tag::resetInput();
         $options = 'This is a Test';
         $expected = 't_s_s_a_test';
         $actual = Tag::friendlyTitle($options, '_', true, true);
         expect($actual)->equals($expected);
     }, ['throws' => ['Phalcon\\Tag\\Exception']]);
 }
 /**
  * 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);
     });
 }
Exemple #5
0
 /**
  * Tests titleSeparator prepend
  *
  * @author Nikolaos Dimopoulos <*****@*****.**>
  * @since  2012-09-05
  */
 public function testSetTitleSeparatorPrepend()
 {
     $this->specify("titleSeparator prepend returns incorrect result", function () {
         Tag::resetInput();
         Tag::setTitle('This is my title');
         Tag::setTitleSeparator('-');
         Tag::prependTitle('PhalconPHP');
         expect(Tag::getTitle())->equals("<title>PhalconPHP-This is my title</title>" . PHP_EOL);
     });
 }
Exemple #6
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 () {
         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);
     });
 }
 /**
  * Tests selectStatic with displayTo and element not present
  *
  * @author Nikolaos Dimopoulos <*****@*****.**>
  * @since  2014-09-05
  */
 public function testSelectStaticOptGroupWithDisplayToElementNotPresent()
 {
     $this->specify("selectStatic with displayTo and element not present returns invalid HTML", function () {
         Tag::resetInput();
         $params = ['x_name', 'name' => 'x_other', 'class' => 'x_class', 'size' => '10'];
         $options = ["Active" => ['A1' => 'A One', 'A2' => 'A Two'], "B" => "B One"];
         $expected = '<select id="x_name" name="x_other" class="x_class" size="10">' . PHP_EOL . chr(9) . '<optgroup label="Active">' . PHP_EOL . chr(9) . '<option value="A1">A One</option>' . PHP_EOL . chr(9) . '<option value="A2">A Two</option>' . PHP_EOL . chr(9) . '</optgroup>' . PHP_EOL . chr(9) . '<option value="B">B One</option>' . PHP_EOL . '</select>';
         Tag::displayTo('x_name', 'I');
         $actual = Tag::selectStatic($params, $options);
         Tag::resetInput();
         expect($actual)->equals($expected);
     });
 }
Exemple #8
0
 /**
  * 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);
 }
Exemple #9
0
 /**
  * Tests linkTo with complex remote URL
  *
  * @issue  1679
  *
  * @author Nikolaos Dimopoulos <*****@*****.**>
  * @author Dreamszhu <*****@*****.**>
  * @since  2014-09-29
  */
 public function testLinkToWithComplexRemoteUrl()
 {
     $this->specify("linkTo with complex remote URL string parameter returns invalid HTML", function () {
         Tag::resetInput();
         $url = "http://phalconphp.com/en/";
         $name = 'x_name';
         $actual = Tag::linkTo($url, $name, false);
         $expected = '<a href="http://phalconphp.com/en/">x_name</a>';
         expect($actual)->equals($expected);
     });
     $this->specify("linkTo with complex remote URL array parameter returns invalid HTML", function () {
         Tag::resetInput();
         $options = ["http://phalconphp.com/en/", 'x_name', false];
         $actual = Tag::linkTo($options);
         $expected = '<a href="http://phalconphp.com/en/">x_name</a>';
         expect($actual)->equals($expected);
     });
     $this->specify("linkTo with complex remote URL array named parameter returns invalid HTML", function () {
         Tag::resetInput();
         $options = ["http://phalconphp.com/en/", 'text' => 'x_name', 'local' => false];
         $actual = Tag::linkTo($options);
         $expected = '<a href="http://phalconphp.com/en/">x_name</a>';
         expect($actual)->equals($expected);
     });
     $this->specify("linkTo with mailto URL string parameter returns invalid HTML", function () {
         Tag::resetInput();
         $url = "mailto:someone@phalconphp.com";
         $name = '*****@*****.**';
         $actual = Tag::linkTo($url, $name, false);
         $expected = '<a href="mailto:someone@phalconphp.com">someone@phalconphp.com</a>';
         expect($actual)->equals($expected);
     });
 }