aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/UpdaterTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/UpdaterTest.php')
-rw-r--r--tests/lib/UpdaterTest.php53
1 files changed, 17 insertions, 36 deletions
diff --git a/tests/lib/UpdaterTest.php b/tests/lib/UpdaterTest.php
index bff50de47e2..37a4a105628 100644
--- a/tests/lib/UpdaterTest.php
+++ b/tests/lib/UpdaterTest.php
@@ -1,23 +1,9 @@
<?php
+
/**
- * @author Lukas Reschke <lukas@owncloud.com>
- * @author Victor Dubiniuk <dubiniuk@owncloud.com>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Test;
@@ -27,10 +13,13 @@ use OC\IntegrityCheck\Checker;
use OC\Updater;
use OCP\IAppConfig;
use OCP\IConfig;
+use OCP\ServerVersion;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
class UpdaterTest extends TestCase {
+ /** @var ServerVersion|MockObject */
+ private $serverVersion;
/** @var IConfig|MockObject */
private $config;
/** @var IAppConfig|MockObject */
@@ -46,23 +35,15 @@ class UpdaterTest extends TestCase {
protected function setUp(): void {
parent::setUp();
- $this->config = $this->getMockBuilder(IConfig::class)
- ->disableOriginalConstructor()
- ->getMock();
- $this->appConfig = $this->getMockBuilder(IAppConfig::class)
- ->disableOriginalConstructor()
- ->getMock();
- $this->logger = $this->getMockBuilder(LoggerInterface::class)
- ->disableOriginalConstructor()
- ->getMock();
- $this->checker = $this->getMockBuilder(Checker::class)
- ->disableOriginalConstructor()
- ->getMock();
- $this->installer = $this->getMockBuilder(Installer::class)
- ->disableOriginalConstructor()
- ->getMock();
+ $this->serverVersion = $this->createMock(ServerVersion::class);
+ $this->config = $this->createMock(IConfig::class);
+ $this->appConfig = $this->createMock(IAppConfig::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
+ $this->checker = $this->createMock(Checker::class);
+ $this->installer = $this->createMock(Installer::class);
$this->updater = new Updater(
+ $this->serverVersion,
$this->config,
$this->appConfig,
$this->checker,
@@ -74,7 +55,7 @@ class UpdaterTest extends TestCase {
/**
* @return array
*/
- public function versionCompatibilityTestData() {
+ public static function versionCompatibilityTestData(): array {
return [
// Upgrade with invalid version
['9.1.1.13', '11.0.2.25', ['nextcloud' => ['11.0' => true]], false],
@@ -101,7 +82,6 @@ class UpdaterTest extends TestCase {
}
/**
- * @dataProvider versionCompatibilityTestData
*
* @param string $oldVersion
* @param string $newVersion
@@ -110,7 +90,8 @@ class UpdaterTest extends TestCase {
* @param bool $debug
* @param string $vendor
*/
- public function testIsUpgradePossible($oldVersion, $newVersion, $allowedVersions, $result, $debug = false, $vendor = 'nextcloud') {
+ #[\PHPUnit\Framework\Attributes\DataProvider('versionCompatibilityTestData')]
+ public function testIsUpgradePossible($oldVersion, $newVersion, $allowedVersions, $result, $debug = false, $vendor = 'nextcloud'): void {
$this->config->expects($this->any())
->method('getSystemValueBool')
->with('debug', false)