コード例 #1
0
ファイル: FeedTest.php プロジェクト: rcknr/ZendGData
 public function testCanAddIndividualEntries()
 {
     $this->feed->transferFromXML($this->feedText);
     $this->assertEquals(1, count($this->feed->entry));
     $oldTitle = $this->feed->entry[0]->title->text;
     $newEntry = new App\Entry();
     $newEntry->setTitle(new \ZendGData\App\Extension\Title("Foo"));
     $this->feed->addEntry($newEntry);
     $this->assertEquals(2, count($this->feed->entry));
     $this->assertEquals($oldTitle, $this->feed->entry[0]->title->text);
     $this->assertEquals("Foo", $this->feed->entry[1]->title->text);
 }
コード例 #2
0
ファイル: EntryTest.php プロジェクト: rcknr/ZendGData
 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.');
 }
コード例 #3
0
ファイル: AppTest.php プロジェクト: hybridneo/zendgdata
 public function testGenerateIfMatchHeaderDataReturnsEtagIfNotWeakAndFlagSet()
 {
     $etag = Etag::fromString('Etag: ABCD1234');
     $this->service->setMajorProtocolVersion(2);
     $entry = new App\Entry();
     $entry->setEtag($etag);
     $result = $this->service->generateIfMatchHeaderData($entry, true);
     $this->assertEquals($etag->getFieldValue(), $result);
 }