diff options
author | Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com> | 2023-07-21 11:04:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-21 11:04:32 +0200 |
commit | e9b8a34cce59c7bd6ef6bec6b9c4846c062e4a7b (patch) | |
tree | 6dc36af91dc435a6397175873866eb4fb6d95cd0 /tests | |
parent | fefc079bd6e59583d6b7147c85fe2d8f30b38a77 (diff) | |
parent | 31f135477792902c3b7380fba6406202e7815ca1 (diff) | |
download | nextcloud-server-e9b8a34cce59c7bd6ef6bec6b9c4846c062e4a7b.tar.gz nextcloud-server-e9b8a34cce59c7bd6ef6bec6b9c4846c062e4a7b.zip |
Merge pull request #39264 from nextcloud/feat/add-instance-category
Add instance category while checking new updates
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Updater/VersionCheckTest.php | 27 |
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()) |