示例#1
0
 public function testGeneratorToAndFromStringShouldMatch()
 {
     $this->generator->uri = 'http://code.google.com/apis/gdata/';
     $this->generator->version = '1.0';
     $this->generator->text = 'Google data APIs';
     $generatorXml = $this->generator->saveXML();
     $newGenerator = new Extension\Generator();
     $newGenerator->transferFromXML($generatorXml);
     $newGeneratorXml = $newGenerator->saveXML();
     $this->assertEquals($newGeneratorXml, $generatorXml);
     $this->assertEquals('http://code.google.com/apis/gdata/', $newGenerator->uri);
     $this->assertEquals('1.0', $newGenerator->version);
     $this->assertEquals('Google data APIs', $newGenerator->text);
 }
 /**
  * Creates individual Entry objects of the appropriate type and
  * stores them in the $_entry array based upon DOM data.
  *
  * @param DOMNode $child The DOMNode to process
  */
 protected function takeChildFromDOM($child)
 {
     $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
     switch ($absoluteNodeName) {
         case $this->lookupNamespace('atom') . ':' . 'generator':
             $generator = new Extension\Generator();
             $generator->transferFromDOM($child);
             $this->_generator = $generator;
             break;
         case $this->lookupNamespace('atom') . ':' . 'icon':
             $icon = new Extension\Icon();
             $icon->transferFromDOM($child);
             $this->_icon = $icon;
             break;
         case $this->lookupNamespace('atom') . ':' . 'logo':
             $logo = new Extension\Logo();
             $logo->transferFromDOM($child);
             $this->_logo = $logo;
             break;
         case $this->lookupNamespace('atom') . ':' . 'subtitle':
             $subtitle = new Extension\Subtitle();
             $subtitle->transferFromDOM($child);
             $this->_subtitle = $subtitle;
             break;
         default:
             parent::takeChildFromDOM($child);
             break;
     }
 }