Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
use BetterDOMDocument\DOMDoc; | ||
|
||
class CSSTest extends PHPUnit_Framework_TestCase { | ||
public function testSelect() { | ||
$dom = DOMDoc::loadFile("tests/testdata/helloworld.html"); | ||
|
||
$this->assertNotEmpty($dom->select('.image')); | ||
$this->assertEmpty($dom->select('.asdf')); | ||
|
||
$this->assertNotEmpty($dom->selectSingle('.image')); | ||
$this->assertEmpty($dom->selectSingle('.asdf')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
use BetterDOMDocument\DOMDoc; | ||
|
||
class NamespaceTest extends PHPUnit_Framework_TestCase { | ||
public function testLookup() { | ||
$dom = DOMDoc::loadFile("tests/testdata/note.namespaced.xml"); | ||
|
||
$this->assertEquals("note", $dom->lookupPrefix('http://my-example-namespace')); | ||
$this->assertEquals("http://my-example-namespace", $dom->lookupURL('note')); | ||
} | ||
|
||
public function testChange() { | ||
$dom = DOMDoc::loadFile("tests/testdata/helloworld.xhtml"); | ||
|
||
$dom->changeNamespace('//html:img', 'img', 'http://www.w3.org/1998/Image'); | ||
|
||
$this->assertNotEmpty($dom->xpath('//img:img')); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<body> | ||
|
||
<h1>Hellow World</h1> | ||
|
||
<p>Hi there world.</p> | ||
|
||
<img src="helloworld.jpg" /> | ||
|
||
</body> | ||
</html> |