|
|
@@ -442,6 +442,36 @@ class Zend_Gdata_AppTest extends PHPUnit_Framework_TestCase
|
|
|
$this->assertTrue($found, 'If-None-Match header not found or incorrect');
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @group ZF-8397
|
|
|
+ */
|
|
|
+ public function testIfMatchHTTPHeaderIsResetEachRequest()
|
|
|
+ {
|
|
|
+ // Update an entry
|
|
|
+ $etag = 'ABCD1234';
|
|
|
+ $this->adapter->setResponse("HTTP/1.1 201 Created");
|
|
|
+ $this->service->setMajorProtocolVersion(2);
|
|
|
+ $entry = new Zend_Gdata_App_Entry();
|
|
|
+ $entry->link = array(new Zend_Gdata_App_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) {
|
|
|
+ if ($header == 'If-Match: ' . $etag)
|
|
|
+ $found = true;
|
|
|
+ }
|
|
|
+ $this->assertFalse($found, 'If-Match header found');
|
|
|
+ }
|
|
|
+
|
|
|
public function testGenerateIfMatchHeaderDataReturnsEtagIfV2() {
|
|
|
$etag = 'ABCD1234';
|
|
|
$this->service->setMajorProtocolVersion(2);
|