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 testGetChanges * @expectedException \InvalidArgumentException */ function testGetChangesBadId() { $backend = new PDO($this->pdo); $id = $backend->createCalendar('principals/user1', 'bla', []); $backend->getChangesForCalendar('bad-id', null, 1); }