Exemplo n.º 1
0
 public function testIfMatchHttpHeaderSetOnManualDelete()
 {
     $etag = Etag::fromString('Etag: ABCD1234');
     $this->adapter->setResponse("HTTP/1.1 201 Created");
     $this->service->setMajorProtocolVersion(2);
     $entry = $this->service->newEntry();
     $entry->link = array(new Extension\Link('http://www.example.com', 'edit', 'application/atom+xml'));
     $entry->setEtag($etag);
     $entry->setService($this->service);
     $this->service->delete($entry);
     $headers = $this->adapter->popRequest()->headers;
     $found = false;
     foreach ($headers as $header => $value) {
         if ($header == 'If-Match' && $value == $etag->getFieldValue()) {
             $found = true;
         }
     }
     $this->assertFalse($found, 'If-Match header found on delete');
 }
Exemplo 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\AbstractBase::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);
 }