.
// }}}
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("
", HTML\HTML::html(['div' => ['p' => '']]));
static::assertSame("", HTML\HTML::html(['div' => ['div' => ['p' => '']]]));
static::assertSame("", 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("", HTML\HTML::html(['div' => ['a' => ['p' => 'foo', 'br' => 'empty']]]));
static::assertSame('', 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]));
}
}