diff options
author | Matt Farina <[email protected]> | 2013-06-04 21:20:31 -0400 |
---|---|---|
committer | Matt Farina <[email protected]> | 2013-06-04 21:20:31 -0400 |
commit | 6d8d52cf7c157d10df37cceaa80e6931f1e2b623 (patch) | |
tree | 428cb2c1a530d1c64d0dc63ae2541cb1810843e1 /test/HTML5 | |
parent | c8718f5c94289e32f58c8c108cffb5b3f06f0d06 (diff) |
Added a serializer test for a file on the system.
Diffstat (limited to 'test/HTML5')
-rw-r--r-- | test/HTML5/Serializer/SerializerTest.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/HTML5/Serializer/SerializerTest.php b/test/HTML5/Serializer/SerializerTest.php index 234cca4..2c59474 100644 --- a/test/HTML5/Serializer/SerializerTest.php +++ b/test/HTML5/Serializer/SerializerTest.php @@ -60,6 +60,7 @@ class SerializerTest extends \HTML5\Tests\TestCase { $dom = \HTML5::loadHTML($html); $this->assertTrue($dom instanceof \DOMDocument, "Canary"); + // Test saving to a stream. $ser = new Serializer($dom, \HTML5::options()); $out = fopen("php://temp", "w"); $ser->save($out); @@ -67,6 +68,14 @@ class SerializerTest extends \HTML5\Tests\TestCase { rewind($out); $res = stream_get_contents($out); $this->assertTrue(count($res) >= count($html)); + + // Test saving to a file on the file system. + $tmpfname = tempnam(sys_get_temp_dir(), "html5-php"); + $ser = new Serializer($dom, \HTML5::options()); + $ser->save($tmpfname); + $content = file_get_contents($tmpfname); + $this->assertRegExp('|<body>test</body>|', $content); + unlink($tmpfname); } public function testElements() { |