private function _testAPINewerTimestamp($objectType) { $objectTypePlural = API::getPluralObjectType($objectType); $xml = Sync::updated(self::$sessionID); $lastSyncTimestamp = $xml['timestamp']; // Create via sync switch ($objectType) { case 'collection': $keys[] = Sync::createCollection(self::$sessionID, self::$config['libraryID'], "Test", false, $this); break; case 'item': $keys[] = Sync::createItem(self::$sessionID, self::$config['libraryID'], "book", false, $this); break; case 'search': $keys[] = Sync::createSearch(self::$sessionID, self::$config['libraryID'], "Test", 'default', $this); break; } $response = API::userGet(self::$config['userID'], "{$objectTypePlural}?key=" . self::$config['apiKey'] . "&newertime={$lastSyncTimestamp}&format=keys"); $this->assertEquals(200, $response->getStatus()); $responseKeys = explode("\n", trim($response->getBody())); $this->assertCount(sizeOf($keys), $responseKeys); foreach ($keys as $key) { $this->assertContains($key, $responseKeys); } // Should be empty with later timestamp $xml = Sync::updated(self::$sessionID); $lastSyncTimestamp = $xml['timestamp']; $response = API::userGet(self::$config['userID'], "{$objectTypePlural}?key=" . self::$config['apiKey'] . "&newertime=" . ($lastSyncTimestamp + 2) . "&format=keys"); $this->assertEquals(200, $response->getStatus()); $this->assertEquals("", trim($response->getBody())); }