HtmlDomTest.php 583 B

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