.
// }}}
namespace App\Tests\Util;
use App\Util\HTML;
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(''));
static::assertSame('', HTML::html(['a' => '']));
static::assertSame("
", HTML::html(['div' => ['p' => '']]));
static::assertSame("", HTML::html(['div' => ['div' => ['p' => '']]]));
static::assertSame("", HTML::html(['div' => ['div' => ['div' => ['p' => '']]]]));
static::assertSame('', HTML::html(['a' => ['attrs' => ['href' => 'test'], 'p' => '']]));
static::assertSame('foo
', HTML::html(['a' => ['p' => 'foo', 'br' => 'empty']]));
static::assertSame("", HTML::html(['div' => ['a' => ['p' => 'foo', 'br' => 'empty']]]));
static::assertSame('', HTML::html(['div' => ['a' => ['p' => 'foo', 'br' => 'empty']]], options: ['indent' => false]));
static::assertThrows(TypeError::class, fn () => HTML::html(1));
static::assertSame('foo', HTML::tag('a', ['href' => 'test'], content: 'foo', options: ['empty' => false]));
static::assertSame('
', HTML::tag('br', attrs: null, content: null, options: ['empty' => true]));
}
}