Esempio n. 1
0
 public function testRemove()
 {
     $sut = $this->sut;
     $sut->setName('a');
     $formatter = new XMLFormatter();
     $contentBefore = $formatter->buildContent($sut);
     $child = new NodeElement('b', 'c');
     $sut->setChildTree($child);
     $sut->removeChildTree('b');
     $contentAfter = $formatter->buildContent($sut);
     $this->assertEquals($contentBefore, $contentAfter);
 }
Esempio n. 2
0
 public function testsetChild()
 {
     $collector = new XMLCollector();
     $sut = $this->sut;
     $sut->setName('a');
     $child = new NodeElement('b', 'c');
     $sut->addNode($child);
     $sut->addNode($child);
     $formatter = new XMLFormatter();
     $xml = $formatter->buildContent($sut);
     $this->assertEquals(1, $collector->getNumNodeOccurrences($xml, $sut));
     $this->assertEquals(2, $collector->getNumNodeOccurrences($xml, $child));
 }
 public function testZero()
 {
     $el = new NodeElement('a', 0);
     $xml = $this->sut->buildContent($el);
     $this->assertEquals('<a>0</a>', $xml);
 }