From 06f945f27840b53e57795dadbc38e76f7e11ab1c Mon Sep 17 00:00:00 2001 From: Horus3 Date: Mon, 24 Feb 2014 16:42:14 +0100 Subject: init --- zend/tests/Zend/Gdata/App/BaseTest.php | 133 +++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 zend/tests/Zend/Gdata/App/BaseTest.php (limited to 'zend/tests/Zend/Gdata/App/BaseTest.php') diff --git a/zend/tests/Zend/Gdata/App/BaseTest.php b/zend/tests/Zend/Gdata/App/BaseTest.php new file mode 100644 index 0000000..6fae63d --- /dev/null +++ b/zend/tests/Zend/Gdata/App/BaseTest.php @@ -0,0 +1,133 @@ +fileName = 'Zend/Gdata/App/_files/FeedSample1.xml'; + $this->base = new Zend_Gdata_App_MockBase(); + } + + public function testUnknownNamespaceReturnsInput() { + $this->assertEquals('example', + $this->base->lookupNamespace('example')); + } + public function testAtomV1NamespaceReturnedByDefault() { + $this->assertEquals('http://www.w3.org/2005/Atom', + $this->base->lookupNamespace('atom')); + } + + public function testAtomPubV1NamespaceReturnedByDefault() { + $this->assertEquals('http://purl.org/atom/app#', + $this->base->lookupNamespace('app')); + } + + public function testAtomV1NamespaceReturnedWhenSpecifyingMajorVersion() { + $this->assertEquals('http://www.w3.org/2005/Atom', + $this->base->lookupNamespace('atom', + 1)); + } + + public function testAtomV1NamespaceReturnedWhenSpecifyingMajorAndMinorVersion() { + $this->assertEquals('http://www.w3.org/2005/Atom', + $this->base->lookupNamespace('atom', + 1, 0)); + } + + public function testAtomPubV1NamespaceReturnedWhenSpecifyingMajorVersion() { + $this->assertEquals('http://purl.org/atom/app#', + $this->base->lookupNamespace('app', + 1)); + } + + public function testAtomPubV1NamespaceReturnedWhenSpecifyingMajorAndMinorVersion() { + $this->assertEquals('http://purl.org/atom/app#', + $this->base->lookupNamespace('app', + 1, 0)); + } + + public function testAtomPubV2NamespaceReturnedWhenSpecifyingMajorVersion() { + $this->assertEquals('http://www.w3.org/2007/app', + $this->base->lookupNamespace('app', + 2)); + } + + public function testAtomPubV2NamespaceReturnedWhenSpecifyingMajorAndMinorVersion() { + $this->assertEquals('http://www.w3.org/2007/app', + $this->base->lookupNamespace('app', + 2, 0)); + } + + public function testNullReturnsLatestVersion() { + $this->assertEquals('http://www.w3.org/2007/app', + $this->base->lookupNamespace('app', + null, null)); + } + + public function testRegisterNamespaceWorksWithoutVersion() { + $ns = 'http://example.net/namespaces.foo'; + $prefix = 'foo'; + $this->base->registerNamespace($prefix, $ns); + $result = $this->base->lookupNamespace($prefix); + $this->assertEquals($ns, $result); + } + + public function testRegisterNamespaceAllowsSettingMajorVersion() { + $ns = 'http://example.net/namespaces.foo'; + $prefix = 'foo'; + $this->base->registerNamespace($prefix, 'wrong-1', 1); + $this->base->registerNamespace($prefix, $ns, 2); + $this->base->registerNamespace($prefix, 'wrong-3', 3); + $this->base->registerNamespace($prefix, 'wrong-4', 4); + $result = $this->base->lookupNamespace($prefix, 2); + $this->assertEquals($ns, $result); + } + + public function testRegisterNamespaceAllowsSettingMinorVersion() { + $ns = 'http://example.net/namespaces.foo'; + $prefix = 'foo'; + $this->base->registerNamespace($prefix, 'wrong-1', 1); + $this->base->registerNamespace($prefix, 'wrong-2-0', 2,0); + $this->base->registerNamespace($prefix, 'wrong-2-1', 2,1); + $this->base->registerNamespace($prefix, 'wrong-2-2', 2,2); + $this->base->registerNamespace($prefix, $ns, 2, 3); + $this->base->registerNamespace($prefix, 'wrong-2-4', 2,4); + $this->base->registerNamespace($prefix, 'wrong-3-0', 3-0); + $this->base->registerNamespace($prefix, 'wrong-3-1', 3-1); + $this->base->registerNamespace($prefix, 'wrong-4', 4); + $result = $this->base->lookupNamespace($prefix, 2, 3); + $this->assertEquals($ns, $result); + } + +} -- cgit v1.2.3