public function testGrandchild() { $root = new SXE('<root><child /></root>'); $new = new SXE('<new />'); $root->child->appendChild($new); $this->assertXmlStringEqualsXmlString($root->asXML(), '<root><child><new /></child></root>'); }
public function testNoRef() { $root = new SXE('<root><child /></root>'); $new = new SXE('<new />'); $return = $root->insertBefore($new); $this->assertXmlStringEqualsXmlString('<root><child /><new /></root>', $root->asXML()); $this->assertSame(dom_import_simplexml($root->new), dom_import_simplexml($return)); }
public function testRoot() { $root = new SXE('<root />'); $new = new SXE('<new />'); $expected_result = clone $new; $expected_return = clone $root; $return = $root->replaceSelf($new); $this->assertEquals($root, $expected_result); $this->assertEquals($return, $expected_return); }
public function testRoot() { $root = new SXE('<root><child /></root>'); $parent = $root->parentNode(); /** * When asked for the root node's parent, DOM returns the root node itself */ $this->assertTrue($parent instanceof SXE); $this->assertSame(dom_import_simplexml($root), dom_import_simplexml($parent)); }
/** * @expectedException DOMException */ public function testWrongDocument() { $root = new SXE('<root />'); $node = new SXE('<node />'); try { $root->removeChild($node); } catch (DOMException $e) { $this->assertSame(DOM_WRONG_DOCUMENT_ERR, $e->code); throw $e; } }
public function testInvalidArgumentType2() { $root = new SXE('<root />'); try { $root->addProcessingInstruction('xml-stylesheet', false); $fail = true; } catch (Exception $e) { $fail = false; } if ($fail) { self::fail(); } }
/** * @expectedException InvalidArgumentException */ public function testInvalidXML() { $root = new SXE('<root><child /></root>'); $root->appendXML('<bad><xml>'); }
/** * @expectedException InvalidArgumentException */ public function testInvalidXPath() { $root = new SXE('<root />'); $new = new SXE('<new />'); $root->replaceNodes('????', $new); }
/** * @expectedException InvalidArgumentException */ public function testInvalidArgumentType() { $root = new SXE('<root />'); $root->getElementById(false); }
/** * @expectedException InvalidArgumentException */ public function testInvalidXPath() { $root = new SXE('<root />'); $root->deleteNodes('????'); }
public function testRoot() { $root = new SXE('<root><child1 /><child2 /><child3 /></root>'); $this->assertNull($root->nextSibling()); }
/** * @expectedException BadMethodCallException */ public function testRoot() { $root = new SXE('<root />'); $new = new SXE('<new />'); $root->insertBeforeSelf($new); }
public function testNoChild() { $root = new SXE('<root />'); $this->assertNull($root->lastChild()); }
/** * @expectedException InvalidArgumentException */ public function testInvalidTagName() { $root = new SXE('<root />'); $root->getElementsByTagName('$$$$'); }
/** * @expectedException BadMethodCallException */ public function testRoot() { $root = new SXE('<root><child /></root>'); $root->deleteSelf(); }
/** * @expectedException BadMethodCallException */ public function testRoot() { $root = new SXE('<root />'); $root->removeSelf(); }