HtmlDomTest.php 550 B

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