HtmlLoremTest.php 748B

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