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

\n

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

\n

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

\n foo\n

\n
\n
\n", HTML::html(['a' => ['p' => 'foo', 'br' => 'empty']])); static::assertThrows(\InvalidArgumentException::class, fn () => HTML::html(1)); static::assertSame("\n foo\n", implode("\n", HTML::tag('a', ['href' => 'test'], content: 'foo', empty_tag: false))); static::assertSame('
', implode("\n", HTML::tag('br', attrs: null, content: null, empty_tag: true))); } }