diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-12-05 11:32:49 +0100 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-12-05 11:32:49 +0100 |
commit | 72c7fad1c4997f7dd386f2476a084dcbbcc665a9 (patch) | |
tree | 8b7d946ccb7b7c25d6f379690f4a829f02fa6d82 /apps | |
parent | 578648a062e9cb72248a2f625ac367d19033a24e (diff) | |
download | nextcloud-server-72c7fad1c4997f7dd386f2476a084dcbbcc665a9.tar.gz nextcloud-server-72c7fad1c4997f7dd386f2476a084dcbbcc665a9.zip |
Fix job tests in updatenotification and user_ldap applications
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/updatenotification/tests/Notification/BackgroundJobTest.php | 26 | ||||
-rw-r--r-- | apps/user_ldap/tests/Jobs/CleanUpTest.php | 4 |
2 files changed, 19 insertions, 11 deletions
diff --git a/apps/updatenotification/tests/Notification/BackgroundJobTest.php b/apps/updatenotification/tests/Notification/BackgroundJobTest.php index d4d7a543e56..70d1a918a01 100644 --- a/apps/updatenotification/tests/Notification/BackgroundJobTest.php +++ b/apps/updatenotification/tests/Notification/BackgroundJobTest.php @@ -31,6 +31,7 @@ use OC\Installer; use OC\Updater\VersionCheck; use OCA\UpdateNotification\Notification\BackgroundJob; use OCP\App\IAppManager; +use OCP\AppFramework\Utility\ITimeFactory; use OCP\Http\Client\IClientService; use OCP\IConfig; use OCP\IGroup; @@ -38,22 +39,24 @@ use OCP\IGroupManager; use OCP\IUser; use OCP\Notification\IManager; use OCP\Notification\INotification; +use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class BackgroundJobTest extends TestCase { - - /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IConfig|MockObject */ protected $config; - /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IManager|MockObject */ protected $notificationManager; - /** @var IGroupManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IGroupManager|MockObject */ protected $groupManager; - /** @var IAppManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IAppManager|MockObject */ protected $appManager; - /** @var IClientService|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IClientService|MockObject */ protected $client; - /** @var Installer|\PHPUnit\Framework\MockObject\MockObject */ + /** @var Installer|MockObject */ protected $installer; + /** @var ITimeFactory|MockObject */ + protected $timeFactory; protected function setUp(): void { parent::setUp(); @@ -64,15 +67,17 @@ class BackgroundJobTest extends TestCase { $this->appManager = $this->createMock(IAppManager::class); $this->client = $this->createMock(IClientService::class); $this->installer = $this->createMock(Installer::class); + $this->timeFactory = $this->createMock(ITimeFactory::class); } /** * @param array $methods - * @return BackgroundJob|\PHPUnit\Framework\MockObject\MockObject + * @return BackgroundJob|MockObject */ protected function getJob(array $methods = []) { if (empty($methods)) { return new BackgroundJob( + $this->timeFactory, $this->config, $this->notificationManager, $this->groupManager, @@ -84,6 +89,7 @@ class BackgroundJobTest extends TestCase { { return $this->getMockBuilder(BackgroundJob::class) ->setConstructorArgs([ + $this->timeFactory, $this->config, $this->notificationManager, $this->groupManager, @@ -429,7 +435,7 @@ class BackgroundJobTest extends TestCase { /** * @param string[] $userIds - * @return IUser[]|\PHPUnit\Framework\MockObject\MockObject[] + * @return IUser[]|MockObject[] */ protected function getUsers(array $userIds): array { $users = []; @@ -445,7 +451,7 @@ class BackgroundJobTest extends TestCase { /** * @param string $gid - * @return \OCP\IGroup|\PHPUnit\Framework\MockObject\MockObject + * @return \OCP\IGroup|MockObject */ protected function getGroup(string $gid) { $group = $this->createMock(IGroup::class); diff --git a/apps/user_ldap/tests/Jobs/CleanUpTest.php b/apps/user_ldap/tests/Jobs/CleanUpTest.php index f70d65a6ea2..4dca6367706 100644 --- a/apps/user_ldap/tests/Jobs/CleanUpTest.php +++ b/apps/user_ldap/tests/Jobs/CleanUpTest.php @@ -29,6 +29,7 @@ use OCA\User_LDAP\Helper; use OCA\User_LDAP\Jobs\CleanUp; use OCA\User_LDAP\User\DeletedUsersIndex; use OCA\User_LDAP\User_Proxy; +use OCP\AppFramework\Utility\ITimeFactory; use OCP\IConfig; use OCP\IDBConnection; use Test\TestCase; @@ -42,7 +43,7 @@ class CleanUpTest extends TestCase { public function setUp(): void { $this->createMocks(); - $this->bgJob = new CleanUp($this->mocks['userBackend'], $this->mocks['deletedUsersIndex']); + $this->bgJob = new CleanUp($this->mocks['timeFactory'], $this->mocks['userBackend'], $this->mocks['deletedUsersIndex']); $this->bgJob->setArguments($this->mocks); } @@ -53,6 +54,7 @@ class CleanUpTest extends TestCase { $this->mocks['ocConfig'] = $this->createMock(IConfig::class); $this->mocks['db'] = $this->createMock(IDBConnection::class); $this->mocks['helper'] = $this->createMock(Helper::class); + $this->mocks['timeFactory'] = $this->createMock(ITimeFactory::class); } /** |