/**
  * Test loading an existing IVR
  *
  * @dataProvider provideIvrFixtures
  * 
  * @param string filename
  */
 public function testLoad($filename)
 {
     $this->markTestIncomplete('IVR loading not implemented properly');
     $ivr = new Ivr();
     $ivr->load($filename);
     $result = $ivr->saveXML();
     $this->assertXmlStringEqualsXmlFile($filename, $result);
     $tagList = $ivr->getTagList();
     $xpath = new DOMXPath($ivr);
     foreach ($xpath->query('//*') as $tag) {
         if ($tagName = array_search($tag->nodeName, $tagList)) {
             $this->assertInstanceOf(Ivr\Dialplan::ns() . '\\' . $tagName, $tag);
         }
     }
 }
Beispiel #2
0
 protected function transmuteTags(DOMNode $contextNode = null)
 {
     $xpath = new DOMXPath($this);
     $tagList = $this->getTagList();
     if (!$contextNode) {
         $contextNode = $this->documentElement;
     }
     if ($contextNode->hasChildNodes()) {
         foreach ($contextNode->childNodes as $tag) {
             if ($tagName = array_search($tag->nodeName, $tagList)) {
                 $tagClass = Dialplan::ns() . '\\' . $tagName;
                 $newTag = new $tagClass();
                 $contextNode->replaceChild($newTag, $tag);
                 static::transmuteTag($tag, $newTag);
                 $this->transmuteTags($newTag);
             } else {
                 $this->transmuteTags($tag);
             }
         }
     }
 }