HtmlDomTest.php 603 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace Tools\TestCase\HtmlDom;
  3. use Cake\Core\Configure;
  4. use Tools\HtmlDom\HtmlDom;
  5. use Tools\TestSuite\TestCase;
  6. class HtmlDomTest extends TestCase {
  7. /**
  8. * @var \Tools\HtmlDom\HtmlDom
  9. */
  10. public $HtmlDom;
  11. public function setUp() {
  12. parent::setUp();
  13. $this->skipIf(!class_exists('Yangqi\Htmldom\Htmldom'));
  14. }
  15. /**
  16. * HtmlDom test
  17. *
  18. * @return void
  19. */
  20. public function testBasics() {
  21. $this->HtmlDom = new HtmlDom('<div id="hello">Hello</div><div id="world">World</div>');
  22. $result = $this->HtmlDom->find('div', 1)->innertext;
  23. $this->assertSame('World', $result);
  24. }
  25. }