diff options
author | Asmir Mustafic <[email protected]> | 2014-06-11 10:05:54 +0200 |
---|---|---|
committer | Asmir Mustafic <[email protected]> | 2014-06-11 10:05:54 +0200 |
commit | d6940c3cc8eebd72627d42a0c0b3139f951716f4 (patch) | |
tree | d632d5553e1712f9606ce6ae2b15eb99bcd3b831 | |
parent | 92fbcfdd1e4f788c981dc91fee8336cbd9c2c484 (diff) |
PSR-0 vendor namespace
37 files changed, 137 insertions, 133 deletions
diff --git a/bin/entities.php b/bin/entities.php index 39f2b45..0fbd6ec 100644 --- a/bin/entities.php +++ b/bin/entities.php @@ -16,7 +16,7 @@ foreach ($json as $name => $obj) { } print '<?php -namespace HTML5; +namespace Masterminds\\HTML5; /** Entity lookup tables. This class is automatically generated. */ class Entities { public static $byName = '; diff --git a/composer.json b/composer.json index 1e8ca31..549ef28 100644 --- a/composer.json +++ b/composer.json @@ -25,10 +25,10 @@ "phpdocumentor/phpdocumentor": "2.*" }, "autoload": { - "psr-0": {"HTML5": "src"} + "psr-4": {"Masterminds\\": "src"} }, "autoload-dev": { - "psr-4": {"HTML5\\Tests\\": "test/HTML5"} + "psr-4": {"Masterminds\\HTML5\\Tests\\": "test/HTML5"} }, "extra": { "branch-alias": { diff --git a/src/HTML5.php b/src/HTML5.php index 4515884..121ef54 100644 --- a/src/HTML5.php +++ b/src/HTML5.php @@ -1,12 +1,14 @@ <?php -use HTML5\Parser\FileInputStream; -use HTML5\Parser\StringInputStream; -use HTML5\Parser\DOMTreeBuilder; -use HTML5\Parser\Scanner; -use HTML5\Parser\Tokenizer; -use HTML5\Serializer\OutputRules; -use HTML5\Serializer\Traverser; +namespace Masterminds; + +use Masterminds\HTML5\Parser\FileInputStream; +use Masterminds\HTML5\Parser\StringInputStream; +use Masterminds\HTML5\Parser\DOMTreeBuilder; +use Masterminds\HTML5\Parser\Scanner; +use Masterminds\HTML5\Parser\Tokenizer; +use Masterminds\HTML5\Serializer\OutputRules; +use Masterminds\HTML5\Serializer\Traverser; /** * This class offers convenience methods for parsing and serializing HTML5. @@ -137,7 +139,7 @@ class HTML5 * Lower-level loading function. This requires an input stream instead * of a string, file, or resource. */ - public function parse(\HTML5\Parser\InputStream $input) { + public function parse(\Masterminds\HTML5\Parser\InputStream $input) { $this->errors = array(); $events = new DOMTreeBuilder(); $scanner = new Scanner($input); @@ -159,7 +161,7 @@ class HTML5 * Lower-level loading function. This requires an input stream instead * of a string, file, or resource. */ - public function parseFragment(\HTML5\Parser\InputStream $input) { + public function parseFragment(\Masterminds\HTML5\Parser\InputStream $input) { $events = new DOMTreeBuilder(TRUE); $scanner = new Scanner($input); $parser = new Tokenizer($scanner, $events); diff --git a/src/HTML5/Elements.php b/src/HTML5/Elements.php index 678b3ac..31e9e4c 100644 --- a/src/HTML5/Elements.php +++ b/src/HTML5/Elements.php @@ -2,12 +2,12 @@ /** * Provide general element functions. */ -namespace HTML5; +namespace Masterminds\HTML5; /** - * This class provides general information about HTML5 elements, - * including syntactic and semantic issues. Parsers and serializers can - * use this class as a reference point for information about the rules + * This class provides general information about HTML5 elements, + * including syntactic and semantic issues. Parsers and serializers can + * use this class as a reference point for information about the rules * of various HTML5 elements. * * @todo consider using a bitmask table lookup. There is enough overlap in @@ -39,8 +39,8 @@ class Elements { // "pre", "listing" // "form" // "plaintext" - /** - * Indicates that if a previous event is for a P tag, that element + /** + * Indicates that if a previous event is for a P tag, that element * should be considered closed. */ const AUTOCLOSE_P = 16; @@ -82,7 +82,7 @@ class Elements { "command" => 9, // NORMAL | VOID_TAG //"data" => 1, // This is highly experimental and only part of the whatwg spec (not w3c). See https://developer.mozilla.org/en-US/docs/HTML/Element/data "datalist" => 1, - "dd" => 65, // NORMAL | BLOCK_TAG + "dd" => 65, // NORMAL | BLOCK_TAG "del" => 1, "details" => 17, // NORMAL | AUTOCLOSE_P, "dfn" => 1, @@ -189,7 +189,7 @@ class Elements { * * In our case we are only concerned with presentation MathML and not content * MathML. There is a nice list of this subset at https://developer.mozilla.org/en-US/docs/MathML/Element. - * + * * @var array */ public static $mathml = array( @@ -520,8 +520,8 @@ class Elements { * * This includes html5 elements along with other allowed embedded content * such as svg and mathml. - * - * @param string $name + * + * @param string $name * The name of the element. * * @return bool @@ -594,7 +594,7 @@ class Elements { * Normalize a MathML attribute name to its proper case and form. * * Note, all MathML element names are lowercase. - * + * * @param string $name * The name of the attribute. * diff --git a/src/HTML5/Entities.php b/src/HTML5/Entities.php index e5de9e2..2174f0d 100644 --- a/src/HTML5/Entities.php +++ b/src/HTML5/Entities.php @@ -1,5 +1,5 @@ <?php -namespace HTML5; +namespace Masterminds\HTML5; /** Entity lookup tables. This class is automatically generated. */ class Entities { public static $byName = array ( diff --git a/src/HTML5/Exception.php b/src/HTML5/Exception.php index aa650a6..9885ae5 100644 --- a/src/HTML5/Exception.php +++ b/src/HTML5/Exception.php @@ -1,5 +1,5 @@ <?php -namespace HTML5; +namespace Masterminds\HTML5; /** * The base exception for the HTML5 project. diff --git a/src/HTML5/InstructionProcessor.php b/src/HTML5/InstructionProcessor.php index cfe7b33..d84ba42 100644 --- a/src/HTML5/InstructionProcessor.php +++ b/src/HTML5/InstructionProcessor.php @@ -2,15 +2,15 @@ /** * A handler for processor instructions. */ -namespace HTML5; +namespace Masterminds\HTML5; /** * Provide an processor to handle embedded instructions. * - * XML defines a mechanism for inserting instructions (like PHP) into a - * document. These are called "Processor Instructions." The HTML5 parser - * provides an opportunity to handle these processor instructions during - * the tree-building phase (before the DOM is constructed), which makes + * XML defines a mechanism for inserting instructions (like PHP) into a + * document. These are called "Processor Instructions." The HTML5 parser + * provides an opportunity to handle these processor instructions during + * the tree-building phase (before the DOM is constructed), which makes * it possible to alter the document as it is being created. * * One could, for example, use this mechanism to execute well-formed PHP @@ -24,7 +24,7 @@ interface InstructionProcessor { * The process() function is responsible for doing the following: * - Determining whether $name is an instruction type it can handle. * - Determining what to do with the data passed in. - * - Making any subsequent modifications to the DOM by modifying the + * - Making any subsequent modifications to the DOM by modifying the * DOMElement or its attached DOM tree. * * @param DOMElement $element diff --git a/src/HTML5/Parser/CharacterReference.php b/src/HTML5/Parser/CharacterReference.php index 526a8b1..2ead49e 100644 --- a/src/HTML5/Parser/CharacterReference.php +++ b/src/HTML5/Parser/CharacterReference.php @@ -1,13 +1,13 @@ <?php -namespace HTML5\Parser; +namespace Masterminds\HTML5\Parser; -use \HTML5\Entities; +use Masterminds\HTML5\Entities; /** * Manage entity references. * * This is a simple resolver for HTML5 character reference entitites. - * See \HTML5\Entities for the list of supported entities. + * See \Masterminds\HTML5\Entities for the list of supported entities. */ class CharacterReference { diff --git a/src/HTML5/Parser/DOMTreeBuilder.php b/src/HTML5/Parser/DOMTreeBuilder.php index 964d662..3bf5713 100644 --- a/src/HTML5/Parser/DOMTreeBuilder.php +++ b/src/HTML5/Parser/DOMTreeBuilder.php @@ -1,7 +1,7 @@ <?php -namespace HTML5\Parser; +namespace Masterminds\HTML5\Parser; -use HTML5\Elements; +use Masterminds\HTML5\Elements; /** * Create an HTML5 DOM tree from events. * @@ -136,7 +136,7 @@ class DOMTreeBuilder implements EventHandler { * This is used for handling Processor Instructions as they are * inserted. If omitted, PI's are inserted directly into the DOM tree. */ - public function setInstructionProcessor(\HTML5\InstructionProcessor $proc) { + public function setInstructionProcessor(\Masterminds\HTML5\InstructionProcessor $proc) { $this->processor = $proc; } diff --git a/src/HTML5/Parser/EventHandler.php b/src/HTML5/Parser/EventHandler.php index 4034938..4a99aa6 100644 --- a/src/HTML5/Parser/EventHandler.php +++ b/src/HTML5/Parser/EventHandler.php @@ -1,5 +1,5 @@ <?php -namespace HTML5\Parser; +namespace Masterminds\HTML5\Parser; /** * Standard events for HTML5. diff --git a/src/HTML5/Parser/FileInputStream.php b/src/HTML5/Parser/FileInputStream.php index c1bb128..ce16fb2 100644 --- a/src/HTML5/Parser/FileInputStream.php +++ b/src/HTML5/Parser/FileInputStream.php @@ -1,5 +1,5 @@ <?php -namespace HTML5\Parser; +namespace Masterminds\HTML5\Parser; /** * The FileInputStream loads a file to be parsed. diff --git a/src/HTML5/Parser/InputStream.php b/src/HTML5/Parser/InputStream.php index 713031d..8180909 100644 --- a/src/HTML5/Parser/InputStream.php +++ b/src/HTML5/Parser/InputStream.php @@ -1,5 +1,5 @@ <?php -namespace HTML5\Parser; +namespace Masterminds\HTML5\Parser; /** * Interface for stream readers. diff --git a/src/HTML5/Parser/ParseError.php b/src/HTML5/Parser/ParseError.php index 4d5f117..53a0844 100644 --- a/src/HTML5/Parser/ParseError.php +++ b/src/HTML5/Parser/ParseError.php @@ -1,5 +1,5 @@ <?php -namespace HTML5\Parser; +namespace Masterminds\HTML5\Parser; /** * Emit when the parser has an error. diff --git a/src/HTML5/Parser/Scanner.php b/src/HTML5/Parser/Scanner.php index cd147e5..18ed821 100644 --- a/src/HTML5/Parser/Scanner.php +++ b/src/HTML5/Parser/Scanner.php @@ -1,5 +1,5 @@ <?php -namespace HTML5\Parser; +namespace Masterminds\HTML5\Parser; /** * The scanner. @@ -19,7 +19,7 @@ class Scanner { /** * Create a new Scanner. * - * @param \HTML5\Parser\InputStream $input + * @param \Masterminds\HTML5\Parser\InputStream $input * An InputStream to be scanned. */ public function __construct($input) { diff --git a/src/HTML5/Parser/StringInputStream.php b/src/HTML5/Parser/StringInputStream.php index ca5fee0..ee1e1ba 100644 --- a/src/HTML5/Parser/StringInputStream.php +++ b/src/HTML5/Parser/StringInputStream.php @@ -2,7 +2,7 @@ /** * Loads a string to be parsed. */ -namespace HTML5\Parser; +namespace Masterminds\HTML5\Parser; /* * diff --git a/src/HTML5/Parser/Tokenizer.php b/src/HTML5/Parser/Tokenizer.php index f3cf622..c70d92f 100644 --- a/src/HTML5/Parser/Tokenizer.php +++ b/src/HTML5/Parser/Tokenizer.php @@ -1,7 +1,7 @@ <?php -namespace HTML5\Parser; +namespace Masterminds\HTML5\Parser; -use HTML5\Elements; +use Masterminds\HTML5\Elements; /** * The HTML5 tokenizer. @@ -48,9 +48,9 @@ class Tokenizer { * it a scanner (input) and an event handler (output), and then calling * the Tokenizer::parse() method.` * - * @param \HTML5\Parser\Scanner $scanner + * @param \Masterminds\HTML5\Parser\Scanner $scanner * A scanner initialized with an input stream. - * @param \HTML5\Parser\EventHandler $eventHandler + * @param \Masterminds\HTML5\Parser\EventHandler $eventHandler * An event handler, initialized and ready to receive * events. */ diff --git a/src/HTML5/Parser/TreeBuildingRules.php b/src/HTML5/Parser/TreeBuildingRules.php index b87c6b5..73b7fc4 100644 --- a/src/HTML5/Parser/TreeBuildingRules.php +++ b/src/HTML5/Parser/TreeBuildingRules.php @@ -1,7 +1,7 @@ <?php -namespace HTML5\Parser; +namespace Masterminds\HTML5\Parser; -use HTML5\Elements; +use Masterminds\HTML5\Elements; /** * Handles special-case rules for the DOM tree builder. diff --git a/src/HTML5/Parser/UTF8Utils.php b/src/HTML5/Parser/UTF8Utils.php index 974a670..37e8856 100644 --- a/src/HTML5/Parser/UTF8Utils.php +++ b/src/HTML5/Parser/UTF8Utils.php @@ -25,7 +25,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -namespace HTML5\Parser; +namespace Masterminds\HTML5\Parser; /** * UTF-8 Utilities */ diff --git a/src/HTML5/Serializer/HTML5Entities.php b/src/HTML5/Serializer/HTML5Entities.php index 5717002..91322c9 100644 --- a/src/HTML5/Serializer/HTML5Entities.php +++ b/src/HTML5/Serializer/HTML5Entities.php @@ -3,12 +3,12 @@ * @file * This contains HTML5 entities to use with serializing. * - * The list here is mildly different from the list at \HTML5\Entities because + * The list here is mildly different from the list at \Masterminds\HTML5\Entities because * that list was generated from the w3c. It contains some entities that are * not entirely proper such as &am; which maps to &. This list is meant to be * a fallback for PHP versions prior to PHP 5.4 when dealing with encoding. */ -namespace HTML5\Serializer; +namespace Masterminds\HTML5\Serializer; /** * A mapping of entities to their html5 representation. Used for older PHP diff --git a/src/HTML5/Serializer/OutputRules.php b/src/HTML5/Serializer/OutputRules.php index 3af1cde..2425958 100644 --- a/src/HTML5/Serializer/OutputRules.php +++ b/src/HTML5/Serializer/OutputRules.php @@ -6,14 +6,14 @@ * These output rules are likely to generate output similar to the document that * was parsed. It is not intended to output exactly the document that was parsed. */ -namespace HTML5\Serializer; +namespace Masterminds\HTML5\Serializer; -use \HTML5\Elements; +use Masterminds\HTML5\Elements; /** * Generate the output html5 based on element rules. */ -class OutputRules implements \HTML5\Serializer\RulesInterface { +class OutputRules implements \Masterminds\HTML5\Serializer\RulesInterface { const IM_IN_HTML = 1; const IM_IN_SVG = 2; @@ -36,7 +36,7 @@ class OutputRules implements \HTML5\Serializer\RulesInterface { $this->out = $output; } - public function setTraverser(\HTML5\Serializer\Traverser $traverser) { + public function setTraverser(\Masterminds\HTML5\Serializer\Traverser $traverser) { $this->traverser = $traverser; return $this; @@ -208,7 +208,7 @@ class OutputRules implements \HTML5\Serializer\RulesInterface { * @param string $text * The string to put into the output. * - * @return HTML5\Serializer\Traverser + * @return Masterminds\HTML5\Serializer\Traverser * $this so it can be used in chaining. */ protected function wr($text) { @@ -219,7 +219,7 @@ class OutputRules implements \HTML5\Serializer\RulesInterface { /** * Write a new line character. * - * @return HTML5\Serializer\Traverser + * @return Masterminds\HTML5\Serializer\Traverser * $this so it can be used in chaining. */ protected function nl() { @@ -274,7 +274,7 @@ class OutputRules implements \HTML5\Serializer\RulesInterface { // If a version earlier than 5.4 html5 entities are not entirely handled. // This manually handles them. else { - return strtr($text, \HTML5\Serializer\HTML5Entities::$map); + return strtr($text, \Masterminds\HTML5\Serializer\HTML5Entities::$map); } } diff --git a/src/HTML5/Serializer/RulesInterface.php b/src/HTML5/Serializer/RulesInterface.php index 18ac8ca..86f44af 100644 --- a/src/HTML5/Serializer/RulesInterface.php +++ b/src/HTML5/Serializer/RulesInterface.php @@ -3,14 +3,14 @@ * @file * The interface definition for Rules to generate output. */ -namespace HTML5\Serializer; +namespace Masterminds\HTML5\Serializer; /** * To create a new rule set for writing output the RulesInterface needs to be * implemented. The resulting class can be specified in the options with the * key of rules. * - * For an example implementation see \HTML5\Serializer\OutputRules. + * For an example implementation see \Masterminds\HTML5\Serializer\OutputRules. */ interface RulesInterface { @@ -31,12 +31,12 @@ interface RulesInterface { * * Note, only one traverser can be used by the rules. * - * @param \HTML5\Serializer\Traverser $traverser + * @param \Masterminds\HTML5\Serializer\Traverser $traverser * The traverser used in the rules. - * @return \HTML5\Serializer\RulesInterface + * @return \Masterminds\HTML5\Serializer\RulesInterface * $this for the current object. */ - public function setTraverser(\HTML5\Serializer\Traverser $traverser); + public function setTraverser(\Masterminds\HTML5\Serializer\Traverser $traverser); /** * Write a document element (\DOMDocument). @@ -91,7 +91,7 @@ interface RulesInterface { /** * Write a processor instruction. * - * To learn about processor instructions see \HTML5\InstructionProcessor + * To learn about processor instructions see \Masterminds\HTML5\InstructionProcessor * * Instead of returning the result write it to the output stream ($output) * that was passed into the constructor. diff --git a/src/HTML5/Serializer/Traverser.php b/src/HTML5/Serializer/Traverser.php index 0794458..bcb9814 100644 --- a/src/HTML5/Serializer/Traverser.php +++ b/src/HTML5/Serializer/Traverser.php @@ -1,5 +1,5 @@ <?php -namespace HTML5\Serializer; +namespace Masterminds\HTML5\Serializer; /** * Traverser for walking a DOM tree. diff --git a/test/HTML5/ElementsTest.php b/test/HTML5/ElementsTest.php index 3894ee8..4d0709a 100644 --- a/test/HTML5/ElementsTest.php +++ b/test/HTML5/ElementsTest.php @@ -1,7 +1,8 @@ <?php -namespace HTML5\Tests; +namespace Masterminds\HTML5\Tests; -use \HTML5\Elements; +use Masterminds\HTML5\Elements; +use Masterminds\HTML5\Tests\TestCase; class ElementsTest extends TestCase { @@ -244,7 +245,7 @@ class ElementsTest extends TestCase { ); public function testIsHtml5Element() { - + foreach ($this->html5Elements as $element) { $this->assertTrue(Elements::isHtml5Element($element), 'html5 element test failed on: ' . $element); diff --git a/test/HTML5/Html5Test.php b/test/HTML5/Html5Test.php index db8f302..12c421a 100644 --- a/test/HTML5/Html5Test.php +++ b/test/HTML5/Html5Test.php @@ -1,5 +1,5 @@ <?php -namespace HTML5\Tests; +namespace Masterminds\HTML5\Tests; class Html5Test extends TestCase { diff --git a/test/HTML5/Parser/CharacterReferenceTest.php b/test/HTML5/Parser/CharacterReferenceTest.php index c568d03..6dedb00 100644 --- a/test/HTML5/Parser/CharacterReferenceTest.php +++ b/test/HTML5/Parser/CharacterReferenceTest.php @@ -3,10 +3,10 @@ * @file * Test the Scanner. This requires the InputStream tests are all good. */ -namespace HTML5\Tests\Parser; +namespace Masterminds\HTML5\Tests\Parser; -use HTML5\Parser\CharacterReference; -class CharacterReferenceTest extends \HTML5\Tests\TestCase { +use Masterminds\HTML5\Parser\CharacterReference; +class CharacterReferenceTest extends \Masterminds\HTML5\Tests\TestCase { public function testLookupName() { $this->assertEquals('&', CharacterReference::lookupName('amp')); $this->assertEquals('<', CharacterReference::lookupName('lt')); diff --git a/test/HTML5/Parser/DOMTreeBuilderTest.php b/test/HTML5/Parser/DOMTreeBuilderTest.php index ab5378a..52dad30 100644 --- a/test/HTML5/Parser/DOMTreeBuilderTest.php +++ b/test/HTML5/Parser/DOMTreeBuilderTest.php @@ -3,18 +3,18 @@ * @file * Test the Tree Builder. */ -namespace HTML5\Tests\Parser; +namespace Masterminds\HTML5\Tests\Parser; -use HTML5\Elements; -use HTML5\Parser\StringInputStream; -use HTML5\Parser\Scanner; -use HTML5\Parser\Tokenizer; -use HTML5\Parser\DOMTreeBuilder; +use Masterminds\HTML5\Elements; +use Masterminds\HTML5\Parser\StringInputStream; +use Masterminds\HTML5\Parser\Scanner; +use Masterminds\HTML5\Parser\Tokenizer; +use Masterminds\HTML5\Parser\DOMTreeBuilder; /** * These tests are functional, not necessarily unit tests. */ -class DOMTreeBuilderTest extends \HTML5\Tests\TestCase { +class DOMTreeBuilderTest extends \Masterminds\HTML5\Tests\TestCase { /** * Convenience function for parsing. diff --git a/test/HTML5/Parser/EventStack.php b/test/HTML5/Parser/EventStack.php index acbe3f5..050cb5a 100644 --- a/test/HTML5/Parser/EventStack.php +++ b/test/HTML5/Parser/EventStack.php @@ -1,8 +1,8 @@ <?php -namespace HTML5\Tests\Parser; +namespace Masterminds\HTML5\Tests\Parser; -use HTML5\Elements; -use HTML5\Parser\EventHandler; +use Masterminds\HTML5\Elements; +use Masterminds\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 index 8465b33..e2d6ba7 100644 --- a/test/HTML5/Parser/EventStackError.php +++ b/test/HTML5/Parser/EventStackError.php @@ -1,5 +1,5 @@ <?php -namespace HTML5\Tests\Parser; +namespace Masterminds\HTML5\Tests\Parser; class EventStackParseError extends \Exception { } diff --git a/test/HTML5/Parser/FileInputStreamTest.php b/test/HTML5/Parser/FileInputStreamTest.php index 80078ff..4efcbe1 100644 --- a/test/HTML5/Parser/FileInputStreamTest.php +++ b/test/HTML5/Parser/FileInputStreamTest.php @@ -1,14 +1,14 @@ <?php -namespace HTML5\Tests\Parser; +namespace Masterminds\HTML5\Tests\Parser; -use \HTML5\Parser\FileInputStream; +use Masterminds\HTML5\Parser\FileInputStream; -class FileInputStreamTest extends \HTML5\Tests\TestCase { +class FileInputStreamTest extends \Masterminds\HTML5\Tests\TestCase { function testConstruct() { $s = new FileInputStream(__DIR__ . '/FileInputStreamTest.html'); - $this->assertInstanceOf('\HTML5\Parser\FileInputStream', $s); + $this->assertInstanceOf('\Masterminds\HTML5\Parser\FileInputStream', $s); } public function testNext() { diff --git a/test/HTML5/Parser/InstructionProcessorMock.php b/test/HTML5/Parser/InstructionProcessorMock.php index 86572c7..b668d26 100644 --- a/test/HTML5/Parser/InstructionProcessorMock.php +++ b/test/HTML5/Parser/InstructionProcessorMock.php @@ -1,7 +1,7 @@ <?php -namespace HTML5\Tests\Parser; +namespace Masterminds\HTML5\Tests\Parser; -class InstructionProcessorMock implements \HTML5\InstructionProcessor { +class InstructionProcessorMock implements \Masterminds\HTML5\InstructionProcessor { public $name = NULL; public $data = NULL; diff --git a/test/HTML5/Parser/ScannerTest.php b/test/HTML5/Parser/ScannerTest.php index e5077d8..b0d638e 100644 --- a/test/HTML5/Parser/ScannerTest.php +++ b/test/HTML5/Parser/ScannerTest.php @@ -3,12 +3,12 @@ * @file * Test the Scanner. This requires the InputStream tests are all good. */ -namespace HTML5\Tests\Parser; +namespace Masterminds\HTML5\Tests\Parser; -use \HTML5\Parser\StringInputStream; -use \HTML5\Parser\Scanner; +use Masterminds\HTML5\Parser\StringInputStream; +use Masterminds\HTML5\Parser\Scanner; -class ScannerTest extends \HTML5\Tests\TestCase { +class ScannerTest extends \Masterminds\HTML5\Tests\TestCase { /** * A canary test to make sure the basics are setup and working. @@ -17,7 +17,7 @@ class ScannerTest extends \HTML5\Tests\TestCase { $is = new StringInputStream("abc"); $s = new Scanner($is); - $this->assertInstanceOf('\HTML5\Parser\Scanner', $s); + $this->assertInstanceOf('\Masterminds\HTML5\Parser\Scanner', $s); } public function testNext() { diff --git a/test/HTML5/Parser/StringInputStreamTest.php b/test/HTML5/Parser/StringInputStreamTest.php index 8d46bf2..5148e45 100644 --- a/test/HTML5/Parser/StringInputStreamTest.php +++ b/test/HTML5/Parser/StringInputStreamTest.php @@ -1,9 +1,9 @@ <?php -namespace HTML5\Tests\Parser; +namespace Masterminds\HTML5\Tests\Parser; -use \HTML5\Parser\StringInputStream; +use Masterminds\HTML5\Parser\StringInputStream; -class StringInputStreamTest extends \HTML5\Tests\TestCase { +class StringInputStreamTest extends \Masterminds\HTML5\Tests\TestCase { /** * A canary test to make sure the basics are setup and working. @@ -11,7 +11,7 @@ class StringInputStreamTest extends \HTML5\Tests\TestCase { public function testConstruct() { $s = new StringInputStream("abc"); - $this->assertInstanceOf('\HTML5\Parser\StringInputStream', $s); + $this->assertInstanceOf('\Masterminds\HTML5\Parser\StringInputStream', $s); } public function testNext() { diff --git a/test/HTML5/Parser/TokenizerTest.php b/test/HTML5/Parser/TokenizerTest.php index 0990204..27c3535 100644 --- a/test/HTML5/Parser/TokenizerTest.php +++ b/test/HTML5/Parser/TokenizerTest.php @@ -1,12 +1,12 @@ <?php -namespace HTML5\Tests\Parser; +namespace Masterminds\HTML5\Tests\Parser; -use HTML5\Parser\UTF8Utils; -use HTML5\Parser\StringInputStream; -use HTML5\Parser\Scanner; -use HTML5\Parser\Tokenizer; +use Masterminds\HTML5\Parser\UTF8Utils; +use Masterminds\HTML5\Parser\StringInputStream; +use Masterminds\HTML5\Parser\Scanner; +use Masterminds\HTML5\Parser\Tokenizer; -class TokenizerTest extends \HTML5\Tests\TestCase { +class TokenizerTest extends \Masterminds\HTML5\Tests\TestCase { // ================================================================ // Additional assertions. // ================================================================ @@ -537,7 +537,7 @@ class TokenizerTest extends \HTML5\Tests\TestCase { public function testRcdata() { list($tok, $events) = $this->createTokenizer('<title>'<!-- not a comment --></TITLE>'); - $tok->setTextMode(\HTML5\Elements::TEXT_RCDATA, 'title'); + $tok->setTextMode(\Masterminds\HTML5\Elements::TEXT_RCDATA, 'title'); $tok->parse(); $this->assertEventEquals('text', "'<!-- not a comment -->", $events->get(1)); } diff --git a/test/HTML5/Parser/TreeBuildingRulesTest.php b/test/HTML5/Parser/TreeBuildingRulesTest.php index b285073..ff07a0a 100644 --- a/test/HTML5/Parser/TreeBuildingRulesTest.php +++ b/test/HTML5/Parser/TreeBuildingRulesTest.php @@ -3,21 +3,21 @@ * @file * Test the Tree Builder's special-case rules. */ -namespace HTML5\Tests\Parser; +namespace Masterminds\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; +use Masterminds\HTML5\Elements; +use Masterminds\HTML5\Parser\TreeBuildingRules; +use Masterminds\HTML5\Parser\Tokenizer; +use Masterminds\HTML5\Parser\Scanner; +use Masterminds\HTML5\Parser\StringInputStream; +use Masterminds\HTML5\Parser\DOMTreeBuilder; /** * These tests are functional, not necessarily unit tests. */ -class TreeBuildingRulesTest extends \HTML5\Tests\TestCase { +class TreeBuildingRulesTest extends \Masterminds\HTML5\Tests\TestCase { const HTML_STUB = '<!DOCTYPE html><html><head><title>test</title></head><body>%s</body></html>'; diff --git a/test/HTML5/Serializer/OutputRulesTest.php b/test/HTML5/Serializer/OutputRulesTest.php index 8e610fd..daae43a 100644 --- a/test/HTML5/Serializer/OutputRulesTest.php +++ b/test/HTML5/Serializer/OutputRulesTest.php @@ -1,11 +1,11 @@ <?php -namespace HTML5\Tests\Serializer; +namespace Masterminds\HTML5\Tests\Serializer; -use \HTML5\Serializer\OutputRules; -use \HTML5\Serializer\Traverser; -use \HTML5\Parser; +use Masterminds\HTML5\Serializer\OutputRules; +use Masterminds\HTML5\Serializer\Traverser; +use Masterminds\HTML5\Parser; -class OutputRulesTest extends \HTML5\Tests\TestCase { +class OutputRulesTest extends \Masterminds\HTML5\Tests\TestCase { protected $markup = '<!doctype html> <html lang="en"> @@ -31,14 +31,14 @@ class OutputRulesTest extends \HTML5\Tests\TestCase { * \ReflectionMethod for the specified method */ function getProtectedMethod($name) { - $class = new \ReflectionClass('\HTML5\Serializer\OutputRules'); + $class = new \ReflectionClass('\Masterminds\HTML5\Serializer\OutputRules'); $method = $class->getMethod($name); $method->setAccessible(true); return $method; } function getTraverserProtectedProperty($name) { - $class = new \ReflectionClass('\HTML5\Serializer\Traverser'); + $class = new \ReflectionClass('\Masterminds\HTML5\Serializer\Traverser'); $property = $class->getProperty($name); $property->setAccessible(true); return $property; diff --git a/test/HTML5/Serializer/TraverserTest.php b/test/HTML5/Serializer/TraverserTest.php index c63ea2b..2fecc9c 100644 --- a/test/HTML5/Serializer/TraverserTest.php +++ b/test/HTML5/Serializer/TraverserTest.php @@ -1,11 +1,11 @@ <?php -namespace HTML5\Tests\Serializer; +namespace Masterminds\HTML5\Tests\Serializer; -use \HTML5\Serializer\OutputRules; -use \HTML5\Serializer\Traverser; -use \HTML5\Parser; +use Masterminds\HTML5\Serializer\OutputRules; +use Masterminds\HTML5\Serializer\Traverser; +use Masterminds\HTML5\Parser; -class TraverserTest extends \HTML5\Tests\TestCase { +class TraverserTest extends \Masterminds\HTML5\Tests\TestCase { protected $markup = '<!doctype html> <html lang="en"> @@ -31,7 +31,7 @@ class TraverserTest extends \HTML5\Tests\TestCase { * \ReflectionMethod for the specified method */ function getProtectedMethod($name) { - $class = new \ReflectionClass('\HTML5\Serializer\Traverser'); + $class = new \ReflectionClass('\Masterminds\HTML5\Serializer\Traverser'); $method = $class->getMethod($name); $method->setAccessible(true); return $method; @@ -60,12 +60,12 @@ class TraverserTest extends \HTML5\Tests\TestCase { $t = new Traverser($dom, $stream, $r, $html5->getOptions()); - $this->assertInstanceOf('\HTML5\Serializer\Traverser', $t); + $this->assertInstanceOf('\Masterminds\HTML5\Serializer\Traverser', $t); } function testFragment() { $html = '<span class="bar">foo</span><span></span><div>bar</div>'; - $input = new \HTML5\Parser\StringInputStream($html); + $input = new \Masterminds\HTML5\Parser\StringInputStream($html); $dom = $this->html5->parseFragment($input); $this->assertInstanceOf('\DOMDocumentFragment', $dom); @@ -80,7 +80,7 @@ class TraverserTest extends \HTML5\Tests\TestCase { function testProcessorInstruction() { $html = '<?foo bar ?>'; - $input = new \HTML5\Parser\StringInputStream($html); + $input = new \Masterminds\HTML5\Parser\StringInputStream($html); $dom = $this->html5->parseFragment($input); $this->assertInstanceOf('\DOMDocumentFragment', $dom); diff --git a/test/HTML5/TestCase.php b/test/HTML5/TestCase.php index 7e98498..56d2eae 100644 --- a/test/HTML5/TestCase.php +++ b/test/HTML5/TestCase.php @@ -1,6 +1,7 @@ <?php -namespace HTML5\Tests; +namespace Masterminds\HTML5\Tests; +use Masterminds\HTML5; class TestCase extends \PHPUnit_Framework_TestCase { const DOC_OPEN = '<!DOCTYPE html><html><head><title>test</title></head><body>'; const DOC_CLOSE = '</body></html>'; @@ -11,7 +12,7 @@ class TestCase extends \PHPUnit_Framework_TestCase { public function getInstance(array $options = array()) { - return new \HTML5($options); + return new HTML5($options); } protected function wrap($fragment) { |