8
* This source file is subject to the new BSD license that is bundled
9
* with this package in the file LICENSE.txt.
10
* It is also available through the world-wide-web at this URL:
11
* http://framework.zend.com/license/new-bsd
12
* If you did not receive a copy of the license and are unable to
13
* obtain it through the world-wide-web, please send an email
14
* to license@zend.com so we can send you a copy immediately.
17
* @package Zend_Gdata_App
18
* @subpackage UnitTests
19
* @copyright Copyright (c) 2006 Zend Technologies USA Inc. (http://www.zend.com);
20
* @license http://framework.zend.com/license/new-bsd New BSD License
23
require_once 'Zend/Gdata/App/Extension/Generator.php';
24
require_once 'Zend/Gdata/App/Extension/Draft.php';
25
require_once 'Zend/Gdata/App.php';
28
* @package Zend_Gdata_App
29
* @subpackage UnitTests
31
class Zend_Gdata_App_GeneratorTest extends PHPUnit_Framework_TestCase
34
public function setUp() {
35
$this->generatorText = file_get_contents(
36
'Zend/Gdata/App/_files/GeneratorElementSample1.xml',
38
$this->generator = new Zend_Gdata_App_Extension_Generator();
41
public function testEmptyGeneratorShouldHaveEmptyExtensionsList() {
42
$this->assertTrue(is_array($this->generator->extensionElements));
43
$this->assertTrue(count($this->generator->extensionElements) == 0);
46
public function testEmptyGeneratorToAndFromStringShouldMatch() {
47
$generatorXml = $this->generator->saveXML();
48
$newGenerator = new Zend_Gdata_App_Extension_Generator();
49
$newGenerator->transferFromXML($generatorXml);
50
$newGeneratorXml = $newGenerator->saveXML();
51
$this->assertTrue($generatorXml == $newGeneratorXml);
54
public function testGeneratorToAndFromStringShouldMatch() {
55
$this->generator->uri = 'http://code.google.com/apis/gdata/';
56
$this->generator->version = '1.0';
57
$this->generator->text = 'Google data APIs';
58
$generatorXml = $this->generator->saveXML();
59
$newGenerator = new Zend_Gdata_App_Extension_Generator();
60
$newGenerator->transferFromXML($generatorXml);
61
$newGeneratorXml = $newGenerator->saveXML();
62
$this->assertEquals($newGeneratorXml, $generatorXml);
63
$this->assertEquals('http://code.google.com/apis/gdata/',
65
$this->assertEquals('1.0', $newGenerator->version);
66
$this->assertEquals('Google data APIs', $newGenerator->text);
69
public function testConvertGeneratorWithDraftToAndFromString() {
70
$this->generator->transferFromXML($this->generatorText);
71
$this->assertEquals('http://code.google.com/apis/gdata/',
72
$this->generator->uri);
73
$this->assertEquals('1.0', $this->generator->version);
74
$this->assertEquals('Google data APIs', $this->generator->text);