. // }}} namespace App\Tests\Util; use Jchook\AssertThrows\AssertThrows; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use TypeError; class HTMLTest extends WebTestCase { use AssertThrows; public function testHTML() { static::assertSame('', HTML\HTML::html('')); static::assertSame('', HTML\HTML::html(['a' => ''])); static::assertSame("
\n

\n
", HTML\HTML::html(['div' => ['p' => '']])); static::assertSame("
\n
\n

\n
\n
", HTML\HTML::html(['div' => ['div' => ['p' => '']]])); static::assertSame("
\n
\n
\n

\n
\n
\n
", HTML\HTML::html(['div' => ['div' => ['div' => ['p' => '']]]])); static::assertSame('

', HTML\HTML::html(['a' => ['attrs' => ['href' => 'test'], 'p' => '']])); static::assertSame('

foo


', HTML\HTML::html(['a' => ['p' => 'foo', 'br' => 'empty']])); static::assertSame("
\n

foo


\n
", HTML\HTML::html(['div' => ['a' => ['p' => 'foo', 'br' => 'empty']]])); static::assertSame('

foo


', HTML\HTML::html(['div' => ['a' => ['p' => 'foo', 'br' => 'empty']]], options: ['indent' => false])); static::assertThrows(TypeError::class, fn () => HTML\HTML::html(1)); static::assertSame('foo', HTML\HTML::tag('a', ['href' => 'test'], content: 'foo', options: ['empty' => false])); static::assertSame('
', HTML\HTML::tag('br', attrs: null, content: null, options: ['empty' => true])); } }