diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/HTML5/ElementsTest.php | 2 | ||||
-rw-r--r-- | test/HTML5/Html5Test.php | 2 | ||||
-rw-r--r-- | test/HTML5/Parser/CharacterReferenceTest.php | 5 | ||||
-rw-r--r-- | test/HTML5/Parser/DOMTreeBuilderTest.php | 32 | ||||
-rw-r--r-- | test/HTML5/Parser/EventStack.php | 3 | ||||
-rw-r--r-- | test/HTML5/Parser/EventStackError.php | 5 | ||||
-rw-r--r-- | test/HTML5/Parser/FileInputStreamTest.php | 6 | ||||
-rw-r--r-- | test/HTML5/Parser/InstructionProcessorMock.php | 22 | ||||
-rw-r--r-- | test/HTML5/Parser/ScannerTest.php | 2 | ||||
-rw-r--r-- | test/HTML5/Parser/StringInputStreamTest.php | 16 | ||||
-rw-r--r-- | test/HTML5/Parser/TokenizerTest.php | 9 | ||||
-rw-r--r-- | test/HTML5/Parser/TreeBuildingRulesTest.php | 9 | ||||
-rw-r--r-- | test/HTML5/Serializer/OutputRulesTest.php | 4 | ||||
-rw-r--r-- | test/HTML5/Serializer/TraverserTest.php | 6 | ||||
-rw-r--r-- | test/HTML5/TestCase.php | 3 |
15 files changed, 63 insertions, 63 deletions
diff --git a/test/HTML5/ElementsTest.php b/test/HTML5/ElementsTest.php index 64db413..3894ee8 100644 --- a/test/HTML5/ElementsTest.php +++ b/test/HTML5/ElementsTest.php @@ -3,8 +3,6 @@ namespace HTML5\Tests; use \HTML5\Elements; -require_once 'TestCase.php'; - class ElementsTest extends TestCase { public $html5Elements = array( diff --git a/test/HTML5/Html5Test.php b/test/HTML5/Html5Test.php index dcb51cd..29ce83b 100644 --- a/test/HTML5/Html5Test.php +++ b/test/HTML5/Html5Test.php @@ -1,8 +1,6 @@ <?php namespace HTML5\Tests; -require_once 'TestCase.php'; - class Html5Test extends TestCase { /** diff --git a/test/HTML5/Parser/CharacterReferenceTest.php b/test/HTML5/Parser/CharacterReferenceTest.php index b530f1c..c568d03 100644 --- a/test/HTML5/Parser/CharacterReferenceTest.php +++ b/test/HTML5/Parser/CharacterReferenceTest.php @@ -3,10 +3,9 @@ * @file * Test the Scanner. This requires the InputStream tests are all good. */ -namespace HTML5\Parser; - -require_once __DIR__ . '/../TestCase.php'; +namespace HTML5\Tests\Parser; +use HTML5\Parser\CharacterReference; class CharacterReferenceTest extends \HTML5\Tests\TestCase { public function testLookupName() { $this->assertEquals('&', CharacterReference::lookupName('amp')); diff --git a/test/HTML5/Parser/DOMTreeBuilderTest.php b/test/HTML5/Parser/DOMTreeBuilderTest.php index 6eeafe8..dde8393 100644 --- a/test/HTML5/Parser/DOMTreeBuilderTest.php +++ b/test/HTML5/Parser/DOMTreeBuilderTest.php @@ -3,11 +3,13 @@ * @file * Test the Tree Builder. */ -namespace HTML5\Parser; +namespace HTML5\Tests\Parser; use HTML5\Elements; - -require_once __DIR__ . '/../TestCase.php'; +use HTML5\Parser\StringInputStream; +use HTML5\Parser\Scanner; +use HTML5\Parser\Tokenizer; +use HTML5\Parser\DOMTreeBuilder; /** * These tests are functional, not necessarily unit tests. @@ -108,7 +110,7 @@ class DOMTreeBuilderTest extends \HTML5\Tests\TestCase { <svg width='150' viewbox='2'> <rect textlength='2'/> <animatecolor>foo</animatecolor> - </svg> + </svg> </body></html>"; $doc = $this->parse($html); $root = $doc->documentElement; @@ -208,7 +210,7 @@ class DOMTreeBuilderTest extends \HTML5\Tests\TestCase { $html = "<!DOCTYPE html><html><math><![CDATA[test"; $doc = $this->parse($html); - // We're JUST testing that we can access errors. Actual testing of + // We're JUST testing that we can access errors. Actual testing of // error messages happen in the Tokenizer's tests. $this->assertGreaterThan(0, count($doc->errors)); $this->assertTrue(is_string($doc->errors[0])); @@ -345,23 +347,3 @@ class DOMTreeBuilderTest extends \HTML5\Tests\TestCase { $this->assertEquals('foo', $div->textContent); } } - -class InstructionProcessorMock implements \HTML5\InstructionProcessor { - - public $name = NULL; - public $data = NULL; - public $count = 0; - - public function process(\DOMElement $element, $name, $data) { - $this->name = $name; - $this->data = $data; - $this->count++; - - $div = $element->ownerDocument->createElement("div"); - $div->nodeValue = 'foo'; - - $element->appendChild($div); - - return $div; - } -} diff --git a/test/HTML5/Parser/EventStack.php b/test/HTML5/Parser/EventStack.php index 1f56ea9..ffa4f12 100644 --- a/test/HTML5/Parser/EventStack.php +++ b/test/HTML5/Parser/EventStack.php @@ -1,7 +1,8 @@ <?php -namespace HTML5\Parser; +namespace HTML5\Tests\Parser; use HTML5\Elements; +use HTML5\Parser\EventHandler; /** * This testing class gathers events from a parser and builds a stack of events. diff --git a/test/HTML5/Parser/EventStackError.php b/test/HTML5/Parser/EventStackError.php new file mode 100644 index 0000000..8465b33 --- /dev/null +++ b/test/HTML5/Parser/EventStackError.php @@ -0,0 +1,5 @@ +<?php +namespace HTML5\Tests\Parser; + +class EventStackParseError extends \Exception { +} diff --git a/test/HTML5/Parser/FileInputStreamTest.php b/test/HTML5/Parser/FileInputStreamTest.php index 2ee2440..80078ff 100644 --- a/test/HTML5/Parser/FileInputStreamTest.php +++ b/test/HTML5/Parser/FileInputStreamTest.php @@ -1,10 +1,8 @@ <?php -namespace HTML5\Tests; +namespace HTML5\Tests\Parser; use \HTML5\Parser\FileInputStream; -require_once __DIR__ . '/../TestCase.php'; - class FileInputStreamTest extends \HTML5\Tests\TestCase { function testConstruct() { @@ -61,7 +59,7 @@ class FileInputStreamTest extends \HTML5\Tests\TestCase { $this->assertEquals(2, $s->columnOffset()); $s->next(); $this->assertEquals(3, $s->columnOffset()); - + // Make sure we get to the second line $s->next(); $s->next(); $s->next(); $s->next(); $s->next(); $s->next(); $s->next(); $s->next(); diff --git a/test/HTML5/Parser/InstructionProcessorMock.php b/test/HTML5/Parser/InstructionProcessorMock.php new file mode 100644 index 0000000..86572c7 --- /dev/null +++ b/test/HTML5/Parser/InstructionProcessorMock.php @@ -0,0 +1,22 @@ +<?php +namespace HTML5\Tests\Parser; + +class InstructionProcessorMock implements \HTML5\InstructionProcessor { + + public $name = NULL; + public $data = NULL; + public $count = 0; + + public function process(\DOMElement $element, $name, $data) { + $this->name = $name; + $this->data = $data; + $this->count++; + + $div = $element->ownerDocument->createElement("div"); + $div->nodeValue = 'foo'; + + $element->appendChild($div); + + return $div; + } +}
\ No newline at end of file diff --git a/test/HTML5/Parser/ScannerTest.php b/test/HTML5/Parser/ScannerTest.php index 1c9b009..e5077d8 100644 --- a/test/HTML5/Parser/ScannerTest.php +++ b/test/HTML5/Parser/ScannerTest.php @@ -8,8 +8,6 @@ namespace HTML5\Tests\Parser; use \HTML5\Parser\StringInputStream; use \HTML5\Parser\Scanner; -require_once __DIR__ . '/../TestCase.php'; - class ScannerTest extends \HTML5\Tests\TestCase { /** diff --git a/test/HTML5/Parser/StringInputStreamTest.php b/test/HTML5/Parser/StringInputStreamTest.php index 46c70c4..8d46bf2 100644 --- a/test/HTML5/Parser/StringInputStreamTest.php +++ b/test/HTML5/Parser/StringInputStreamTest.php @@ -1,10 +1,8 @@ <?php -namespace HTML5\Tests; +namespace HTML5\Tests\Parser; use \HTML5\Parser\StringInputStream; -require_once __DIR__ . '/../TestCase.php'; - class StringInputStreamTest extends \HTML5\Tests\TestCase { /** @@ -218,7 +216,7 @@ class StringInputStreamTest extends \HTML5\Tests\TestCase { } // MPB: - // It appears that iconv just leaves these alone. Not sure what to + // It appears that iconv just leaves these alone. Not sure what to // do. /* $converted = array( @@ -263,19 +261,19 @@ class StringInputStreamTest extends \HTML5\Tests\TestCase { $this->invalidParseErrorTestHandler("\x1D", 1, 'U+001D (C0 control)'); $this->invalidParseErrorTestHandler("\x1E", 1, 'U+001E (C0 control)'); $this->invalidParseErrorTestHandler("\x1F", 1, 'U+001F (C0 control)'); - + // DEL (U+007F) $this->invalidParseErrorTestHandler("\x7F", 1, 'U+007F'); - + // C1 Controls $this->invalidParseErrorTestHandler("\xC2\x80", 1, 'U+0080 (C1 control)'); $this->invalidParseErrorTestHandler("\xC2\x9F", 1, 'U+009F (C1 control)'); $this->invalidParseErrorTestHandler("\xC2\xA0", 0, 'U+00A0 (first codepoint above highest C1 control)'); - + // Charcters surrounding surrogates $this->invalidParseErrorTestHandler("\xED\x9F\xBF", 0, 'U+D7FF (one codepoint below lowest surrogate codepoint)'); $this->invalidParseErrorTestHandler("\xEF\xBF\xBD", 0, 'U+DE00 (one codepoint above highest surrogate codepoint)'); - + // Permanent noncharacters $this->invalidParseErrorTestHandler("\xEF\xB7\x90", 1, 'U+FDD0 (permanent noncharacter)'); $this->invalidParseErrorTestHandler("\xEF\xB7\xAF", 1, 'U+FDEF (permanent noncharacter)'); @@ -325,7 +323,7 @@ class StringInputStreamTest extends \HTML5\Tests\TestCase { $this->invalidParseErrorTestHandler("\xED\xB0\x80", 1, 'U+DC00 (UTF-16 surrogate character)'); $this->invalidParseErrorTestHandler("\xED\xBE\x80", 1, 'U+DF80 (UTF-16 surrogate character)'); $this->invalidParseErrorTestHandler("\xED\xBF\xBF", 1, 'U+DFFF (UTF-16 surrogate character)'); - + // Paired UTF-16 surrogates $this->invalidParseErrorTestHandler("\xED\xA0\x80\xED\xB0\x80", 2, 'U+D800 U+DC00 (paired UTF-16 surrogates)'); $this->invalidParseErrorTestHandler("\xED\xA0\x80\xED\xBF\xBF", 2, 'U+D800 U+DFFF (paired UTF-16 surrogates)'); diff --git a/test/HTML5/Parser/TokenizerTest.php b/test/HTML5/Parser/TokenizerTest.php index 4ca8ed3..54f9786 100644 --- a/test/HTML5/Parser/TokenizerTest.php +++ b/test/HTML5/Parser/TokenizerTest.php @@ -1,7 +1,10 @@ <?php -namespace HTML5\Parser; -require_once __DIR__ . '/../TestCase.php'; -require 'EventStack.php'; +namespace HTML5\Tests\Parser; + +use HTML5\Parser\UTF8Utils; +use HTML5\Parser\StringInputStream; +use HTML5\Parser\Scanner; +use HTML5\Parser\Tokenizer; class TokenizerTest extends \HTML5\Tests\TestCase { // ================================================================ diff --git a/test/HTML5/Parser/TreeBuildingRulesTest.php b/test/HTML5/Parser/TreeBuildingRulesTest.php index a247cea..b285073 100644 --- a/test/HTML5/Parser/TreeBuildingRulesTest.php +++ b/test/HTML5/Parser/TreeBuildingRulesTest.php @@ -3,11 +3,16 @@ * @file * Test the Tree Builder's special-case rules. */ -namespace HTML5\Parser; +namespace HTML5\Tests\Parser; use HTML5\Elements; +use HTML5\Parser\TreeBuildingRules; +use HTML5\Parser\Tokenizer; +use HTML5\Parser\Scanner; +use HTML5\Parser\StringInputStream; +use HTML5\Parser\DOMTreeBuilder; + -require_once __DIR__ . '/../TestCase.php'; /** * These tests are functional, not necessarily unit tests. diff --git a/test/HTML5/Serializer/OutputRulesTest.php b/test/HTML5/Serializer/OutputRulesTest.php index 8a6d0d2..8326ef9 100644 --- a/test/HTML5/Serializer/OutputRulesTest.php +++ b/test/HTML5/Serializer/OutputRulesTest.php @@ -1,12 +1,10 @@ <?php -namespace HTML5\Tests; +namespace HTML5\Tests\Serializer; use \HTML5\Serializer\OutputRules; use \HTML5\Serializer\Traverser; use \HTML5\Parser; -require_once __DIR__ . '/../TestCase.php'; - class OutputRulesTest extends \HTML5\Tests\TestCase { protected $markup = '<!doctype html> diff --git a/test/HTML5/Serializer/TraverserTest.php b/test/HTML5/Serializer/TraverserTest.php index 5816bfc..7f5f5ed 100644 --- a/test/HTML5/Serializer/TraverserTest.php +++ b/test/HTML5/Serializer/TraverserTest.php @@ -1,12 +1,10 @@ <?php -namespace HTML5\Tests; +namespace HTML5\Tests\Serializer; use \HTML5\Serializer\OutputRules; use \HTML5\Serializer\Traverser; use \HTML5\Parser; -require_once __DIR__ . '/../TestCase.php'; - class TraverserTest extends \HTML5\Tests\TestCase { protected $markup = '<!doctype html> @@ -22,7 +20,7 @@ class TraverserTest extends \HTML5\Tests\TestCase { /** * Using reflection we make a protected method accessible for testing. - * + * * @param string $name * The name of the method on the Traverser class to test. * diff --git a/test/HTML5/TestCase.php b/test/HTML5/TestCase.php index 8d3148e..836614e 100644 --- a/test/HTML5/TestCase.php +++ b/test/HTML5/TestCase.php @@ -1,9 +1,6 @@ <?php namespace HTML5\Tests; -require_once 'PHPUnit/Autoload.php'; -require_once __DIR__ . '/../../vendor/autoload.php'; - class TestCase extends \PHPUnit_Framework_TestCase { const DOC_OPEN = '<!DOCTYPE html><html><head><title>test</title></head><body>'; const DOC_CLOSE = '</body></html>'; |