Browse Source

Change namespace; add copyright info

ns
J. King 3 years ago
parent
commit
d33929f4a1
  1. 4
      README.md
  2. 10
      RoboFile.php
  3. 13
      composer.json
  4. 71
      composer.lock
  5. 6
      lib/ActiveFormattingElementsList.php
  6. 6
      lib/CharacterReference.php
  7. 6
      lib/Charset.php
  8. 6
      lib/DOM/Comment.php
  9. 6
      lib/DOM/DOMException.php
  10. 16
      lib/DOM/Document.php
  11. 6
      lib/DOM/DocumentFragment.php
  12. 6
      lib/DOM/Element.php
  13. 6
      lib/DOM/ProcessingInstruction.php
  14. 6
      lib/DOM/Text.php
  15. 6
      lib/DOM/traits/EscapeString.php
  16. 8
      lib/DOM/traits/Moonwalk.php
  17. 6
      lib/DOM/traits/Serialize.php
  18. 8
      lib/DOM/traits/Walk.php
  19. 6
      lib/Data.php
  20. 6
      lib/Exception.php
  21. 8
      lib/LoopException.php
  22. 8
      lib/NotImplementedException.php
  23. 12
      lib/OpenElementsStack.php
  24. 6
      lib/ParseError.php
  25. 6
      lib/ParseErrorDummy.php
  26. 6
      lib/ParseErrorEmitter.php
  27. 6
      lib/Parser.php
  28. 6
      lib/Stack.php
  29. 6
      lib/TemplateInsertionModesStack.php
  30. 6
      lib/Token.php
  31. 6
      lib/Tokenizer.php
  32. 16
      lib/TreeBuilder.php
  33. 6
      lib/ctype.php
  34. 6
      tests/bootstrap.php
  35. 14
      tests/cases/TestCharset.php
  36. 52
      tests/cases/TestTokenizer.php
  37. 52
      tests/cases/TestTreeConstructor.php

4
README.md

@ -4,7 +4,7 @@ Tools for parsing and printing HTML5 documents and fragments.
```php
<?php
$dom = dW\HTML5\Parser::parse('<!DOCTYPE html><html lang="en" charset="utf-8"><head><title>Ook!</title></head><body><h1>Ook!</h1><p>Ook-ook? Oooook. Ook ook oook ook oooooook ook ooook ook.</p><p>Eek!</p></body></html>');
$dom = MensBeam\HTML\Parser::parse('<!DOCTYPE html><html lang="en" charset="utf-8"><head><title>Ook!</title></head><body><h1>Ook!</h1><p>Ook-ook? Oooook. Ook ook oook ook oooooook ook ooook ook.</p><p>Eek!</p></body></html>');
?>
```
@ -12,7 +12,7 @@ or:
```php
<?php
$dom = new dW\HTML5\Document;
$dom = new MensBeam\HTML\Document;
$dom->loadHTML('<!DOCTYPE html><html lang="en" charset="utf-8"><head><title>Ook!</title></head><body><h1>Ook!</h1><p>Ook-ook? Oooook. Ook ook oook ook oooooook ook ooook ook.</p><p>Eek!</p></body></html>');
?>
```

10
RoboFile.php

