[ZF-10089] Zend_Log
[zend.git] / tests / Zend / Gdata / App / GeneratorTest.php
blob56d54f2940b758a719f542a46ef74232bca2423e
1 <?php
2 /**
3 * Zend Framework
5 * LICENSE
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
15 * @category Zend
16 * @package Zend_Gdata_App
17 * @subpackage UnitTests
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id $
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';
27 /**
28 * @category Zend
29 * @package Zend_Gdata_App
30 * @subpackage UnitTests
31 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32 * @license http://framework.zend.com/license/new-bsd New BSD License
33 * @group Zend_Gdata
34 * @group Zend_Gdata_App
36 class Zend_Gdata_App_GeneratorTest extends PHPUnit_Framework_TestCase
39 public function setUp() {
40 $this->generatorText = file_get_contents(
41 'Zend/Gdata/App/_files/GeneratorElementSample1.xml',
42 true);
43 $this->generator = new Zend_Gdata_App_Extension_Generator();
46 public function testEmptyGeneratorShouldHaveEmptyExtensionsList() {
47 $this->assertTrue(is_array($this->generator->extensionElements));
48 $this->assertTrue(count($this->generator->extensionElements) == 0);
51 public function testEmptyGeneratorToAndFromStringShouldMatch() {
52 $generatorXml = $this->generator->saveXML();
53 $newGenerator = new Zend_Gdata_App_Extension_Generator();
54 $newGenerator->transferFromXML($generatorXml);
55 $newGeneratorXml = $newGenerator->saveXML();
56 $this->assertTrue($generatorXml == $newGeneratorXml);
59 public function testGeneratorToAndFromStringShouldMatch() {
60 $this->generator->uri = 'http://code.google.com/apis/gdata/';
61 $this->generator->version = '1.0';
62 $this->generator->text = 'Google data APIs';
63 $generatorXml = $this->generator->saveXML();
64 $newGenerator = new Zend_Gdata_App_Extension_Generator();
65 $newGenerator->transferFromXML($generatorXml);
66 $newGeneratorXml = $newGenerator->saveXML();
67 $this->assertEquals($newGeneratorXml, $generatorXml);
68 $this->assertEquals('http://code.google.com/apis/gdata/',
69 $newGenerator->uri);
70 $this->assertEquals('1.0', $newGenerator->version);
71 $this->assertEquals('Google data APIs', $newGenerator->text);
74 public function testConvertGeneratorWithDraftToAndFromString() {
75 $this->generator->transferFromXML($this->generatorText);
76 $this->assertEquals('http://code.google.com/apis/gdata/',
77 $this->generator->uri);
78 $this->assertEquals('1.0', $this->generator->version);
79 $this->assertEquals('Google data APIs', $this->generator->text);