public function testReplaceAll() { $root = new RootNode(); $parent_one = $this->createParentNode(); $parent_one->appendTo($root); $one = $this->createNode(); $one->appendTo($parent_one); $parent_two = $this->createParentNode(); $parent_two->appendTo($root); $first = $this->createNode(); $first->appendTo($parent_two); $second = $this->createNode(); $second->appendTo($parent_two); $replacement = new TokenNode(T_STRING, 'replacement'); $collection = new NodeCollection([$replacement], FALSE); $ret = $collection->replaceAll([$one, $first]); $this->assertSame($replacement, $ret[0]); $this->assertSame($replacement, $parent_one->firstChild()); $this->assertNotSame($replacement, $parent_two->firstChild()); $this->assertEquals('replacement', $parent_two->firstChild()->getText()); $collection->replaceAll($second); $this->assertSame($replacement, $parent_two->lastChild()); }