Beispiel #1
0
 public function testInvalidHTMLTagNames()
 {
     $value = new SS_HTMLValue();
     $invalid = array('<p><div><a href="test-link"></p></div>', '<html><div><a href="test-link"></a></a></html_>', '""\'\'\'"""\'""<<<>/</<htmlbody><a href="test-link"<<>');
     foreach ($invalid as $input) {
         $value->setContent($input);
         $this->assertEquals('test-link', $value->getElementsByTagName('a')->item(0)->getAttribute('href'), 'Link data can be extraced from malformed HTML');
     }
 }
 public function testMixedNewlines()
 {
     $value = new SS_HTMLValue();
     $eol = "\n";
     $platformEOL = PHP_EOL;
     // native EOL for platform. Windows is \r\n (CR-LF). UNIX is LF
     $value->setContent("<p>paragraph</p>{$platformEOL}<ul><li>1</li>\r\n</ul>");
     $this->assertEquals("<p>paragraph</p>{$eol}<ul><li>1</li>{$eol}</ul>", $value->getContent(), 'Newlines get converted');
 }
Beispiel #3
0
 public function testMixedNewlines()
 {
     $value = new SS_HTMLValue();
     $value->setContent("<p>paragraph</p>\n<ul><li>1</li>\r\n</ul>");
     $this->assertEquals("<p>paragraph</p>\n<ul><li>1</li>\n</ul>", $value->getContent(), 'Newlines get converted');
 }