diff options
Diffstat (limited to 'apps/updatenotification/tests/Notification/BackgroundJobTest.php')
-rw-r--r-- | apps/updatenotification/tests/Notification/BackgroundJobTest.php | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/apps/updatenotification/tests/Notification/BackgroundJobTest.php b/apps/updatenotification/tests/Notification/BackgroundJobTest.php index 70d1a918a01..df8b104e9ca 100644 --- a/apps/updatenotification/tests/Notification/BackgroundJobTest.php +++ b/apps/updatenotification/tests/Notification/BackgroundJobTest.php @@ -32,7 +32,6 @@ 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; use OCP\IGroupManager; @@ -51,12 +50,12 @@ class BackgroundJobTest extends TestCase { protected $groupManager; /** @var IAppManager|MockObject */ protected $appManager; - /** @var IClientService|MockObject */ - protected $client; - /** @var Installer|MockObject */ - protected $installer; /** @var ITimeFactory|MockObject */ protected $timeFactory; + /** @var Installer|MockObject */ + protected $installer; + /** @var VersionCheck|MockObject */ + protected $versionCheck; protected function setUp(): void { parent::setUp(); @@ -65,9 +64,9 @@ class BackgroundJobTest extends TestCase { $this->notificationManager = $this->createMock(IManager::class); $this->groupManager = $this->createMock(IGroupManager::class); $this->appManager = $this->createMock(IAppManager::class); - $this->client = $this->createMock(IClientService::class); - $this->installer = $this->createMock(Installer::class); $this->timeFactory = $this->createMock(ITimeFactory::class); + $this->installer = $this->createMock(Installer::class); + $this->versionCheck = $this->createMock(VersionCheck::class); } /** @@ -82,8 +81,8 @@ class BackgroundJobTest extends TestCase { $this->notificationManager, $this->groupManager, $this->appManager, - $this->client, - $this->installer + $this->installer, + $this->versionCheck, ); } { @@ -94,8 +93,8 @@ class BackgroundJobTest extends TestCase { $this->notificationManager, $this->groupManager, $this->appManager, - $this->client, $this->installer, + $this->versionCheck, ]) ->setMethods($methods) ->getMock(); @@ -160,7 +159,6 @@ class BackgroundJobTest extends TestCase { public function testCheckCoreUpdate(string $channel, $versionCheck, $version, $readableVersion, $errorDays) { $job = $this->getJob([ 'getChannel', - 'createVersionCheck', 'createNotifications', 'clearErrorNotifications', 'sendErrorNotifications', @@ -171,17 +169,12 @@ class BackgroundJobTest extends TestCase { ->willReturn($channel); if ($versionCheck === null) { - $job->expects($this->never()) - ->method('createVersionCheck'); + $this->versionCheck->expects($this->never()) + ->method('check'); } else { - $check = $this->createMock(VersionCheck::class); - $check->expects($this->once()) + $this->versionCheck->expects($this->once()) ->method('check') ->willReturn($versionCheck); - - $job->expects($this->once()) - ->method('createVersionCheck') - ->willReturn($check); } if ($version === null) { |