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'); }
public function testDeleteSupportsGDataV2() { // Prepare mock response $this->adapter->setResponse("HTTP/1.1 200 OK"); // Make sure that we're using protocol v2 $this->service->setMajorProtocolVersion(2); $this->entry->setService($this->service); // Set a URL for posting, so that save() will work $editLink = new Extension\Link('http://example.com', 'edit'); $this->entry->setLink(array($editLink)); // Perform a (mock) save $this->entry->delete(); // Check to make sure that a v2 header was sent $headers = $this->adapter->popRequest()->headers; $found = false; foreach ($headers as $header => $value) { if ($header == 'GData-Version' && $value == 2) { $found = true; } } $this->assertTrue($found, 'GData-Version header missing or incorrect.'); }