Browse Source

Fixed gitignore

wrapper-classes
Dustin Wilson 3 years ago
parent
commit
4c95ec0086
  1. 4
      .gitignore
  2. 42
      tests/cases/TestDocument.php

4
.gitignore

@ -1,8 +1,8 @@
# html5-parser specific
manual
node_modules
test*.html
test*.php
/test*.html
/test*.php
# General
*.DS_Store

42
tests/cases/TestDocument.php

@ -0,0 +1,42 @@
<?php
/** @license MIT
* Copyright 2017 , Dustin Wilson, J. King et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace MensBeam\HTML\DOM\TestCase;
use MensBeam\HTML\DOM\{
Document,
DOMException,
Element,
Exception,
HTMLTemplateElement
};
use MensBeam\HTML\Parser;
class TestDocument extends \PHPUnit\Framework\TestCase {
/**
* @covers \MensBeam\HTML\DOM\Document::__construct
* @covers \MensBeam\HTML\DOM\Document::loadDOM
* @covers \MensBeam\HTML\DOM\Document::loadHTML
*/
public function testDocumentCreation(): void {
// Test null source
$d = new Document();
$this->assertSame('MensBeam\HTML\DOM\Document', $d::class);
$this->assertSame(null, $d->firstChild);
// Test string source
$d = new Document('<html><body>Ook!</body></html>');
$this->assertSame(Parser::QUIRKS_MODE, $d->quirksMode);
// Test DOM source
$d = new \DOMDocument();
$d->appendChild($d->createElement('html'));
$d = new Document($d);
$this->assertSame('MensBeam\HTML\DOM\Element', $d->firstChild::class);
$this->assertSame('html', $d->firstChild->nodeName);
}
}
Loading…
Cancel
Save