Ejemplo n.º 1
0
 public function testMagicConstructorsPropogateMinorVersion()
 {
     $v = 84;
     $this->service->setMinorProtocolVersion($v);
     $feed = $this->service->newFeed();
     $this->assertEquals($v, $feed->getMinorProtocolVersion());
 }
Ejemplo n.º 2
0
    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);
    }
Ejemplo n.º 3
0
 /**
  * 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($this->getHttpClient());
         return $service->updateEntry($this, $uri, $className, $extraHeaders);
     } else {
         parent::save($uri, $className, $extraHeaders);
     }
 }
Ejemplo n.º 4
0
 public function testSetAndGetHttpMethodOverride()
 {
     App::setHttpMethodOverride(true);
     $this->assertEquals(true, App::getHttpMethodOverride());
 }