[ZF-10089] Zend_Log
[zend.git] / tests / Zend / Gdata / App / BaseTest.php
blobc010f90e144ddb4ba54a5654540a8cd208d38ea1
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/MockBase.php';
25 /**
26 * @category Zend
27 * @package Zend_Gdata_App
28 * @subpackage UnitTests
29 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
30 * @license http://framework.zend.com/license/new-bsd New BSD License
31 * @group Zend_Gdata
32 * @group Zend_Gdata_App
34 class Zend_Gdata_App_BaseTest extends PHPUnit_Framework_TestCase
36 public function setUp()
38 $this->fileName = 'Zend/Gdata/App/_files/FeedSample1.xml';
39 $this->base = new Zend_Gdata_App_MockBase();
42 public function testUnknownNamespaceReturnsInput() {
43 $this->assertEquals('example',
44 $this->base->lookupNamespace('example'));
46 public function testAtomV1NamespaceReturnedByDefault() {
47 $this->assertEquals('http://www.w3.org/2005/Atom',
48 $this->base->lookupNamespace('atom'));
51 public function testAtomPubV1NamespaceReturnedByDefault() {
52 $this->assertEquals('http://purl.org/atom/app#',
53 $this->base->lookupNamespace('app'));
56 public function testAtomV1NamespaceReturnedWhenSpecifyingMajorVersion() {
57 $this->assertEquals('http://www.w3.org/2005/Atom',
58 $this->base->lookupNamespace('atom',
59 1));
62 public function testAtomV1NamespaceReturnedWhenSpecifyingMajorAndMinorVersion() {
63 $this->assertEquals('http://www.w3.org/2005/Atom',
64 $this->base->lookupNamespace('atom',
65 1, 0));
68 public function testAtomPubV1NamespaceReturnedWhenSpecifyingMajorVersion() {
69 $this->assertEquals('http://purl.org/atom/app#',
70 $this->base->lookupNamespace('app',
71 1));
74 public function testAtomPubV1NamespaceReturnedWhenSpecifyingMajorAndMinorVersion() {
75 $this->assertEquals('http://purl.org/atom/app#',
76 $this->base->lookupNamespace('app',
77 1, 0));
80 public function testAtomPubV2NamespaceReturnedWhenSpecifyingMajorVersion() {
81 $this->assertEquals('http://www.w3.org/2007/app',
82 $this->base->lookupNamespace('app',
83 2));
86 public function testAtomPubV2NamespaceReturnedWhenSpecifyingMajorAndMinorVersion() {
87 $this->assertEquals('http://www.w3.org/2007/app',
88 $this->base->lookupNamespace('app',
89 2, 0));
92 public function testNullReturnsLatestVersion() {
93 $this->assertEquals('http://www.w3.org/2007/app',
94 $this->base->lookupNamespace('app',
95 null, null));
98 public function testRegisterNamespaceWorksWithoutVersion() {
99 $ns = 'http://example.net/namespaces.foo';
100 $prefix = 'foo';
101 $this->base->registerNamespace($prefix, $ns);
102 $result = $this->base->lookupNamespace($prefix);
103 $this->assertEquals($ns, $result);
106 public function testRegisterNamespaceAllowsSettingMajorVersion() {
107 $ns = 'http://example.net/namespaces.foo';
108 $prefix = 'foo';
109 $this->base->registerNamespace($prefix, 'wrong-1', 1);
110 $this->base->registerNamespace($prefix, $ns, 2);
111 $this->base->registerNamespace($prefix, 'wrong-3', 3);
112 $this->base->registerNamespace($prefix, 'wrong-4', 4);
113 $result = $this->base->lookupNamespace($prefix, 2);
114 $this->assertEquals($ns, $result);
117 public function testRegisterNamespaceAllowsSettingMinorVersion() {
118 $ns = 'http://example.net/namespaces.foo';
119 $prefix = 'foo';
120 $this->base->registerNamespace($prefix, 'wrong-1', 1);
121 $this->base->registerNamespace($prefix, 'wrong-2-0', 2,0);
122 $this->base->registerNamespace($prefix, 'wrong-2-1', 2,1);
123 $this->base->registerNamespace($prefix, 'wrong-2-2', 2,2);
124 $this->base->registerNamespace($prefix, $ns, 2, 3);
125 $this->base->registerNamespace($prefix, 'wrong-2-4', 2,4);
126 $this->base->registerNamespace($prefix, 'wrong-3-0', 3-0);
127 $this->base->registerNamespace($prefix, 'wrong-3-1', 3-1);
128 $this->base->registerNamespace($prefix, 'wrong-4', 4);
129 $result = $this->base->lookupNamespace($prefix, 2, 3);
130 $this->assertEquals($ns, $result);