summaryrefslogtreecommitdiffstats
path: root/tests/lib/ocsclienttest.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-06-29 11:15:56 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2015-06-29 12:14:07 +0200
commitae3d402dbc3c9620cea5b32bedc7f00874b12dd0 (patch)
tree8efd85897ad6ae4d138b4f191b31c4164ea9182e /tests/lib/ocsclienttest.php
parentb55f71ee032a77105b823ee01653f39fe066977f (diff)
downloadnextcloud-server-ae3d402dbc3c9620cea5b32bedc7f00874b12dd0.tar.gz
nextcloud-server-ae3d402dbc3c9620cea5b32bedc7f00874b12dd0.zip
Send OC version to appstore so it can reply with the right links
Diffstat (limited to 'tests/lib/ocsclienttest.php')
-rw-r--r--tests/lib/ocsclienttest.php50
1 files changed, 30 insertions, 20 deletions
diff --git a/tests/lib/ocsclienttest.php b/tests/lib/ocsclienttest.php
index ca8a2a2a2e8..b8c4ed2f7f4 100644
--- a/tests/lib/ocsclienttest.php
+++ b/tests/lib/ocsclienttest.php
@@ -85,7 +85,7 @@ class OCSClientTest extends \Test\TestCase {
->method('getSystemValue')
->with('appstoreenabled', true)
->will($this->returnValue(false));
- $this->assertNull($this->ocsClient->getCategories());
+ $this->assertNull($this->ocsClient->getCategories([8, 1, 0, 7]));
}
public function testGetCategoriesExceptionClient() {
@@ -108,6 +108,7 @@ class OCSClientTest extends \Test\TestCase {
'https://api.owncloud.com/v1/content/categories',
[
'timeout' => 5,
+ 'query' => ['version' => '8x1x0x7'],
]
)
->will($this->throwException(new \Exception('TheErrorMessage')));
@@ -127,7 +128,7 @@ class OCSClientTest extends \Test\TestCase {
]
);
- $this->assertNull($this->ocsClient->getCategories());
+ $this->assertNull($this->ocsClient->getCategories([8, 1, 0, 7]));
}
public function testGetCategoriesParseError() {
@@ -156,6 +157,7 @@ class OCSClientTest extends \Test\TestCase {
'https://api.owncloud.com/v1/content/categories',
[
'timeout' => 5,
+ 'query' => ['version' => '8x1x0x7'],
]
)
->will($this->returnValue($response));
@@ -175,7 +177,7 @@ class OCSClientTest extends \Test\TestCase {
]
);
- $this->assertNull($this->ocsClient->getCategories());
+ $this->assertNull($this->ocsClient->getCategories([8, 1, 0, 7]));
}
public function testGetCategoriesSuccessful() {
@@ -239,6 +241,7 @@ class OCSClientTest extends \Test\TestCase {
'https://api.owncloud.com/v1/content/categories',
[
'timeout' => 5,
+ 'query' => ['version' => '8x1x0x7'],
]
)
->will($this->returnValue($response));
@@ -256,7 +259,7 @@ class OCSClientTest extends \Test\TestCase {
924 => 'ownCloud Tool',
925 => 'ownCloud other',
];
- $this->assertSame($expected, $this->ocsClient->getCategories());
+ $this->assertSame($expected, $this->ocsClient->getCategories([8, 1, 0, 7]));
}
public function testGetApplicationsDisabledAppStore() {
@@ -265,7 +268,7 @@ class OCSClientTest extends \Test\TestCase {
->method('getSystemValue')
->with('appstoreenabled', true)
->will($this->returnValue(false));
- $this->assertSame([], $this->ocsClient->getApplications([], 1, 'approved'));
+ $this->assertSame([], $this->ocsClient->getApplications([], 1, 'approved', [8, 1, 0, 7]));
}
public function testGetApplicationsExceptionClient() {
@@ -289,7 +292,7 @@ class OCSClientTest extends \Test\TestCase {
[
'timeout' => 5,
'query' => [
- 'version' => implode('x', \OC_Util::getVersion()),
+ 'version' => implode('x', [8, 1, 0, 7]),
'filter' => 'approved',
'categories' => '815x1337',
'sortmode' => 'new',
@@ -316,7 +319,7 @@ class OCSClientTest extends \Test\TestCase {
]
);
- $this->assertSame([], $this->ocsClient->getApplications([815, 1337], 1, 'approved'));
+ $this->assertSame([], $this->ocsClient->getApplications([815, 1337], 1, 'approved', [8, 1, 0, 7]));
}
public function testGetApplicationsParseError() {
@@ -346,7 +349,7 @@ class OCSClientTest extends \Test\TestCase {
[
'timeout' => 5,
'query' => [
- 'version' => implode('x', \OC_Util::getVersion()),
+ 'version' => implode('x', [8, 1, 0, 7]),
'filter' => 'approved',
'categories' => '815x1337',
'sortmode' => 'new',
@@ -373,7 +376,7 @@ class OCSClientTest extends \Test\TestCase {
]
);
- $this->assertSame([], $this->ocsClient->getApplications([815, 1337], 1, 'approved'));
+ $this->assertSame([], $this->ocsClient->getApplications([815, 1337], 1, 'approved', [8, 1, 0, 7]));
}
public function testGetApplicationsSuccessful() {
@@ -482,7 +485,7 @@ class OCSClientTest extends \Test\TestCase {
[
'timeout' => 5,
'query' => [
- 'version' => implode('x', \OC_Util::getVersion()),
+ 'version' => implode('x', [8, 1, 0, 7]),
'filter' => 'approved',
'categories' => '815x1337',
'sortmode' => 'new',
@@ -539,7 +542,7 @@ class OCSClientTest extends \Test\TestCase {
'profilepage' => 'http://opendesktop.org/usermanager/search.php?username=owncloud',
],
];
- $this->assertEquals($expected, $this->ocsClient->getApplications([815, 1337], 1, 'approved'));
+ $this->assertEquals($expected, $this->ocsClient->getApplications([815, 1337], 1, 'approved', [8, 1, 0, 7]));
}
public function tesGetApplicationDisabledAppStore() {
@@ -548,7 +551,7 @@ class OCSClientTest extends \Test\TestCase {
->method('getSystemValue')
->with('appstoreenabled', true)
->will($this->returnValue(false));
- $this->assertNull($this->ocsClient->getApplication('MyId'));
+ $this->assertNull($this->ocsClient->getApplication('MyId', [8, 1, 0, 7]));
}
public function testGetApplicationExceptionClient() {
@@ -571,6 +574,7 @@ class OCSClientTest extends \Test\TestCase {
'https://api.owncloud.com/v1/content/data/MyId',
[
'timeout' => 5,
+ 'query' => ['version' => '8x1x0x7'],
]
)
->will($this->throwException(new \Exception('TheErrorMessage')));
@@ -590,7 +594,7 @@ class OCSClientTest extends \Test\TestCase {
]
);
- $this->assertNull($this->ocsClient->getApplication('MyId'));
+ $this->assertNull($this->ocsClient->getApplication('MyId', [8, 1, 0, 7]));
}
public function testGetApplicationParseError() {
@@ -619,6 +623,7 @@ class OCSClientTest extends \Test\TestCase {
'https://api.owncloud.com/v1/content/data/MyId',
[
'timeout' => 5,
+ 'query' => ['version' => '8x1x0x7'],
]
)
->will($this->returnValue($response));
@@ -638,7 +643,7 @@ class OCSClientTest extends \Test\TestCase {
]
);
- $this->assertNull($this->ocsClient->getApplication('MyId'));
+ $this->assertNull($this->ocsClient->getApplication('MyId', [8, 1, 0, 7]));
}
public function testGetApplicationSuccessful() {
@@ -745,6 +750,7 @@ class OCSClientTest extends \Test\TestCase {
'https://api.owncloud.com/v1/content/data/MyId',
[
'timeout' => 5,
+ 'query' => ['version' => '8x1x0x7'],
]
)
->will($this->returnValue($response));
@@ -771,7 +777,7 @@ class OCSClientTest extends \Test\TestCase {
'description' => 'Placeholder for future updates',
'score' => 50,
];
- $this->assertSame($expected, $this->ocsClient->getApplication('MyId'));
+ $this->assertSame($expected, $this->ocsClient->getApplication('MyId', [8, 1, 0, 7]));
}
public function testGetApplicationEmptyXml() {
$this->config
@@ -807,6 +813,7 @@ class OCSClientTest extends \Test\TestCase {
'https://api.owncloud.com/v1/content/data/MyId',
[
'timeout' => 5,
+ 'query' => ['version' => '8x1x0x7'],
]
)
->will($this->returnValue($response));
@@ -816,7 +823,7 @@ class OCSClientTest extends \Test\TestCase {
->method('newClient')
->will($this->returnValue($client));
- $this->assertSame(null, $this->ocsClient->getApplication('MyId'));
+ $this->assertSame(null, $this->ocsClient->getApplication('MyId', [8, 1, 0, 7]));
}
public function testGetApplicationDownloadDisabledAppStore() {
@@ -825,7 +832,7 @@ class OCSClientTest extends \Test\TestCase {
->method('getSystemValue')
->with('appstoreenabled', true)
->will($this->returnValue(false));
- $this->assertNull($this->ocsClient->getApplicationDownload('MyId'));
+ $this->assertNull($this->ocsClient->getApplicationDownload('MyId', [8, 1, 0, 7]));
}
public function testGetApplicationDownloadExceptionClient() {
@@ -848,6 +855,7 @@ class OCSClientTest extends \Test\TestCase {
'https://api.owncloud.com/v1/content/download/MyId/1',
[
'timeout' => 5,
+ 'query' => ['version' => '8x1x0x7'],
]
)
->will($this->throwException(new \Exception('TheErrorMessage')));
@@ -867,7 +875,7 @@ class OCSClientTest extends \Test\TestCase {
]
);
- $this->assertNull($this->ocsClient->getApplicationDownload('MyId'));
+ $this->assertNull($this->ocsClient->getApplicationDownload('MyId', [8, 1, 0, 7]));
}
public function testGetApplicationDownloadParseError() {
@@ -896,6 +904,7 @@ class OCSClientTest extends \Test\TestCase {
'https://api.owncloud.com/v1/content/download/MyId/1',
[
'timeout' => 5,
+ 'query' => ['version' => '8x1x0x7'],
]
)
->will($this->returnValue($response));
@@ -915,7 +924,7 @@ class OCSClientTest extends \Test\TestCase {
]
);
- $this->assertNull($this->ocsClient->getApplicationDownload('MyId'));
+ $this->assertNull($this->ocsClient->getApplicationDownload('MyId', [8, 1, 0, 7]));
}
public function testGetApplicationDownloadUrlSuccessful() {
@@ -962,6 +971,7 @@ class OCSClientTest extends \Test\TestCase {
'https://api.owncloud.com/v1/content/download/MyId/1',
[
'timeout' => 5,
+ 'query' => ['version' => '8x1x0x7'],
]
)
->will($this->returnValue($response));
@@ -974,6 +984,6 @@ class OCSClientTest extends \Test\TestCase {
$expected = [
'downloadlink' => 'https://apps.owncloud.com/CONTENT/content-files/166052-files_trashbin.zip',
];
- $this->assertSame($expected, $this->ocsClient->getApplicationDownload('MyId'));
+ $this->assertSame($expected, $this->ocsClient->getApplicationDownload('MyId', [8, 1, 0, 7]));
}
}