function testGetChanges() { $backend = new PDO($this->pdo); $id = $backend->createCalendar('principals/user1', 'bla', []); $result = $backend->getChangesForCalendar($id, null, 1); $this->assertEquals(['syncToken' => 1, 'modified' => [], 'deleted' => [], 'added' => []], $result); $currentToken = $result['syncToken']; $dummyTodo = "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n"; $backend->createCalendarObject($id, "todo1.ics", $dummyTodo); $backend->createCalendarObject($id, "todo2.ics", $dummyTodo); $backend->createCalendarObject($id, "todo3.ics", $dummyTodo); $backend->updateCalendarObject($id, "todo1.ics", $dummyTodo); $backend->deleteCalendarObject($id, "todo2.ics"); $result = $backend->getChangesForCalendar($id, $currentToken, 1); $this->assertEquals(['syncToken' => 6, 'modified' => ["todo1.ics"], 'deleted' => ["todo2.ics"], 'added' => ["todo3.ics"]], $result); $result = $backend->getChangesForCalendar($id, null, 1); $this->assertEquals(['syncToken' => 6, 'modified' => [], 'deleted' => [], 'added' => ["todo1.ics", "todo3.ics"]], $result); }
/** * @depends testCreateCalendarObject */ function testDeleteCalendarObject() { $backend = new PDO($this->pdo); $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', array()); $object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"; $backend->createCalendarObject($returnedId, 'random-id', $object); $backend->deleteCalendarObject($returnedId, 'random-id'); $data = $backend->getCalendarObject($returnedId, 'random-id'); $this->assertNull($data); }