is() public method

Indicates if two documents are the same document.
public is ( Document | DOMDocument $document ) : boolean
$document Document | DOMDocument The compared document
return boolean
Beispiel #1
0
 public function testIs()
 {
     $html = $this->loadFixture('posts.html');
     $document = new Document($html, false);
     $document2 = new Document($html, false);
     $this->assertTrue($document->is($document));
     $this->assertFalse($document->is($document2));
 }
Beispiel #2
0
 public function testIsException()
 {
     $this->setExpectedException('InvalidArgumentException');
     $document = new Document();
     $document->is(null);
 }
 public function testParent()
 {
     $html = $this->loadFixture('posts.html');
     $document = new Document($html, false);
     $element = $document->createElement('span', 'value');
     $parent = $element->parent();
     $this->assertInstanceOf('DiDom\\Document', $parent);
     $this->assertTrue($document->is($parent));
 }