public function testGetEntryExceptionInvalidLocationType() { $gdata = new GData(); try { // give it neither a string nor a ZendGData\Query object, // and see if it throws an exception. $feed = $gdata->getEntry(new \stdClass()); $this->fail('Expecting to catch ZendGData\\App\\InvalidArgumentException'); } catch (\Exception $e) { $this->assertInstanceOf('ZendGData\\App\\InvalidArgumentException', $e, 'Expecting ZendGData\\App\\InvalidArgumentException, got ' . get_class($e)); $this->assertEquals('You must specify the location as either a string URI or a child of ZendGData\\Query', $e->getMessage()); } }
/** * Retrieve data feed object * * @param string|\Zend\Uri\Uri $uri * @return Analytics\DataFeed */ public function getDataFeed($uri = self::ANALYTICS_FEED_URI) { if ($uri instanceof Query) { $uri = $uri->getQueryUrl(); } return parent::getFeed($uri, 'ZendGData\\Analytics\\DataFeed'); }
public function testDisableAndReEnableXMLToObjectMappingReturnsObject() { $gdata = new GData(); $gdata::useObjectMapping(false); $xmlString = $gdata->getEntry('http://gdata.youtube.com/feeds/api/videos/O4SWAfisH-8'); $this->assertEquals('string', gettype($xmlString)); $gdata::useObjectMapping(true); $entry = $gdata->getEntry('http://gdata.youtube.com/feeds/api/videos/O4SWAfisH-8'); $this->assertTrue($entry instanceof Entry); }