Joby Elliott
4bff7f2f87
Brought phpstan and phpunit versions up, and fixed phpunit deprecations. I just deleted a bunch of tests of abstract classes, because phpunit has deprecated it and that stuff should all be getting tested every which way downstream anyway.
46 lines
1.8 KiB
PHP
46 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace ByJoby\HTML\Html5;
|
|
|
|
use ByJoby\HTML\Containers\DocumentTags\BodyTagInterface;
|
|
use ByJoby\HTML\Containers\DocumentTags\DoctypeInterface;
|
|
use ByJoby\HTML\Containers\DocumentTags\HeadTagInterface;
|
|
use ByJoby\HTML\Containers\DocumentTags\HtmlTagInterface;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class GenericHtmlDocumentTest extends TestCase
|
|
{
|
|
public function testConstruction(): void
|
|
{
|
|
$document = new Html5Document;
|
|
// all the right classes
|
|
$this->assertInstanceOf(DoctypeInterface::class, $document->doctype());
|
|
$this->assertInstanceOf(HtmlTagInterface::class, $document->html());
|
|
$this->assertInstanceOf(BodyTagInterface::class, $document->body());
|
|
$this->assertInstanceOf(HeadTagInterface::class, $document->head());
|
|
// body and head are being passed properly
|
|
$this->assertEquals($document->body(), $document->html()->body());
|
|
$this->assertEquals($document->head(), $document->html()->head());
|
|
// everything has the correct document
|
|
$this->assertEquals($document, $document->doctype()->parentDocument());
|
|
$this->assertEquals($document, $document->html()->parentDocument());
|
|
$this->assertEquals($document, $document->body()->parentDocument());
|
|
$this->assertEquals($document, $document->head()->parentDocument());
|
|
// string version of an empty document
|
|
$this->assertEquals(
|
|
implode(
|
|
PHP_EOL,
|
|
[
|
|
'<!DOCTYPE html>',
|
|
'<html>',
|
|
'<head>',
|
|
'<title>Untitled</title>',
|
|
'</head>',
|
|
'<body></body>',
|
|
'</html>'
|
|
]
|
|
),
|
|
$document->__toString()
|
|
);
|
|
}
|
|
}
|