summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files_trashbin/tests/BackgroundJob/ExpireTrashTest.php15
-rw-r--r--apps/files_versions/tests/BackgroundJob/ExpireVersionsTest.php8
-rw-r--r--apps/updatenotification/tests/Settings/AdminTest.php29
-rw-r--r--lib/composer/composer/autoload_classmap.php2
-rw-r--r--lib/composer/composer/autoload_static.php2
-rw-r--r--lib/private/BackgroundJob/Legacy/QueuedJob.php38
-rw-r--r--lib/private/BackgroundJob/Legacy/RegularJob.php41
-rw-r--r--lib/private/Command/CallableJob.php2
-rw-r--r--lib/private/Command/ClosureJob.php2
-rw-r--r--lib/private/Command/CommandJob.php2
-rw-r--r--tests/lib/App/DependencyAnalyzerTest.php2
11 files changed, 37 insertions, 106 deletions
diff --git a/apps/files_trashbin/tests/BackgroundJob/ExpireTrashTest.php b/apps/files_trashbin/tests/BackgroundJob/ExpireTrashTest.php
index d8cce61ca52..bf5d6bc65ae 100644
--- a/apps/files_trashbin/tests/BackgroundJob/ExpireTrashTest.php
+++ b/apps/files_trashbin/tests/BackgroundJob/ExpireTrashTest.php
@@ -48,9 +48,6 @@ class ExpireTrashTest extends TestCase {
/** @var IJobList|MockObject */
private $jobList;
- /** @var LoggerInterface|MockObject */
- private $logger;
-
/** @var ITimeFactory|MockObject */
private $time;
@@ -61,8 +58,10 @@ class ExpireTrashTest extends TestCase {
$this->userManager = $this->createMock(IUserManager::class);
$this->expiration = $this->createMock(Expiration::class);
$this->jobList = $this->createMock(IJobList::class);
- $this->logger = $this->createMock(ILogger::class);
+
$this->time = $this->createMock(ITimeFactory::class);
+ $this->time->method('getTime')
+ ->willReturn(99999999999);
$this->jobList->expects($this->once())
->method('setLastRun');
@@ -71,8 +70,12 @@ class ExpireTrashTest extends TestCase {
}
public function testConstructAndRun(): void {
- $job = new ExpireTrash($this->config, $this->userManager, $this->expiration);
- $job->execute($this->jobList, $this->logger);
+ $this->config->method('getAppValue')
+ ->with('files_trashbin', 'background_job_expire_trash', 'yes')
+ ->willReturn('yes');
+
+ $job = new ExpireTrash($this->config, $this->userManager, $this->expiration, $this->time);
+ $job->start($this->jobList);
}
public function testBackgroundJobDeactivated(): void {
diff --git a/apps/files_versions/tests/BackgroundJob/ExpireVersionsTest.php b/apps/files_versions/tests/BackgroundJob/ExpireVersionsTest.php
index ca584ae9f53..442a7020d89 100644
--- a/apps/files_versions/tests/BackgroundJob/ExpireVersionsTest.php
+++ b/apps/files_versions/tests/BackgroundJob/ExpireVersionsTest.php
@@ -28,7 +28,6 @@ use OCA\Files_Versions\Expiration;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
use OCP\IConfig;
-use OCP\ILogger;
use OCP\IUserManager;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
@@ -68,7 +67,12 @@ class ExpireVersionsTest extends TestCase {
$this->expiration->expects($this->never())
->method('getMaxAgeAsTimestamp');
- $job = new ExpireVersions($this->config, $this->userManager, $this->expiration, $this->createMock(ITimeFactory::class));
+ $timeFactory = $this->createMock(ITimeFactory::class);
+ $timeFactory->method('getTime')
+ ->with()
+ ->willReturn(99999999999);
+
+ $job = new ExpireVersions($this->config, $this->userManager, $this->expiration, $timeFactory);
$job->start($this->jobList);
}
}
diff --git a/apps/updatenotification/tests/Settings/AdminTest.php b/apps/updatenotification/tests/Settings/AdminTest.php
index 852504fb45a..489679dfabd 100644
--- a/apps/updatenotification/tests/Settings/AdminTest.php
+++ b/apps/updatenotification/tests/Settings/AdminTest.php
@@ -36,13 +36,16 @@ use OCP\IConfig;
use OCP\IDateTimeFormatter;
use OCP\IGroup;
use OCP\IGroupManager;
+use OCP\IUserManager;
use OCP\L10N\IFactory;
use OCP\L10N\ILanguageIterator;
use OCP\Support\Subscription\IRegistry;
+use OCP\UserInterface;
+use OCP\User\Backend\ICountUsersBackend;
use OCP\Util;
-use Test\TestCase;
-use OCP\IUserManager;
+use OC\User\Backend;
use Psr\Log\LoggerInterface;
+use Test\TestCase;
class AdminTest extends TestCase {
/** @var IFactory|\PHPUnit\Framework\MockObject\MockObject */
@@ -89,9 +92,9 @@ class AdminTest extends TestCase {
}
public function testGetFormWithUpdate() {
- $backend1 = $this->createMock(UserInterface::class);
- $backend2 = $this->createMock(UserInterface::class);
- $backend3 = $this->createMock(UserInterface::class);
+ $backend1 = $this->createMock(CountUsersBackend::class);
+ $backend2 = $this->createMock(CountUsersBackend::class);
+ $backend3 = $this->createMock(CountUsersBackend::class);
$backend1
->expects($this->once())
->method('implementsActions')
@@ -213,9 +216,9 @@ class AdminTest extends TestCase {
}
public function testGetFormWithUpdateAndChangedUpdateServer() {
- $backend1 = $this->createMock(UserInterface::class);
- $backend2 = $this->createMock(UserInterface::class);
- $backend3 = $this->createMock(UserInterface::class);
+ $backend1 = $this->createMock(CountUsersBackend::class);
+ $backend2 = $this->createMock(CountUsersBackend::class);
+ $backend3 = $this->createMock(CountUsersBackend::class);
$backend1
->expects($this->once())
->method('implementsActions')
@@ -337,9 +340,9 @@ class AdminTest extends TestCase {
}
public function testGetFormWithUpdateAndCustomersUpdateServer() {
- $backend1 = $this->createMock(UserInterface::class);
- $backend2 = $this->createMock(UserInterface::class);
- $backend3 = $this->createMock(UserInterface::class);
+ $backend1 = $this->createMock(CountUsersBackend::class);
+ $backend2 = $this->createMock(CountUsersBackend::class);
+ $backend3 = $this->createMock(CountUsersBackend::class);
$backend1
->expects($this->once())
->method('implementsActions')
@@ -543,3 +546,7 @@ class AdminTest extends TestCase {
$this->assertSame($expectation, $result);
}
}
+
+abstract class CountUsersBackend implements UserInterface, ICountUsersBackend {
+
+}
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index c55fb8080b0..e602e75680c 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -801,8 +801,6 @@ return array(
'OC\\Avatar\\UserAvatar' => $baseDir . '/lib/private/Avatar/UserAvatar.php',
'OC\\BackgroundJob\\Job' => $baseDir . '/lib/private/BackgroundJob/Job.php',
'OC\\BackgroundJob\\JobList' => $baseDir . '/lib/private/BackgroundJob/JobList.php',
- 'OC\\BackgroundJob\\Legacy\\QueuedJob' => $baseDir . '/lib/private/BackgroundJob/Legacy/QueuedJob.php',
- 'OC\\BackgroundJob\\Legacy\\RegularJob' => $baseDir . '/lib/private/BackgroundJob/Legacy/RegularJob.php',
'OC\\BackgroundJob\\QueuedJob' => $baseDir . '/lib/private/BackgroundJob/QueuedJob.php',
'OC\\BackgroundJob\\TimedJob' => $baseDir . '/lib/private/BackgroundJob/TimedJob.php',
'OC\\Broadcast\\Events\\BroadcastEvent' => $baseDir . '/lib/private/Broadcast/Events/BroadcastEvent.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index 16b147814c4..64d0e8f17d3 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -834,8 +834,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OC\\Avatar\\UserAvatar' => __DIR__ . '/../../..' . '/lib/private/Avatar/UserAvatar.php',
'OC\\BackgroundJob\\Job' => __DIR__ . '/../../..' . '/lib/private/BackgroundJob/Job.php',
'OC\\BackgroundJob\\JobList' => __DIR__ . '/../../..' . '/lib/private/BackgroundJob/JobList.php',
- 'OC\\BackgroundJob\\Legacy\\QueuedJob' => __DIR__ . '/../../..' . '/lib/private/BackgroundJob/Legacy/QueuedJob.php',
- 'OC\\BackgroundJob\\Legacy\\RegularJob' => __DIR__ . '/../../..' . '/lib/private/BackgroundJob/Legacy/RegularJob.php',
'OC\\BackgroundJob\\QueuedJob' => __DIR__ . '/../../..' . '/lib/private/BackgroundJob/QueuedJob.php',
'OC\\BackgroundJob\\TimedJob' => __DIR__ . '/../../..' . '/lib/private/BackgroundJob/TimedJob.php',
'OC\\Broadcast\\Events\\BroadcastEvent' => __DIR__ . '/../../..' . '/lib/private/Broadcast/Events/BroadcastEvent.php',
diff --git a/lib/private/BackgroundJob/Legacy/QueuedJob.php b/lib/private/BackgroundJob/Legacy/QueuedJob.php
deleted file mode 100644
index 680c12046c9..00000000000
--- a/lib/private/BackgroundJob/Legacy/QueuedJob.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <robin@icewind.nl>
- *
- * @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/>
- *
- */
-namespace OC\BackgroundJob\Legacy;
-
-/**
- * @deprecated internal class, use \OCP\BackgroundJob\QueuedJob
- */
-class QueuedJob extends \OCP\BackgroundJob\QueuedJob {
- public function run($argument) {
- $class = $argument['klass'];
- $method = $argument['method'];
- $parameters = $argument['parameters'];
- if (is_callable([$class, $method])) {
- call_user_func([$class, $method], $parameters);
- }
- }
-}
diff --git a/lib/private/BackgroundJob/Legacy/RegularJob.php b/lib/private/BackgroundJob/Legacy/RegularJob.php
deleted file mode 100644
index c01d58efa2f..00000000000
--- a/lib/private/BackgroundJob/Legacy/RegularJob.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <robin@icewind.nl>
- *
- * @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/>
- *
- */
-namespace OC\BackgroundJob\Legacy;
-
-use OCP\AutoloadNotAllowedException;
-
-/**
- * @deprecated internal class, use \OCP\BackgroundJob\QueuedJob
- */
-class RegularJob extends \OCP\BackgroundJob\Job {
- public function run($argument) {
- try {
- if (is_callable($argument)) {
- call_user_func($argument);
- }
- } catch (AutoloadNotAllowedException $e) {
- // job is from a disabled app, ignore
- return null;
- }
- }
-}
diff --git a/lib/private/Command/CallableJob.php b/lib/private/Command/CallableJob.php
index 7f515660955..8bb3c76c9af 100644
--- a/lib/private/Command/CallableJob.php
+++ b/lib/private/Command/CallableJob.php
@@ -21,7 +21,7 @@
*/
namespace OC\Command;
-use OCP\BackgroundJob\QueuedJob;
+use OC\BackgroundJob\QueuedJob;
class CallableJob extends QueuedJob {
protected function run($serializedCallable) {
diff --git a/lib/private/Command/ClosureJob.php b/lib/private/Command/ClosureJob.php
index 7ca45cd5fc0..5639852e4db 100644
--- a/lib/private/Command/ClosureJob.php
+++ b/lib/private/Command/ClosureJob.php
@@ -22,7 +22,7 @@
*/
namespace OC\Command;
-use OCP\BackgroundJob\QueuedJob;
+use OC\BackgroundJob\QueuedJob;
use Laravel\SerializableClosure\SerializableClosure as LaravelClosure;
use Opis\Closure\SerializableClosure as OpisClosure;
diff --git a/lib/private/Command/CommandJob.php b/lib/private/Command/CommandJob.php
index 477fd2a8683..5b267162c81 100644
--- a/lib/private/Command/CommandJob.php
+++ b/lib/private/Command/CommandJob.php
@@ -22,7 +22,7 @@
*/
namespace OC\Command;
-use OCP\BackgroundJob\QueuedJob;
+use OC\BackgroundJob\QueuedJob;
use OCP\Command\ICommand;
/**
diff --git a/tests/lib/App/DependencyAnalyzerTest.php b/tests/lib/App/DependencyAnalyzerTest.php
index 1e37948d783..75cc991cf99 100644
--- a/tests/lib/App/DependencyAnalyzerTest.php
+++ b/tests/lib/App/DependencyAnalyzerTest.php
@@ -35,7 +35,7 @@ class DependencyAnalyzerTest extends TestCase {
->willReturn('5.4.3');
$this->platformMock->expects($this->any())
->method('getIntSize')
- ->willReturn('4');
+ ->willReturn(4);
$this->platformMock->expects($this->any())
->method('getDatabase')
->willReturn('mysql');