private function _testCreateByPut($objectType) { $objectTypePlural = API::getPluralObjectType($objectType); $json = API::createUnsavedDataObject($objectType); require_once '../../model/ID.inc.php'; $key = \Zotero_ID::getKey(); $response = API::userPut(self::$config['userID'], "{$objectTypePlural}/{$key}", json_encode($json), ["Content-Type: application/json", "If-Unmodified-Since-Version: 0"]); $this->assert204($response); }
private function _testPatchExistingObjectsWithOldVersionProperty($objectType) { $objectTypePlural = API::getPluralObjectType($objectType); $key = API::createDataObject($objectType, 'key'); $json = API::createUnsavedDataObject($objectType); $json['key'] = $key; $json['version'] = 1; $response = API::userPost(self::$config['userID'], "{$objectTypePlural}", json_encode([$json]), array("Content-Type: application/json")); $this->assert412ForObject($response); }