generatorText = file_get_contents( 'Zend/Gdata/App/_files/GeneratorElementSample1.xml', true); $this->generator = new Zend_Gdata_App_Extension_Generator(); } public function testEmptyGeneratorShouldHaveEmptyExtensionsList() { $this->assertTrue(is_array($this->generator->extensionElements)); $this->assertTrue(count($this->generator->extensionElements) == 0); } public function testEmptyGeneratorToAndFromStringShouldMatch() { $generatorXml = $this->generator->saveXML(); $newGenerator = new Zend_Gdata_App_Extension_Generator(); $newGenerator->transferFromXML($generatorXml); $newGeneratorXml = $newGenerator->saveXML(); $this->assertTrue($generatorXml == $newGeneratorXml); } 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 Zend_Gdata_App_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); } public function testConvertGeneratorWithDraftToAndFromString() { $this->generator->transferFromXML($this->generatorText); $this->assertEquals('http://code.google.com/apis/gdata/', $this->generator->uri); $this->assertEquals('1.0', $this->generator->version); $this->assertEquals('Google data APIs', $this->generator->text); } }