SupportHtmlStringTest.php 738 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace Illuminate\Tests\Support;
  3. use Illuminate\Support\HtmlString;
  4. use PHPUnit\Framework\TestCase;
  5. class SupportHtmlStringTest extends TestCase
  6. {
  7. public function testToHtml()
  8. {
  9. $str = '<h1>foo</h1>';
  10. $html = new HtmlString('<h1>foo</h1>');
  11. $this->assertEquals($str, $html->toHtml());
  12. }
  13. public function testToString()
  14. {
  15. $str = '<h1>foo</h1>';
  16. $html = new HtmlString('<h1>foo</h1>');
  17. $this->assertEquals($str, (string) $html);
  18. }
  19. public function testIsEmpty()
  20. {
  21. $this->assertTrue((new HtmlString(''))->isEmpty());
  22. }
  23. public function testIsNotEmpty()
  24. {
  25. $this->assertTrue((new HtmlString('foo'))->isNotEmpty());
  26. }
  27. }