@ -1,4 +1,8 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
use Robo\Result;
@ -158,8 +162,12 @@ class RoboFile extends \Robo\Tasks {
public function charref() {
$template = <<<'FILE'
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
// This file is machine-generated
// DO NOT MODIFY

13
composer.json

@ -1,6 +1,6 @@
{
"name": "dw/html5",
"description": "Parses HTML5 text into a php DOMDocument",
"name": "mensbeam/html",
"description": "Parses modern HTML text into a PHP DOMDocument",
"type": "library",
"require": {
"php": ">=7.1",
@ -30,7 +30,7 @@
],
"autoload": {
"psr-4": {
"dW\\HTML5\\": [
"MensBeam\\HTML\\": [
"lib/",
"lib/DOM",
"lib/DOM/traits"
@ -41,11 +41,12 @@
},
"autoload-dev": {
"psr-4": {
"dW\\HTML5\\Test\\": "tests/lib/",
"dW\\HTML5\\TestCase\\": "tests/cases/"
"MensBeam\\HTML\\Test\\": "tests/lib/",
"MensBeam\\HTML\\TestCase\\": "tests/cases/"
}
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.3"
"bamarni/composer-bin-plugin": "^1.3",
"masterminds/html5": "^2.7"
}
}

71
composer.lock

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "5f4a7551d02d81eab14be7032885b348",
"content-hash": "e86b71182b086317ce6aab564b4254b9",
"packages": [
{
"name": "mensbeam/intl",
@ -216,6 +216,75 @@
"source": "https://github.com/bamarni/composer-bin-plugin/tree/master"
},
"time": "2020-05-03T08:27:20+00:00"
},
{
"name": "masterminds/html5",
"version": "2.7.4",
"source": {
"type": "git",
"url": "https://github.com/Masterminds/html5-php.git",
"reference": "9227822783c75406cfe400984b2f095cdf03d417"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Masterminds/html5-php/zipball/9227822783c75406cfe400984b2f095cdf03d417",
"reference": "9227822783c75406cfe400984b2f095cdf03d417",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"ext-dom": "*",
"ext-libxml": "*",
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
}
},
"autoload": {
"psr-4": {
"Masterminds\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Matt Butcher",
"email": "technosophos@gmail.com"
},
{
"name": "Matt Farina",
"email": "matt@mattfarina.com"
},
{
"name": "Asmir Mustafic",
"email": "goetas@gmail.com"
}
],
"description": "An HTML5 parser and serializer.",
"homepage": "http://masterminds.github.io/html5-php",
"keywords": [
"HTML5",
"dom",
"html",
"parser",
"querypath",
"serializer",
"xml"
],
"support": {
"issues": "https://github.com/Masterminds/html5-php/issues",
"source": "https://github.com/Masterminds/html5-php/tree/2.7.4"
},
"time": "2020-10-01T13:52:52+00:00"
}
],
"aliases": [],

6
lib/ActiveFormattingElementsList.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
# 8.2.3.3. The list of active formatting elements
# Initially, the list of active formatting elements is empty. It is used to

6
lib/CharacterReference.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
// This file is machine-generated
// DO NOT MODIFY

6
lib/Charset.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
use MensBeam\Intl\Encoding;
use MensBeam\Mime\MimeType;

6
lib/DOM/Comment.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
class Comment extends \DOMComment {
use Moonwalk;

6
lib/DOM/DOMException.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
class DOMException extends \Exception {
// From PHP's DOMException; keeping error codes consistent

16
lib/DOM/Document.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
class Document extends \DOMDocument {
use EscapeString, Moonwalk, Serialize, Walk;
@ -24,11 +28,11 @@ class Document extends \DOMDocument {
public function __construct() {
parent::__construct();
$this->registerNodeClass('DOMComment', '\dW\HTML5\Comment');
$this->registerNodeClass('DOMDocumentFragment', '\dW\HTML5\DocumentFragment');
$this->registerNodeClass('DOMElement', '\dW\HTML5\Element');
$this->registerNodeClass('DOMProcessingInstruction', '\dW\HTML5\ProcessingInstruction');
$this->registerNodeClass('DOMText', '\dW\HTML5\Text');
$this->registerNodeClass('DOMComment', '\MensBeam\HTML\Comment');
$this->registerNodeClass('DOMDocumentFragment', '\MensBeam\HTML\DocumentFragment');
$this->registerNodeClass('DOMElement', '\MensBeam\HTML\Element');
$this->registerNodeClass('DOMProcessingInstruction', '\MensBeam\HTML\ProcessingInstruction');
$this->registerNodeClass('DOMText', '\MensBeam\HTML\Text');
}
public function createAttribute($name) {

6
lib/DOM/DocumentFragment.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
class DocumentFragment extends \DOMDocumentFragment {
use Moonwalk, Serialize;

6
lib/DOM/Element.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
class Element extends \DOMElement {
use EscapeString, Moonwalk, Serialize, Walk;

6
lib/DOM/ProcessingInstruction.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
class ProcessingInstruction extends \DOMProcessingInstruction {
use Moonwalk;

6
lib/DOM/Text.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
class Text extends \DOMText {
use EscapeString, Moonwalk;

6
lib/DOM/traits/EscapeString.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
use MensBeam\Intl\Encoding\UTF8;

8
lib/DOM/traits/Moonwalk.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
trait Moonwalk {
public function moonwalk(\Closure $filter): \Generator {
@ -14,4 +18,4 @@ trait Moonwalk {
}
} while ($node = $node->parentNode);
}
}
}

6
lib/DOM/traits/Serialize.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
trait Serialize {
protected static $voidElements = [ 'area', 'base', 'basefont', 'bgsound', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr' ];

8
lib/DOM/traits/Walk.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
trait Walk {
public function walk(\Closure $filter): \Generator {
@ -19,4 +23,4 @@ trait Walk {
}
}
}
}
}

6
lib/Data.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
use MensBeam\Intl\Encoding;
use MensBeam\Intl\Encoding\Encoding as EncodingEncoding;

6
lib/Exception.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
class Exception extends \Exception {
const INVALID_CODE = 100;

8
lib/LoopException.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
class LoopException extends \Exception {
}
}

8
lib/NotImplementedException.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
class NotImplementedException extends \Exception {
}
}

12
lib/OpenElementsStack.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
class OpenElementsStack extends Stack {
protected const IMPLIED_END_TAGS = [
@ -85,15 +89,15 @@ class OpenElementsStack extends Stack {
],
];
/** @var ?\dW\HTML5\Element */
/** @var ?\MensBeam\HTML\Element */
protected $fragmentContext = null;
/** @var ?\dW\HTML5\Element */
/** @var ?\MensBeam\HTML\Element */
public $currentNode = null;
/** @var ?string */
public $currentNodeName = null;
/** @var ?string */
public $currentNodeNamespace = null;
/** @var ?\dW\HTML5\Element */
/** @var ?\MensBeam\HTML\Element */
public $adjustedCurrentNode = null;
/** @var ?string */
public $adjustedCurrentNodeName = null;

6
lib/ParseError.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
class ParseError {
// tokenization parse errors; these have been standardized

6
lib/ParseErrorDummy.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
class ParseErrorDummy extends ParseError {
public function setHandler() {

6
lib/ParseErrorEmitter.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
trait ParseErrorEmitter {
/** @var ParseError $errorHandler */

6
lib/Parser.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
class Parser {
public static $fallbackEncoding = "windows-1252";

6
lib/Stack.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
abstract class Stack implements \ArrayAccess, \Countable, \IteratorAggregate {
protected $_storage = [];

6
lib/TemplateInsertionModesStack.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
class TemplateInsertionModesStack extends Stack {
public function __get($property) {

6
lib/Token.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
abstract class Token {}

6
lib/Tokenizer.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
use MensBeam\Intl\Encoding\UTF8;

16
lib/TreeBuilder.php

@ -1,15 +1,19 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
class TreeBuilder {
use ParseErrorEmitter, EscapeString;
public $debugLog = "";
/** @var \dW\HTML5\ActiveFormattingElementsList The list of active formatting elements, used when elements are improperly nested */
/** @var \MensBeam\HTML\ActiveFormattingElementsList The list of active formatting elements, used when elements are improperly nested */
protected $activeFormattingElementsList;
/** @var \dW\HTML5\Document The DOMDocument that is assembled by this class */
/** @var \MensBeam\HTML\Document The DOMDocument that is assembled by this class */
protected $DOM;
/** @var ?\DOMElement The form element pointer points to the last form element that was opened and whose end tag has not yet been seen. It is used to make form controls associate with forms in the face of dramatically bad markup, for historical reasons. It is ignored inside template elements */
protected $formElement;
@ -25,13 +29,13 @@ class TreeBuilder {
protected $insertionMode = self::INITIAL_MODE;
/** @var int When the insertion mode is switched to "text" or "in table text", the original insertion mode is also set. This is the insertion mode to which the tree construction stage will return. */
protected $originalInsertionMode;
/** @var \dW\HTML5\OpenElementsStack The stack of open elements, uses Stack */
/** @var \MensBeam\HTML\OpenElementsStack The stack of open elements, uses Stack */
protected $stack;
/** @var \dW\HTML5\Data Instance of the Data class used for reading the input character-stream */
/** @var \MensBeam\HTML\Data Instance of the Data class used for reading the input character-stream */
protected $data;
/** @var \Generator Instance of the Tokenizer class used for creating tokens */
protected $tokenizer;
/** @var \dW\HTML5\TemplateInsertionModesStack Used to store the template insertion modes */
/** @var \MensBeam\HTML\TemplateInsertionModesStack Used to store the template insertion modes */
protected $templateInsertionModes;
/** @var array An array holding character tokens which may need to be foster-parented during table parsing */
protected $pendingTableCharacterTokens = [];

6
lib/ctype.php

@ -1,5 +1,9 @@
<?php
namespace dW\HTML5;
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
namespace MensBeam\HTML;
// This file adds shims for matching single characters
// using the same API as the ctype extension, if the

6
tests/bootstrap.php

@ -1,6 +1,10 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5;
namespace MensBeam\HTML;
const NS_BASE = __NAMESPACE__."\\";
define(NS_BASE."BASE", dirname(__DIR__).DIRECTORY_SEPARATOR);

14
tests/cases/TestCharset.php

@ -1,11 +1,15 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5\TestCase;
namespace MensBeam\HTML\TestCase;
use dW\HTML5\Charset;
use MensBeam\HTML\Charset;
/**
* @covers \dW\HTML5\Charset
* @covers \MensBeam\HTML\Charset
*/
class TestCharset extends \PHPUnit\Framework\TestCase {
/** @dataProvider provideCharsets */
@ -69,8 +73,8 @@ class TestCharset extends \PHPUnit\Framework\TestCase {
$tests = [];
$blacklist = [];
$files = new \AppendIterator();
$files->append(new \GlobIterator(\dW\HTML5\BASE."tests/html5lib-tests/encoding/*.dat", \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::CURRENT_AS_PATHNAME));
$files->append(new \GlobIterator(\dW\HTML5\BASE."tests/cases/encoding/*.dat", \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::CURRENT_AS_PATHNAME));
$files->append(new \GlobIterator(\MensBeam\HTML\BASE."tests/html5lib-tests/encoding/*.dat", \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::CURRENT_AS_PATHNAME));
$files->append(new \GlobIterator(\MensBeam\HTML\BASE."tests/cases/encoding/*.dat", \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::CURRENT_AS_PATHNAME));
foreach ($files as $file) {
if (!in_array(basename($file), $blacklist)) {
$tests[] = $file;

52
tests/cases/TestTokenizer.php

@ -1,30 +1,34 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5\TestCase;
namespace MensBeam\HTML\TestCase;
use dW\HTML5\Data;
use dW\HTML5\EOFToken;
use dW\HTML5\OpenElementsStack;
use dW\HTML5\ParseError;
use dW\HTML5\Tokenizer;
use dW\HTML5\CharacterToken;
use dW\HTML5\CommentToken;
use dW\HTML5\DOCTYPEToken;
use dW\HTML5\EndTagToken;
use dW\HTML5\NullCharacterToken;
use dW\HTML5\StartTagToken;
use dW\HTML5\TokenAttr;
use dW\HTML5\WhitespaceToken;
use MensBeam\HTML\Data;
use MensBeam\HTML\EOFToken;
use MensBeam\HTML\OpenElementsStack;
use MensBeam\HTML\ParseError;
use MensBeam\HTML\Tokenizer;
use MensBeam\HTML\CharacterToken;
use MensBeam\HTML\CommentToken;
use MensBeam\HTML\DOCTYPEToken;
use MensBeam\HTML\EndTagToken;
use MensBeam\HTML\NullCharacterToken;
use MensBeam\HTML\StartTagToken;
use MensBeam\HTML\TokenAttr;
use MensBeam\HTML\WhitespaceToken;
/**
* @covers \dW\HTML5\Data
* @covers \dW\HTML5\Tokenizer
* @covers \dW\HTML5\CharacterToken
* @covers \dW\HTML5\CommentToken
* @covers \dW\HTML5\DataToken
* @covers \dW\HTML5\TagToken
* @covers \dW\HTML5\DOCTYPEToken
* @covers \dW\HTML5\TokenAttr
* @covers \MensBeam\HTML\Data
* @covers \MensBeam\HTML\Tokenizer
* @covers \MensBeam\HTML\CharacterToken
* @covers \MensBeam\HTML\CommentToken
* @covers \MensBeam\HTML\DataToken
* @covers \MensBeam\HTML\TagToken
* @covers \MensBeam\HTML\DOCTYPEToken
* @covers \MensBeam\HTML\TokenAttr
*/
class TestTokenizer extends \PHPUnit\Framework\TestCase {
const STATE_MAP = [
@ -83,8 +87,8 @@ class TestTokenizer extends \PHPUnit\Framework\TestCase {
$tests = [];
$blacklist = ["xmlViolation.test"];
$files = new \AppendIterator();
$files->append(new \GlobIterator(\dW\HTML5\BASE."tests/html5lib-tests/tokenizer/*.test", \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::CURRENT_AS_PATHNAME));
$files->append(new \GlobIterator(\dW\HTML5\BASE."tests/cases/tokenizer/*.test", \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::CURRENT_AS_PATHNAME));
$files->append(new \GlobIterator(\MensBeam\HTML\BASE."tests/html5lib-tests/tokenizer/*.test", \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::CURRENT_AS_PATHNAME));
$files->append(new \GlobIterator(\MensBeam\HTML\BASE."tests/cases/tokenizer/*.test", \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::CURRENT_AS_PATHNAME));
foreach ($files as $file) {
if (!in_array(basename($file), $blacklist)) {
$tests[] = $file;

52
tests/cases/TestTreeConstructor.php

@ -1,32 +1,36 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\HTML5\TestCase;
namespace MensBeam\HTML\TestCase;
use dW\HTML5\Data;
use dW\HTML5\Document;
use dW\HTML5\EOFToken;
use dW\HTML5\LoopException;
use dW\HTML5\NotImplementedException;
use dW\HTML5\OpenElementsStack;
use dW\HTML5\ParseError;
use dW\HTML5\Parser;
use dW\HTML5\TemplateInsertionModesStack;
use dW\HTML5\Tokenizer;
use dW\HTML5\TreeBuilder;
use MensBeam\HTML\Data;
use MensBeam\HTML\Document;
use MensBeam\HTML\EOFToken;
use MensBeam\HTML\LoopException;
use MensBeam\HTML\NotImplementedException;
use MensBeam\HTML\OpenElementsStack;
use MensBeam\HTML\ParseError;
use MensBeam\HTML\Parser;
use MensBeam\HTML\TemplateInsertionModesStack;
use MensBeam\HTML\Tokenizer;
use MensBeam\HTML\TreeBuilder;
/**
* @covers \dW\HTML5\Document
* @covers \dW\HTML5\Element
* @covers \dW\HTML5\Tokenizer
* @covers \dW\HTML5\TreeBuilder
* @covers \dW\HTML5\ActiveFormattingElementsList
* @covers \dW\HTML5\TemplateInsertionModesStack
* @covers \dW\HTML5\OpenElementsStack
* @covers \dW\HTML5\Stack
* @covers \dW\HTML5\TagToken
* @covers \MensBeam\HTML\Document
* @covers \MensBeam\HTML\Element
* @covers \MensBeam\HTML\Tokenizer
* @covers \MensBeam\HTML\TreeBuilder
* @covers \MensBeam\HTML\ActiveFormattingElementsList
* @covers \MensBeam\HTML\TemplateInsertionModesStack
* @covers \MensBeam\HTML\OpenElementsStack
* @covers \MensBeam\HTML\Stack
* @covers \MensBeam\HTML\TagToken
*/
class TestTreeConstructor extends \PHPUnit\Framework\TestCase {
use \dW\HTML5\EscapeString;
use \MensBeam\HTML\EscapeString;
protected $out;
protected $depth;
@ -376,8 +380,8 @@ class TestTreeConstructor extends \PHPUnit\Framework\TestCase {
public function provideStandardTreeTests(): iterable {
$blacklist = [];
$files = new \AppendIterator();
$files->append(new \GlobIterator(\dW\HTML5\BASE."tests/html5lib-tests/tree-construction/*.dat", \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::CURRENT_AS_PATHNAME));
$files->append(new \GlobIterator(\dW\HTML5\BASE."tests/cases/tree-construction/*.dat", \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::CURRENT_AS_PATHNAME));
$files->append(new \GlobIterator(\MensBeam\HTML\BASE."tests/html5lib-tests/tree-construction/*.dat", \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::CURRENT_AS_PATHNAME));
$files->append(new \GlobIterator(\MensBeam\HTML\BASE."tests/cases/tree-construction/*.dat", \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::CURRENT_AS_PATHNAME));
foreach ($files as $file) {
$index = 0;
$l = 0;

Loading…
Cancel
Save