diff options
author | Andy Scherzinger <info@andy-scherzinger.de> | 2023-07-27 12:04:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-27 12:04:52 +0200 |
commit | 5fbb3bb7f0ad070bf541a1401d1bc98f8b516722 (patch) | |
tree | 724fb4c2db10db8d4977eef331866b2758b594ef /tests | |
parent | d0ac2b4494c0135b400ff8c19f7865edc6f87530 (diff) | |
parent | 46b462285d9f377348b33d44924827fb11a14e32 (diff) | |
download | nextcloud-server-5fbb3bb7f0ad070bf541a1401d1bc98f8b516722.tar.gz nextcloud-server-5fbb3bb7f0ad070bf541a1401d1bc98f8b516722.zip |
Merge pull request #39522 from nextcloud/backport/39264/stable27
[stable27] 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()) |