aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Stillman <dstillman@zotero.org>2015-03-10 17:49:00 -0400
committerKlaus Flittner <klaus@flittner.org>2015-04-04 17:27:07 +0200
commit831422e05209841c2aaac660d7da813c6a1e75ff (patch)
tree321617237bca4dfebbadda4a129d7df8ff46dc1e
parent636d955b7b868c9caa896fd48aad4736dd4bceaf (diff)
Make API v3 the default2015.02
-rw-r--r--controllers/CollectionsController.php7
-rw-r--r--model/API.inc.php2
-rw-r--r--tests/remote/tests/API/2/GeneralTest.php29
-rw-r--r--tests/remote/tests/API/GeneralTest.php2
4 files changed, 8 insertions, 32 deletions
diff --git a/controllers/CollectionsController.php b/controllers/CollectionsController.php
index fd8a93e..3fd8e2a 100644
--- a/controllers/CollectionsController.php
+++ b/controllers/CollectionsController.php
@@ -197,7 +197,12 @@ class CollectionsController extends ApiController {
}
$uri .= "?" . $queryString;
- $this->queryParams = Zotero_API::parseQueryParams($queryString, $this->action, true);
+ $this->queryParams = Zotero_API::parseQueryParams(
+ $queryString,
+ $this->action,
+ true,
+ $this->apiVersion
+ );
$title = "Collections";
$results = Zotero_Collections::search($this->objectLibraryID, false, $this->queryParams);
diff --git a/model/API.inc.php b/model/API.inc.php
index f1e6892..6c2ba11 100644
--- a/model/API.inc.php
+++ b/model/API.inc.php
@@ -38,7 +38,7 @@ class Zotero_API {
private static $defaultParams = [
- 'v' => 1,
+ 'v' => 3,
'format' => [
'v' => [
diff --git a/tests/remote/tests/API/2/GeneralTest.php b/tests/remote/tests/API/2/GeneralTest.php
index c7ed3c5..c8d7b97 100644
--- a/tests/remote/tests/API/2/GeneralTest.php
+++ b/tests/remote/tests/API/2/GeneralTest.php
@@ -40,35 +40,6 @@ class GeneralTests extends APITests {
API::userClear(self::$config['userID']);
}
- public function testAPIVersion() {
- $minVersion = 1;
- $maxVersion = 2;
- $defaultVersion = 1;
-
- for ($i = $minVersion; $i <= $maxVersion; $i++) {
- API::useAPIVersion($i);
- $response = API::userGet(
- self::$config['userID'],
- "items?key=" . self::$config['apiKey'] . "&format=keys&limit=1"
- );
- if ($i == 1) {
- $this->assertEquals(1, $response->getHeader("Zotero-API-Version"));
- }
- else {
- $this->assertEquals($i, $response->getHeader("Zotero-API-Version"));
- }
- }
-
- // Default
- API::useAPIVersion(false);
- $response = API::userGet(
- self::$config['userID'],
- "items?key=" . self::$config['apiKey'] . "&format=keys&limit=1"
- );
- $this->assertEquals($defaultVersion, $response->getHeader("Zotero-API-Version"));
- }
-
-
public function testZoteroWriteToken() {
$json = API::getItemTemplate("book");
diff --git a/tests/remote/tests/API/GeneralTest.php b/tests/remote/tests/API/GeneralTest.php
index ee129e0..c54c30c 100644
--- a/tests/remote/tests/API/GeneralTest.php
+++ b/tests/remote/tests/API/GeneralTest.php
@@ -48,7 +48,7 @@ class GeneralTests extends APITests {
public function testAPIVersionHeader() {
$minVersion = 1;
$maxVersion = 3;
- $defaultVersion = 1;
+ $defaultVersion = 3;
for ($i = $minVersion; $i <= $maxVersion; $i++) {
$response = API::userGet(