summaryrefslogtreecommitdiff
path: root/test/HTML5/Parser
diff options
context:
space:
mode:
authorMatt Farina <[email protected]>2015-02-23 21:19:54 -0500
committerMatt Farina <[email protected]>2015-02-23 21:19:54 -0500
commit8dce780fb24ff7178ead7fcf88146ed069cacb8b (patch)
tree5ebe4cc837cd8e78a64344b93eb05e0e8d8cb346 /test/HTML5/Parser
parentc86ac4831a179759ab2478724caf338911693e59 (diff)
Adding some tests to the UTF8 utilities.
Diffstat (limited to 'test/HTML5/Parser')
-rw-r--r--test/HTML5/Parser/UTF8UtilsTest.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/HTML5/Parser/UTF8UtilsTest.php b/test/HTML5/Parser/UTF8UtilsTest.php
new file mode 100644
index 0000000..0e8555a
--- /dev/null
+++ b/test/HTML5/Parser/UTF8UtilsTest.php
@@ -0,0 +1,26 @@
+<?php
+
+namespace Masterminds\HTML5\Tests\Parser;
+
+use Masterminds\HTML5\Parser\UTF8Utils;
+
+class UTF8UtilsTest extends \Masterminds\HTML5\Tests\TestCase
+{
+ public function testConvertToUTF8() {
+ $out = UTF8Utils::convertToUTF8('éàa', 'ISO-8859-1');
+ $this->assertEquals('éàa', $out);
+ }
+
+ /**
+ * @todo add tests for invalid codepoints
+ */
+ public function testCheckForIllegalCodepoints() {
+ $smoke = "Smoke test";
+ $err = UTF8Utils::checkForIllegalCodepoints($smoke);
+ $this->assertEmpty($err);
+
+ $data = "Foo Bar \0 Baz";
+ $errors = UTF8Utils::checkForIllegalCodepoints($data);
+ $this->assertContains('null-character', $errors);
+ }
+} \ No newline at end of file