Example #1
0
 public function testIfMatchHttpHeaderSetOnManualPut()
 {
     $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->put($entry);
     $headers = $this->adapter->popRequest()->headers;
     $found = false;
     foreach ($headers as $header => $value) {
         if ($header == 'If-Match' && $value == $etag->getFieldValue()) {
             $found = true;
         }
     }
     $this->assertTrue($found, 'If-Match header not found or incorrect');
 }