コード例 #1
0
ファイル: EntryTest.php プロジェクト: rcknr/ZendGData
 public function testReloadAllowsCustomURI()
 {
     $uriOverride = 'http://www.example.org';
     $etag = Etag::fromString('Etag: ABCD1234');
     $this->service->setMajorProtocolVersion(2);
     $this->adapter->setResponse($this->httpEntrySample);
     $entry = $this->service->newEntry();
     $entry->link = array(new Extension\Link('http://www.example.com', 'edit', 'application/atom+xml'));
     $entry->setEtag($etag);
     $newEntry = $entry->reload($uriOverride);
     $requestUri = $this->adapter->popRequest()->uri;
     $uriOverrideObject = new Uri\Http($uriOverride);
     $this->assertEquals($uriOverrideObject, $requestUri);
 }
コード例 #2
0
ファイル: AppTest.php プロジェクト: robertodormepoco/zf2
 /**
  * @group ZF-8397
  */
 public function testIfMatchHttpHeaderIsResetEachRequest()
 {
     // Update an entry
     $etag = Etag::fromString('Etag: ABCD1234');
     $this->adapter->setResponse("HTTP/1.1 201 Created");
     $this->service->setMajorProtocolVersion(2);
     $entry = new App\Entry();
     $entry->link = array(new Extension\Link('http://www.example.com', 'edit', 'application/atom+xml'));
     $entry->setEtag($etag);
     $this->service->updateEntry($entry);
     // Get another entry without ETag set,
     // Previous value of If-Match HTTP header should not be sent
     $this->adapter->setResponse($this->httpEntrySample);
     $entry = $this->service->getEntry('http://www.example.com');
     $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');
 }