HtmlLoremTest.php 761 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace Faker\Test\Provider;
  3. use Faker\Generator;
  4. use Faker\Provider\HtmlLorem;
  5. use PHPUnit\Framework\TestCase;
  6. class HtmlLoremTest extends TestCase
  7. {
  8. public function testProvider()
  9. {
  10. $faker = new Generator();
  11. $faker->addProvider(new HtmlLorem($faker));
  12. $node = $faker->randomHtml(6, 10);
  13. $this->assertStringStartsWith("<html>", $node);
  14. $this->assertStringEndsWith("</html>\n", $node);
  15. }
  16. public function testRandomHtmlReturnsValidHTMLString(){
  17. $faker = new Generator();
  18. $faker->addProvider(new HtmlLorem($faker));
  19. $node = $faker->randomHtml(6, 10);
  20. $dom = new \DOMDocument();
  21. $error = $dom->loadHTML($node);
  22. $this->assertTrue($error);
  23. }
  24. }