Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-08-23 17:55:42 +0300
committerGitHub <noreply@github.com>2022-08-23 17:55:42 +0300
commitb888c6146327d842e21988b0d90d6ade4f3a9435 (patch)
treeaa115b3d420cb6ccfa18a6a5af146eff8578b82c /tests
parent5f90a6a5e2da08e7098cc44937c1713375823e74 (diff)
parent49334e4d9c278d33ce9fd4195b5a12af99821be2 (diff)
Merge pull request #33047 from nextcloud/fix/ijob-logger-deprecated
Deprecated ILogger from IJob
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/App/DependencyAnalyzerTest.php2
-rw-r--r--tests/lib/BackgroundJob/DummyJobList.php2
-rw-r--r--tests/lib/Migration/BackgroundRepairTest.php25
3 files changed, 18 insertions, 11 deletions
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');
diff --git a/tests/lib/BackgroundJob/DummyJobList.php b/tests/lib/BackgroundJob/DummyJobList.php
index be9c06257b7..4d14ed9e7db 100644
--- a/tests/lib/BackgroundJob/DummyJobList.php
+++ b/tests/lib/BackgroundJob/DummyJobList.php
@@ -33,7 +33,7 @@ class DummyJobList extends \OC\BackgroundJob\JobList {
public function add($job, $argument = null): void {
if (is_string($job)) {
/** @var IJob $job */
- $job = new $job;
+ $job = \OCP\Server::get($job);
}
$job->setArgument($argument);
if (!$this->has($job, null)) {
diff --git a/tests/lib/Migration/BackgroundRepairTest.php b/tests/lib/Migration/BackgroundRepairTest.php
index 4e95915e624..7da9b18de30 100644
--- a/tests/lib/Migration/BackgroundRepairTest.php
+++ b/tests/lib/Migration/BackgroundRepairTest.php
@@ -23,12 +23,13 @@ namespace Test\Migration;
use OC\Migration\BackgroundRepair;
use OC\NeedsUpdateException;
-use OCP\ILogger;
+use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use Test\TestCase;
+use Psr\Log\LoggerInterface;
class TestRepairStep implements IRepairStep {
@@ -62,31 +63,37 @@ class BackgroundRepairTest extends TestCase {
/** @var BackgroundRepair|\PHPUnit\Framework\MockObject\MockObject */
private $job;
- /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
/** @var EventDispatcherInterface|\PHPUnit\Framework\MockObject\MockObject $dispatcher */
private $dispatcher;
+ /** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject $dispatcher */
+ private $time;
+
protected function setUp(): void {
parent::setUp();
$this->jobList = $this->getMockBuilder('OC\BackgroundJob\JobList')
->disableOriginalConstructor()
->getMock();
- $this->logger = $this->getMockBuilder(ILogger::class)
+ $this->logger = $this->getMockBuilder(LoggerInterface::class)
->disableOriginalConstructor()
->getMock();
$this->dispatcher = $this->createMock(EventDispatcherInterface::class);
+ $this->time = $this->createMock(ITimeFactory::class);
+ $this->time->method('getTime')
+ ->willReturn(999999);
$this->job = $this->getMockBuilder(BackgroundRepair::class)
- ->setConstructorArgs([$this->dispatcher])
+ ->setConstructorArgs([$this->dispatcher, $this->time, $this->logger, $this->jobList])
->setMethods(['loadApp'])
->getMock();
}
public function testNoArguments() {
$this->jobList->expects($this->once())->method('remove');
- $this->job->execute($this->jobList);
+ $this->job->start($this->jobList);
}
public function testAppUpgrading() {
@@ -96,20 +103,20 @@ class BackgroundRepairTest extends TestCase {
'app' => 'test',
'step' => 'j'
]);
- $this->job->execute($this->jobList);
+ $this->job->start($this->jobList);
}
public function testUnknownStep() {
$this->dispatcher->expects($this->never())->method('dispatch');
$this->jobList->expects($this->once())->method('remove');
- $this->logger->expects($this->once())->method('logException');
+ $this->logger->expects($this->once())->method('error');
$this->job->setArgument([
'app' => 'test',
'step' => 'j'
]);
- $this->job->execute($this->jobList, $this->logger);
+ $this->job->start($this->jobList);
}
public function testWorkingStep() {
@@ -122,6 +129,6 @@ class BackgroundRepairTest extends TestCase {
'app' => 'test',
'step' => '\Test\Migration\TestRepairStep'
]);
- $this->job->execute($this->jobList, $this->logger);
+ $this->job->start($this->jobList);
}
}