aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBenjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>2023-07-07 09:51:08 +0200
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>2023-07-21 10:02:58 +0000
commit46b462285d9f377348b33d44924827fb11a14e32 (patch)
tree4f5088444fa705b5112c2cdc5c2dd2bd822f2c9c /tests
parent841c5c3527326426a8f4d1fd7bf5fe672dc08220 (diff)
downloadnextcloud-server-46b462285d9f377348b33d44924827fb11a14e32.tar.gz
nextcloud-server-46b462285d9f377348b33d44924827fb11a14e32.zip
Add instance category while checking new updates
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Updater/VersionCheckTest.php27
1 files changed, 20 insertions, 7 deletions
diff --git a/tests/lib/Updater/VersionCheckTest.php b/tests/lib/Updater/VersionCheckTest.php
index 1cd632875c3..be847253035 100644
--- a/tests/lib/Updater/VersionCheckTest.php
+++ b/tests/lib/Updater/VersionCheckTest.php
@@ -25,6 +25,8 @@ namespace Test\Updater;
use OC\Updater\VersionCheck;
use OCP\Http\Client\IClientService;
use OCP\IConfig;
+use OCP\IUserManager;
+use OCP\Support\Subscription\IRegistry;
use OCP\Util;
class VersionCheckTest extends \Test\TestCase {
@@ -32,6 +34,8 @@ class VersionCheckTest extends \Test\TestCase {
private $config;
/** @var VersionCheck | \PHPUnit\Framework\MockObject\MockObject*/
private $updater;
+ /** @var IRegistry | \PHPUnit\Framework\Mo2ckObject\MockObject*/
+ private $registry;
protected function setUp(): void {
parent::setUp();
@@ -42,9 +46,18 @@ class VersionCheckTest extends \Test\TestCase {
->disableOriginalConstructor()
->getMock();
+ $this->registry = $this->createMock(IRegistry::class);
+ $this->registry
+ ->method('delegateHasValidSubscription')
+ ->willReturn(false);
$this->updater = $this->getMockBuilder(VersionCheck::class)
->setMethods(['getUrlContent'])
- ->setConstructorArgs([$clientService, $this->config])
+ ->setConstructorArgs([
+ $clientService,
+ $this->config,
+ $this->createMock(IUserManager::class),
+ $this->registry,
+ ])
->getMock();
}
@@ -53,7 +66,7 @@ class VersionCheckTest extends \Test\TestCase {
* @return string
*/
private function buildUpdateUrl($baseUrl) {
- return $baseUrl . '?version='.implode('x', Util::getVersion()).'xinstalledatxlastupdatedatx'.\OC_Util::getChannel().'xxx'.PHP_MAJOR_VERSION.'x'.PHP_MINOR_VERSION.'x'.PHP_RELEASE_VERSION;
+ return $baseUrl . '?version='.implode('x', Util::getVersion()).'xinstalledatxlastupdatedatx'.\OC_Util::getChannel().'xxx'.PHP_MAJOR_VERSION.'x'.PHP_MINOR_VERSION.'x'.PHP_RELEASE_VERSION.'x0x0';
}
public function testCheckInCache() {
@@ -114,7 +127,7 @@ class VersionCheckTest extends \Test\TestCase {
'0',
'installedat',
'installedat',
- 'lastupdatedat'
+ 'lastupdatedat',
);
$this->config
->expects($this->once())
@@ -166,7 +179,7 @@ class VersionCheckTest extends \Test\TestCase {
'0',
'installedat',
'installedat',
- 'lastupdatedat'
+ 'lastupdatedat',
);
$this->config
->expects($this->once())
@@ -220,7 +233,7 @@ class VersionCheckTest extends \Test\TestCase {
'0',
'installedat',
'installedat',
- 'lastupdatedat'
+ 'lastupdatedat',
);
$this->config
->expects($this->once())
@@ -273,7 +286,7 @@ class VersionCheckTest extends \Test\TestCase {
'0',
'installedat',
'installedat',
- 'lastupdatedat'
+ 'lastupdatedat',
);
$this->config
->expects($this->once())
@@ -327,7 +340,7 @@ class VersionCheckTest extends \Test\TestCase {
'0',
'installedat',
'installedat',
- 'lastupdatedat'
+ 'lastupdatedat',
);
$this->config
->expects($this->once())