public function testLookupNamespaceObeysParentBehavior() { $prefix = 'test'; $testString10 = 'TEST-v1-0'; $testString20 = 'TEST-v2-0'; $testString11 = 'TEST-v1-1'; $testString21 = 'TEST-v2-1'; $testString12 = 'TEST-v1-2'; $testString22 = 'TEST-v2-2'; App\Base::flushNamespaceLookupCache(); $entry = $this->service->newEntry(); $entry->registerNamespace($prefix, $testString10, 1, 0); $entry->registerNamespace($prefix, $testString20, 2, 0); $entry->registerNamespace($prefix, $testString11, 1, 1); $entry->registerNamespace($prefix, $testString21, 2, 1); $entry->registerNamespace($prefix, $testString12, 1, 2); $entry->registerNamespace($prefix, $testString22, 2, 2); // Assumes default version (1) $result = $entry->lookupNamespace($prefix, 1, null); $this->assertEquals($testString12, $result); $result = $entry->lookupNamespace($prefix, 2, null); $this->assertEquals($testString22, $result); $result = $entry->lookupNamespace($prefix, 1, 1); $this->assertEquals($testString11, $result); $result = $entry->lookupNamespace($prefix, 2, 1); $this->assertEquals($testString21, $result); $result = $entry->lookupNamespace($prefix, null, null); $this->assertEquals($testString12, $result); $result = $entry->lookupNamespace($prefix, null, 1); $this->assertEquals($testString11, $result); // Override to retrieve latest version $entry->setMajorProtocolVersion(null); $result = $entry->lookupNamespace($prefix, null, null); $this->assertEquals($testString22, $result); $result = $entry->lookupNamespace($prefix, null, 1); $this->assertEquals($testString21, $result); }
/** * Uploads changes in this entry to the server using Zend_Gdata_App * * @param boolean $dryRun Whether the transaction is dry run or not. * @param string|null $uri The URI to send requests to, or null if $data * contains the URI. * @param string|null $className The name of the class that should we * deserializing the server response. If null, then * 'Zend_Gdata_App_Entry' will be used. * @param array $extraHeaders Extra headers to add to the request, as an * array of string-based key/value pairs. * @return \Zend\GData\App\Entry The updated entry * @throws \Zend\GData\App\Exception */ public function save($dryRun = false, $uri = null, $className = null, $extraHeaders = array()) { if ($dryRun == true) { $editLink = $this->getEditLink(); if ($uri == null && $editLink !== null) { $uri = $editLink->getHref() . '?dry-run=true'; } if ($uri === null) { throw new App\InvalidArgumentException('You must specify an URI which needs deleted.'); } $service = new App\App($this->getHttpClient()); return $service->updateEntry($this, $uri, $className, $extraHeaders); } else { parent::save($uri, $className, $extraHeaders); } }
public function testSetAndGetHttpMethodOverride() { App\App::setHttpMethodOverride(true); $this->assertEquals(true, App\App::getHttpMethodOverride()); }
/** * Imports a feed located at $uri. * * @param string $uri * @param \Zend\HTTP\Client $client The client used for communication * @param string $className The class which is used as the return type * @throws \Zend\GData\App\Exception * @return string|\Zend\GData\App\Feed Returns string only if the object * mapping has been disabled explicitly * by passing false to the * useObjectMapping() function. */ public static function import($uri, $client = null, $className = '\\Zend\\GData\\App\\Feed') { $app = new App($client); $requestData = $app->prepareRequest('GET', $uri); $response = $app->performHttpRequest($requestData['method'], $requestData['url']); $feedContent = $response->getBody(); if (!$this->_useObjectMapping) { return $feedContent; } $feed = self::importString($feedContent, $className); if ($client != null) { $feed->setHttpClient($client); } return $feed; }