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/GappsTest.php | 79 +++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 zend/tests/Zend/Gdata/GappsTest.php (limited to 'zend/tests/Zend/Gdata/GappsTest.php') diff --git a/zend/tests/Zend/Gdata/GappsTest.php b/zend/tests/Zend/Gdata/GappsTest.php new file mode 100644 index 0000000..c1ec04d --- /dev/null +++ b/zend/tests/Zend/Gdata/GappsTest.php @@ -0,0 +1,79 @@ +gdata = new Zend_Gdata_Gapps(null, self::TEST_DOMAIN); + } + + public function testMagicFactoryProvidesQueriesWithDomains() { + $userQ = $this->gdata->newUserQuery(); + $this->assertTrue($userQ instanceof Zend_Gdata_Gapps_UserQuery); + $this->assertEquals(self::TEST_DOMAIN, $userQ->getDomain()); + $this->assertEquals(null, $userQ->getUsername()); + + $userQ = $this->gdata->newUserQuery('foo'); + $this->assertTrue($userQ instanceof Zend_Gdata_Gapps_UserQuery); + $this->assertEquals(self::TEST_DOMAIN, $userQ->getDomain()); + $this->assertEquals('foo', $userQ->getUsername()); + } + + public function testMagicFactoryLeavesNonQueriesAlone() { + $login = $this->gdata->newLogin('blah'); + $this->assertTrue($login instanceof Zend_Gdata_Gapps_Extension_Login); + $this->assertEquals('blah', $login->username); + } + + public function testEmptyResponseExceptionRaisesException() { + require_once('Zend/Gdata/App/HttpException.php'); + $e = new Zend_Gdata_App_HttpException(); + $e->setResponse(null); + $success = false; + try { + $this->gdata->throwServiceExceptionIfDetected($e); + } catch (Zend_Gdata_App_IOException $f) { + $success = true; + } + $this->assertTrue($success, 'Zend_Gdata_App_IOException not thrown'); + } + +} -- cgit v1.2.3