diff --git a/src/Test/TestCase.php b/src/Test/TestCase.php
new file mode 100644
index 00000000..ed98434c
--- /dev/null
+++ b/src/Test/TestCase.php
@@ -0,0 +1,43 @@
+render();
+
+ $expectedDom = new DOMDocument();
+ $this->assertTrue($expectedDom->loadHTML($expectedHtml), 'Expected HTML is not valid');
+ $actualDom = new DOMDocument();
+ $this->assertTrue($actualDom->loadHTML($actualHtml), 'Actual HTML is not valid');
+
+ $this->assertEquals($expectedDom, $actualDom);
+ }
+
+ /**
+ * @deprecated Use {@link assertHtml()} instead. assertRendersHtml() suffers from the fact that the HTML being
+ * processed must have a root node, e.g. the HTML `foobar` would always fail with "Extra content at
+ * the end of the document". {@link assertHtml()} just does the job.
+ */
+ protected function assertRendersHtml(string $html, ValidHtml $element): void
+ {
+ $this->assertXmlStringEqualsXmlString($html, $element->render());
+ }
+}
diff --git a/tests/AttributeTest.php b/tests/AttributeTest.php
index 18fc5a4e..aa512ebb 100644
--- a/tests/AttributeTest.php
+++ b/tests/AttributeTest.php
@@ -3,6 +3,7 @@
namespace ipl\Tests\Html;
use ipl\Html\Attribute;
+use ipl\Html\Test\TestCase;
class AttributeTest extends TestCase
{
diff --git a/tests/AttributesTest.php b/tests/AttributesTest.php
index 8ce23e8b..82579042 100644
--- a/tests/AttributesTest.php
+++ b/tests/AttributesTest.php
@@ -6,6 +6,7 @@
use ipl\Html\Attributes;
use ipl\Html\BaseHtmlElement;
use ipl\Html\HtmlString;
+use ipl\Html\Test\TestCase;
use ipl\Html\ValidHtml;
class AttributesTest extends TestCase
diff --git a/tests/BaseHtmlElementTest.php b/tests/BaseHtmlElementTest.php
index cd3b5699..98d3c12a 100644
--- a/tests/BaseHtmlElementTest.php
+++ b/tests/BaseHtmlElementTest.php
@@ -4,6 +4,7 @@
use ipl\Html\BaseHtmlElement;
use ipl\Html\HtmlString;
+use ipl\Html\Test\TestCase;
use RuntimeException;
class BaseHtmlElementTest extends TestCase
diff --git a/tests/DeferredTextTest.php b/tests/DeferredTextTest.php
index e926dfe6..1b61539f 100644
--- a/tests/DeferredTextTest.php
+++ b/tests/DeferredTextTest.php
@@ -3,6 +3,7 @@
namespace ipl\Tests\Html;
use ipl\Html\DeferredText;
+use ipl\Html\Test\TestCase;
use Exception;
class DeferredTextTest extends TestCase
diff --git a/tests/DocumentationFormsTest.php b/tests/DocumentationFormsTest.php
index 371bbbab..d8048a08 100644
--- a/tests/DocumentationFormsTest.php
+++ b/tests/DocumentationFormsTest.php
@@ -5,6 +5,7 @@
use ipl\Html\Form;
use ipl\Html\FormElement\TextElement;
use ipl\Html\Html;
+use ipl\Html\Test\TestCase;
class DocumentationFormsTest extends TestCase
{
diff --git a/tests/DocumentationQuickStartTest.php b/tests/DocumentationQuickStartTest.php
index defc275d..5eecf10e 100644
--- a/tests/DocumentationQuickStartTest.php
+++ b/tests/DocumentationQuickStartTest.php
@@ -3,6 +3,7 @@
namespace ipl\Tests\Html;
use ipl\Html\Html;
+use ipl\Html\Test\TestCase;
class DocumentationQuickStartTest extends TestCase
{
diff --git a/tests/DocumentationTablesTest.php b/tests/DocumentationTablesTest.php
index 2f955aa8..2ca22903 100644
--- a/tests/DocumentationTablesTest.php
+++ b/tests/DocumentationTablesTest.php
@@ -3,6 +3,7 @@
namespace ipl\Tests\Html;
use ipl\Html\Table;
+use ipl\Html\Test\TestCase;
class DocumentationTablesTest extends TestCase
{
diff --git a/tests/FormDecorator/DecorationResultsTest.php b/tests/FormDecorator/DecorationResultsTest.php
index adf3e93a..47632e65 100644
--- a/tests/FormDecorator/DecorationResultsTest.php
+++ b/tests/FormDecorator/DecorationResultsTest.php
@@ -5,7 +5,7 @@
use ipl\Html\FormDecoration\FormElementDecorationResult;
use ipl\Html\FormDecoration\Transformation;
use ipl\Html\Html;
-use ipl\Tests\Html\TestCase;
+use ipl\Html\Test\TestCase;
class DecorationResultsTest extends TestCase
{
diff --git a/tests/FormDecorator/DecoratorChainTest.php b/tests/FormDecorator/DecoratorChainTest.php
index df885626..af35042d 100644
--- a/tests/FormDecorator/DecoratorChainTest.php
+++ b/tests/FormDecorator/DecoratorChainTest.php
@@ -6,7 +6,7 @@
use ipl\Html\FormDecoration\DecoratorChain;
use ipl\Html\Contract\FormElementDecoration;
use ipl\Html\HtmlDocument;
-use ipl\Tests\Html\TestCase;
+use ipl\Html\Test\TestCase;
use ValueError;
class DecoratorChainTest extends TestCase
diff --git a/tests/FormDecorator/DescriptionDecoratorTest.php b/tests/FormDecorator/DescriptionDecoratorTest.php
index 6e4146cf..60efd59a 100644
--- a/tests/FormDecorator/DescriptionDecoratorTest.php
+++ b/tests/FormDecorator/DescriptionDecoratorTest.php
@@ -7,7 +7,7 @@
use ipl\Html\FormDecoration\DescriptionDecorator;
use ipl\Html\FormElement\FieldsetElement;
use ipl\Html\FormElement\TextElement;
-use ipl\Tests\Html\TestCase;
+use ipl\Html\Test\TestCase;
class DescriptionDecoratorTest extends TestCase
{
diff --git a/tests/FormDecorator/ErrorsDecoratorTest.php b/tests/FormDecorator/ErrorsDecoratorTest.php
index 9888a4d2..a4abce14 100644
--- a/tests/FormDecorator/ErrorsDecoratorTest.php
+++ b/tests/FormDecorator/ErrorsDecoratorTest.php
@@ -6,7 +6,7 @@
use ipl\Html\FormDecoration\FormElementDecorationResult;
use ipl\Html\FormDecoration\ErrorsDecorator;
use ipl\Html\FormElement\TextElement;
-use ipl\Tests\Html\TestCase;
+use ipl\Html\Test\TestCase;
class ErrorsDecoratorTest extends TestCase
{
diff --git a/tests/FormDecorator/FieldsetDecoratorTest.php b/tests/FormDecorator/FieldsetDecoratorTest.php
index b83388e4..a6ccce84 100644
--- a/tests/FormDecorator/FieldsetDecoratorTest.php
+++ b/tests/FormDecorator/FieldsetDecoratorTest.php
@@ -7,7 +7,7 @@
use ipl\Html\FormDecoration\FieldsetDecorator;
use ipl\Html\FormElement\FieldsetElement;
use ipl\Html\FormElement\TextElement;
-use ipl\Tests\Html\TestCase;
+use ipl\Html\Test\TestCase;
class FieldsetDecoratorTest extends TestCase
{
diff --git a/tests/FormDecorator/FormDecorationResultTest.php b/tests/FormDecorator/FormDecorationResultTest.php
index ae4f0d42..d82db75a 100644
--- a/tests/FormDecorator/FormDecorationResultTest.php
+++ b/tests/FormDecorator/FormDecorationResultTest.php
@@ -5,7 +5,7 @@
use ipl\Html\Form;
use ipl\Html\FormDecoration\FormDecorationResult;
use ipl\Html\Html;
-use ipl\Tests\Html\TestCase;
+use ipl\Html\Test\TestCase;
class FormDecorationResultTest extends TestCase
{
diff --git a/tests/FormDecorator/FormDecorationTest.php b/tests/FormDecorator/FormDecorationTest.php
index 5f1f2f1e..05daaa8c 100644
--- a/tests/FormDecorator/FormDecorationTest.php
+++ b/tests/FormDecorator/FormDecorationTest.php
@@ -9,7 +9,7 @@
use ipl\Html\Contract\FormElementDecoration;
use ipl\Html\FormDecoration\Transformation;
use ipl\Html\Html;
-use ipl\Tests\Html\TestCase;
+use ipl\Html\Test\TestCase;
class FormDecorationTest extends TestCase
{
diff --git a/tests/FormDecorator/FormElementDecorationTest.php b/tests/FormDecorator/FormElementDecorationTest.php
index 49480ed1..a45a560d 100644
--- a/tests/FormDecorator/FormElementDecorationTest.php
+++ b/tests/FormDecorator/FormElementDecorationTest.php
@@ -4,7 +4,7 @@
use ipl\Html\Form;
use ipl\Html\FormElement\TextElement;
-use ipl\Tests\Html\TestCase;
+use ipl\Html\Test\TestCase;
use ipl\Tests\Html\TestDummy\SimpleFormElementDecorator;
use RuntimeException;
diff --git a/tests/FormDecorator/HtmlTagDecoratorTest.php b/tests/FormDecorator/HtmlTagDecoratorTest.php
index c896d9f7..e5656116 100644
--- a/tests/FormDecorator/HtmlTagDecoratorTest.php
+++ b/tests/FormDecorator/HtmlTagDecoratorTest.php
@@ -8,7 +8,7 @@
use ipl\Html\FormDecoration\HtmlTagDecorator;
use ipl\Html\FormDecoration\Transformation;
use ipl\Html\FormElement\TextElement;
-use ipl\Tests\Html\TestCase;
+use ipl\Html\Test\TestCase;
use RuntimeException;
class HtmlTagDecoratorTest extends TestCase
diff --git a/tests/FormDecorator/LabelDecoratorTest.php b/tests/FormDecorator/LabelDecoratorTest.php
index cae1e03f..5927ff45 100644
--- a/tests/FormDecorator/LabelDecoratorTest.php
+++ b/tests/FormDecorator/LabelDecoratorTest.php
@@ -9,7 +9,7 @@
use ipl\Html\FormElement\SubmitButtonElement;
use ipl\Html\FormElement\SubmitElement;
use ipl\Html\FormElement\TextElement;
-use ipl\Tests\Html\TestCase;
+use ipl\Html\Test\TestCase;
class LabelDecoratorTest extends TestCase
{
diff --git a/tests/FormElement/CheckboxElementTest.php b/tests/FormElement/CheckboxElementTest.php
index 1a78f423..c14a5f5e 100644
--- a/tests/FormElement/CheckboxElementTest.php
+++ b/tests/FormElement/CheckboxElementTest.php
@@ -3,6 +3,7 @@
namespace ipl\Tests\Html;
use ipl\Html\FormElement\CheckboxElement;
+use ipl\Html\Test\TestCase;
use ipl\I18n\NoopTranslator;
use ipl\I18n\StaticTranslator;
diff --git a/tests/FormElement/FieldsetElementTest.php b/tests/FormElement/FieldsetElementTest.php
index 1b33c155..7a3567ea 100644
--- a/tests/FormElement/FieldsetElementTest.php
+++ b/tests/FormElement/FieldsetElementTest.php
@@ -7,7 +7,7 @@
use ipl\Html\FormElement\FieldsetElement;
use ipl\I18n\NoopTranslator;
use ipl\I18n\StaticTranslator;
-use ipl\Tests\Html\TestCase;
+use ipl\Html\Test\TestCase;
use ipl\Tests\Html\TestDummy\SimpleFormElementDecorator;
use ipl\Validator\CallbackValidator;
use LogicException;
diff --git a/tests/FormElement/FileElementTest.php b/tests/FormElement/FileElementTest.php
index 4be80eeb..8936959b 100644
--- a/tests/FormElement/FileElementTest.php
+++ b/tests/FormElement/FileElementTest.php
@@ -11,7 +11,7 @@
use ipl\I18n\NoopTranslator;
use ipl\I18n\StaticTranslator;
use ipl\Tests\Html\Lib\FileElementWithAdjustableConfig;
-use ipl\Tests\Html\TestCase;
+use ipl\Html\Test\TestCase;
use Psr\Http\Message\StreamInterface;
class FileElementTest extends TestCase
diff --git a/tests/FormElement/FormElementValidationTest.php b/tests/FormElement/FormElementValidationTest.php
index 01fdfd24..f6b48b20 100644
--- a/tests/FormElement/FormElementValidationTest.php
+++ b/tests/FormElement/FormElementValidationTest.php
@@ -7,7 +7,7 @@
use ipl\Html\FormElement\TextElement;
use ipl\I18n\NoopTranslator;
use ipl\I18n\StaticTranslator;
-use ipl\Tests\Html\TestCase;
+use ipl\Html\Test\TestCase;
use ipl\Validator\CallbackValidator;
class FormElementValidationTest extends TestCase
diff --git a/tests/FormElement/LocalDateTimeElementTest.php b/tests/FormElement/LocalDateTimeElementTest.php
index cc947544..d1aa5182 100644
--- a/tests/FormElement/LocalDateTimeElementTest.php
+++ b/tests/FormElement/LocalDateTimeElementTest.php
@@ -4,6 +4,7 @@
use DateTime;
use ipl\Html\FormElement\LocalDateTimeElement;
+use ipl\Html\Test\TestCase;
class LocalDateTimeElementTest extends TestCase
{
diff --git a/tests/FormElement/RadioElementTest.php b/tests/FormElement/RadioElementTest.php
index 5d5c90dc..8c3a5cf5 100644
--- a/tests/FormElement/RadioElementTest.php
+++ b/tests/FormElement/RadioElementTest.php
@@ -9,7 +9,7 @@
use ipl\Html\FormElement\RadioOption;
use ipl\I18n\NoopTranslator;
use ipl\I18n\StaticTranslator;
-use ipl\Tests\Html\TestCase;
+use ipl\Html\Test\TestCase;
class RadioElementTest extends TestCase
{
diff --git a/tests/FormElement/SelectElementTest.php b/tests/FormElement/SelectElementTest.php
index cf44581f..254c917d 100644
--- a/tests/FormElement/SelectElementTest.php
+++ b/tests/FormElement/SelectElementTest.php
@@ -7,7 +7,7 @@
use ipl\Html\FormElement\SelectOption;
use ipl\I18n\NoopTranslator;
use ipl\I18n\StaticTranslator;
-use ipl\Tests\Html\TestCase;
+use ipl\Html\Test\TestCase;
use UnexpectedValueException;
class SelectElementTest extends TestCase
diff --git a/tests/FormElement/SelectOptionTest.php b/tests/FormElement/SelectOptionTest.php
index 0ad3fcf4..832b4a38 100644
--- a/tests/FormElement/SelectOptionTest.php
+++ b/tests/FormElement/SelectOptionTest.php
@@ -4,7 +4,7 @@
use ipl\Html\FormElement\SelectElement;
use ipl\Html\FormElement\SelectOption;
-use ipl\Tests\Html\TestCase;
+use ipl\Html\Test\TestCase;
class SelectOptionTest extends TestCase
{
diff --git a/tests/FormElement/SubmitButtonElementTest.php b/tests/FormElement/SubmitButtonElementTest.php
index 421c8477..c7a25ca7 100644
--- a/tests/FormElement/SubmitButtonElementTest.php
+++ b/tests/FormElement/SubmitButtonElementTest.php
@@ -4,7 +4,7 @@
use ipl\Html\Form;
use ipl\Html\FormElement\SubmitButtonElement;
-use ipl\Tests\Html\TestCase;
+use ipl\Html\Test\TestCase;
class SubmitButtonElementTest extends TestCase
{
diff --git a/tests/FormElement/TextElementTest.php b/tests/FormElement/TextElementTest.php
index 026d7f8b..284da392 100644
--- a/tests/FormElement/TextElementTest.php
+++ b/tests/FormElement/TextElementTest.php
@@ -4,7 +4,7 @@
use ipl\Html\Attributes;
use ipl\Html\FormElement\TextElement;
-use ipl\Tests\Html\TestCase;
+use ipl\Html\Test\TestCase;
class TextElementTest extends TestCase
{
diff --git a/tests/FormElementDecoratorTest.php b/tests/FormElementDecoratorTest.php
index 02f37a17..9b3b3c82 100644
--- a/tests/FormElementDecoratorTest.php
+++ b/tests/FormElementDecoratorTest.php
@@ -3,6 +3,7 @@
namespace ipl\Tests\Html;
use ipl\Html\Form;
+use ipl\Html\Test\TestCase;
use ipl\Tests\Html\TestDummy\PositionedFormElementDecorator;
use ipl\Tests\Html\TestDummy\SimpleFormElementDecorator;
use ipl\Tests\Html\TestDummy\WithinContainerFormElementDecorator;
diff --git a/tests/FormElementsTest.php b/tests/FormElementsTest.php
index 4c02f30e..7305f099 100644
--- a/tests/FormElementsTest.php
+++ b/tests/FormElementsTest.php
@@ -4,6 +4,7 @@
use ipl\Html\Form;
use ipl\Html\FormElement\FormElements;
+use ipl\Html\Test\TestCase;
class FormElementsTest extends TestCase
{
diff --git a/tests/FormTest.php b/tests/FormTest.php
index a7794832..117d9b6c 100644
--- a/tests/FormTest.php
+++ b/tests/FormTest.php
@@ -4,6 +4,7 @@
use ipl\Html\Form;
use ipl\Html\FormElement\BaseFormElement;
+use ipl\Html\Test\TestCase;
use Psr\Http\Message\ServerRequestInterface;
class FormTest extends TestCase
diff --git a/tests/FormattedStringTest.php b/tests/FormattedStringTest.php
index fcef4c77..efb6c0dd 100644
--- a/tests/FormattedStringTest.php
+++ b/tests/FormattedStringTest.php
@@ -4,6 +4,7 @@
use ipl\Html\FormattedString;
use ipl\Html\Html;
+use ipl\Html\Test\TestCase;
use ipl\Tests\Html\TestDummy\ObjectThatCanBeCastedToString;
class FormattedStringTest extends TestCase
diff --git a/tests/HtmlDocumentTest.php b/tests/HtmlDocumentTest.php
index c11679de..5af448b1 100644
--- a/tests/HtmlDocumentTest.php
+++ b/tests/HtmlDocumentTest.php
@@ -5,6 +5,7 @@
use ipl\Html\BaseHtmlElement;
use ipl\Html\Html as h;
use ipl\Html\HtmlDocument;
+use ipl\Html\Test\TestCase;
use ipl\Tests\Html\TestDummy\AddsContentDuringAssemble;
use ipl\Tests\Html\TestDummy\AddsWrapperDuringAssemble;
use ipl\Tests\Html\TestDummy\IterableElement;
diff --git a/tests/HtmlStringTest.php b/tests/HtmlStringTest.php
index ab543cbe..88d0236c 100644
--- a/tests/HtmlStringTest.php
+++ b/tests/HtmlStringTest.php
@@ -3,6 +3,7 @@
namespace ipl\Tests\Html;
use ipl\Html\HtmlString;
+use ipl\Html\Test\TestCase;
use ipl\Html\Text;
class HtmlStringTest extends TestCase
diff --git a/tests/HtmlTest.php b/tests/HtmlTest.php
index 426afb53..f870ee14 100644
--- a/tests/HtmlTest.php
+++ b/tests/HtmlTest.php
@@ -4,6 +4,7 @@
use InvalidArgumentException;
use ipl\Html\Html;
+use ipl\Html\Test\TestCase;
class HtmlTest extends TestCase
{
diff --git a/tests/TemplateStringTest.php b/tests/TemplateStringTest.php
index 0bf0d117..f6f0a4ab 100644
--- a/tests/TemplateStringTest.php
+++ b/tests/TemplateStringTest.php
@@ -3,8 +3,9 @@
namespace ipl\Tests\Html;
use Exception;
-use ipl\Html\TemplateString;
use ipl\Html\Html;
+use ipl\Html\TemplateString;
+use ipl\Html\Test\TestCase;
class TemplateStringTest extends TestCase
{
diff --git a/tests/TestCase.php b/tests/TestCase.php
deleted file mode 100644
index 22dfe954..00000000
--- a/tests/TestCase.php
+++ /dev/null
@@ -1,49 +0,0 @@
-assertTrue($expected->loadHTML($expectedHtml), 'Expected HTML is not valid');
- $actual = new DOMDocument();
- $this->assertTrue($actual->loadHTML($actualHtml->render()), 'Actual HTML is not valid');
-
- $this->assertEquals($expected, $actual);
- }
-
- /**
- * @deprecated Use {@link assertHtml()} instead. assertRendersHtml() suffers from the fact that the HTML being
- * processed must have a root node, e.g. the HTML `foobar` would always fail with "Extra content at
- * the end of the document". {@link assertHtml()} just does the job.
- */
- protected function assertRendersHtml($html, ValidHtml $element)
- {
- $this->assertXmlStringEqualsXmlString($html, $element->render());
- }
-}