aboutsummaryrefslogtreecommitdiffstats
path: root/tests/Core/Command
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Core/Command')
-rw-r--r--tests/Core/Command/Apps/AppsDisableTest.php8
-rw-r--r--tests/Core/Command/Apps/AppsEnableTest.php13
-rw-r--r--tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php3
-rw-r--r--tests/Core/Command/Encryption/DecryptAllTest.php8
-rw-r--r--tests/Core/Command/Encryption/SetDefaultModuleTest.php2
-rw-r--r--tests/Core/Command/Log/FileTest.php2
-rw-r--r--tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php6
-rw-r--r--tests/Core/Command/Preview/RepairTest.php2
-rw-r--r--tests/Core/Command/SystemTag/AddTest.php2
-rw-r--r--tests/Core/Command/SystemTag/DeleteTest.php2
-rw-r--r--tests/Core/Command/SystemTag/EditTest.php2
-rw-r--r--tests/Core/Command/User/AddTest.php4
12 files changed, 30 insertions, 24 deletions
diff --git a/tests/Core/Command/Apps/AppsDisableTest.php b/tests/Core/Command/Apps/AppsDisableTest.php
index ce43222e44e..283727c1a04 100644
--- a/tests/Core/Command/Apps/AppsDisableTest.php
+++ b/tests/Core/Command/Apps/AppsDisableTest.php
@@ -9,6 +9,8 @@ declare(strict_types=1);
namespace Tests\Core\Command\Config;
use OC\Core\Command\App\Disable;
+use OCP\App\IAppManager;
+use OCP\Server;
use Symfony\Component\Console\Tester\CommandTester;
use Test\TestCase;
@@ -25,13 +27,13 @@ class AppsDisableTest extends TestCase {
parent::setUp();
$command = new Disable(
- \OC::$server->getAppManager()
+ Server::get(IAppManager::class)
);
$this->commandTester = new CommandTester($command);
- \OC::$server->getAppManager()->enableApp('admin_audit');
- \OC::$server->getAppManager()->enableApp('comments');
+ Server::get(IAppManager::class)->enableApp('admin_audit');
+ Server::get(IAppManager::class)->enableApp('comments');
}
/**
diff --git a/tests/Core/Command/Apps/AppsEnableTest.php b/tests/Core/Command/Apps/AppsEnableTest.php
index 59b5dad6406..efaa7da984b 100644
--- a/tests/Core/Command/Apps/AppsEnableTest.php
+++ b/tests/Core/Command/Apps/AppsEnableTest.php
@@ -10,6 +10,9 @@ namespace Tests\Core\Command\Config;
use OC\Core\Command\App\Enable;
use OC\Installer;
+use OCP\App\IAppManager;
+use OCP\IGroupManager;
+use OCP\Server;
use Symfony\Component\Console\Tester\CommandTester;
use Test\TestCase;
@@ -26,15 +29,15 @@ class AppsEnableTest extends TestCase {
parent::setUp();
$command = new Enable(
- \OC::$server->getAppManager(),
- \OC::$server->getGroupManager(),
- \OC::$server->get(Installer::class),
+ Server::get(IAppManager::class),
+ Server::get(IGroupManager::class),
+ Server::get(Installer::class),
);
$this->commandTester = new CommandTester($command);
- \OC::$server->getAppManager()->disableApp('admin_audit');
- \OC::$server->getAppManager()->disableApp('comments');
+ Server::get(IAppManager::class)->disableApp('admin_audit');
+ Server::get(IAppManager::class)->disableApp('comments');
}
/**
diff --git a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php
index 8232db70504..a2d1434e905 100644
--- a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php
+++ b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php
@@ -8,6 +8,7 @@
namespace Tests\Core\Command\Encryption;
use OC\Core\Command\Encryption\ChangeKeyStorageRoot;
+use OC\Encryption\Keys\Storage;
use OC\Encryption\Util;
use OC\Files\View;
use OCP\IConfig;
@@ -157,7 +158,7 @@ class ChangeKeyStorageRootTest extends TestCase {
->willReturn(true);
$this->view->expects($this->once())->method('file_put_contents')
- ->with('newRoot/' . \OC\Encryption\Keys\Storage::KEY_STORAGE_MARKER,
+ ->with('newRoot/' . Storage::KEY_STORAGE_MARKER,
'Nextcloud will detect this folder as key storage root only if this file exists')->willReturn(true);
$this->invokePrivate($this->changeKeyStorageRoot, 'prepareNewRoot', ['newRoot']);
diff --git a/tests/Core/Command/Encryption/DecryptAllTest.php b/tests/Core/Command/Encryption/DecryptAllTest.php
index 45b331efb59..ea22c101845 100644
--- a/tests/Core/Command/Encryption/DecryptAllTest.php
+++ b/tests/Core/Command/Encryption/DecryptAllTest.php
@@ -79,7 +79,7 @@ class DecryptAllTest extends TestCase {
];
$this->config->expects($this->exactly(2))
->method('setSystemValue')
- ->willReturnCallback(function () use (&$calls) {
+ ->willReturnCallback(function () use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, func_get_args());
});
@@ -137,7 +137,7 @@ class DecryptAllTest extends TestCase {
];
$this->config->expects($this->exactly(2))
->method('setAppValue')
- ->willReturnCallback(function () use (&$calls) {
+ ->willReturnCallback(function () use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, func_get_args());
});
@@ -188,7 +188,7 @@ class DecryptAllTest extends TestCase {
];
$this->config->expects($this->exactly(2))
->method('setAppValue')
- ->willReturnCallback(function () use (&$calls) {
+ ->willReturnCallback(function () use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, func_get_args());
});
@@ -208,7 +208,7 @@ class DecryptAllTest extends TestCase {
$this->decryptAll->expects($this->once())
->method('decryptAll')
->with($this->consoleInput, $this->consoleOutput, 'user1')
- ->willReturnCallback(function () {
+ ->willReturnCallback(function (): void {
throw new \Exception();
});
diff --git a/tests/Core/Command/Encryption/SetDefaultModuleTest.php b/tests/Core/Command/Encryption/SetDefaultModuleTest.php
index 52f14dd4537..4ba7b7e8c97 100644
--- a/tests/Core/Command/Encryption/SetDefaultModuleTest.php
+++ b/tests/Core/Command/Encryption/SetDefaultModuleTest.php
@@ -119,7 +119,7 @@ class SetDefaultModuleTest extends TestCase {
];
$this->consoleOutput->expects($this->exactly(2))
->method('writeln')
- ->willReturnCallback(function ($message) use (&$calls) {
+ ->willReturnCallback(function ($message) use (&$calls): void {
$expected = array_shift($calls);
$this->assertStringContainsString($expected, $message);
});
diff --git a/tests/Core/Command/Log/FileTest.php b/tests/Core/Command/Log/FileTest.php
index 1286fca35a3..627f2b0e08f 100644
--- a/tests/Core/Command/Log/FileTest.php
+++ b/tests/Core/Command/Log/FileTest.php
@@ -103,7 +103,7 @@ class FileTest extends TestCase {
];
$this->consoleOutput->expects($this->exactly(3))
->method('writeln')
- ->willReturnCallback(function (string $message) use (&$calls) {
+ ->willReturnCallback(function (string $message) use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected[0], $message);
});
diff --git a/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php b/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php
index 2f232837fe2..532e965cc89 100644
--- a/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php
+++ b/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php
@@ -65,7 +65,7 @@ class UpdateDBTest extends TestCase {
];
$this->consoleOutput->expects($this->exactly(2))
->method('writeln')
- ->willReturnCallback(function ($message) use (&$calls) {
+ ->willReturnCallback(function ($message) use (&$calls): void {
$expected = array_shift($calls);
$this->assertStringContainsString($expected, $message);
});
@@ -110,7 +110,7 @@ class UpdateDBTest extends TestCase {
];
$this->consoleOutput->expects($this->exactly(4))
->method('writeln')
- ->willReturnCallback(function ($message) use (&$calls) {
+ ->willReturnCallback(function ($message) use (&$calls): void {
$expected = array_shift($calls);
$this->assertStringContainsString($expected, $message);
});
@@ -163,7 +163,7 @@ class UpdateDBTest extends TestCase {
];
$this->consoleOutput->expects($this->exactly(3))
->method('writeln')
- ->willReturnCallback(function ($message) use (&$calls) {
+ ->willReturnCallback(function ($message) use (&$calls): void {
$expected = array_shift($calls);
$this->assertStringContainsString($expected, $message);
});
diff --git a/tests/Core/Command/Preview/RepairTest.php b/tests/Core/Command/Preview/RepairTest.php
index d522816e531..7e45a8d3a19 100644
--- a/tests/Core/Command/Preview/RepairTest.php
+++ b/tests/Core/Command/Preview/RepairTest.php
@@ -79,7 +79,7 @@ class RepairTest extends TestCase {
->willReturn($outputFormatter);
$this->output->expects($this->any())
->method('writeln')
- ->willReturnCallback(function ($line) use ($self) {
+ ->willReturnCallback(function ($line) use ($self): void {
$self->outputLines .= $line . "\n";
});
}
diff --git a/tests/Core/Command/SystemTag/AddTest.php b/tests/Core/Command/SystemTag/AddTest.php
index b697cd1d2f0..68d9b494502 100644
--- a/tests/Core/Command/SystemTag/AddTest.php
+++ b/tests/Core/Command/SystemTag/AddTest.php
@@ -93,7 +93,7 @@ class AddTest extends TestCase {
$tag->method('getAccessLevel')->willReturn(ISystemTag::ACCESS_LEVEL_PUBLIC);
$this->systemTagManager->method('createTag')
- ->willReturnCallback(function ($tagName, $userVisible, $userAssignable) {
+ ->willReturnCallback(function ($tagName, $userVisible, $userAssignable): void {
throw new TagAlreadyExistsException(
'Tag ("' . $tagName . '", ' . $userVisible . ', ' . $userAssignable . ') already exists'
);
diff --git a/tests/Core/Command/SystemTag/DeleteTest.php b/tests/Core/Command/SystemTag/DeleteTest.php
index 3c7a6e24c21..716b6a3b830 100644
--- a/tests/Core/Command/SystemTag/DeleteTest.php
+++ b/tests/Core/Command/SystemTag/DeleteTest.php
@@ -69,7 +69,7 @@ class DeleteTest extends TestCase {
});
$this->systemTagManager->method('deleteTags')
- ->willReturnCallback(function ($tagId) {
+ ->willReturnCallback(function ($tagId): void {
throw new TagNotFoundException();
});
diff --git a/tests/Core/Command/SystemTag/EditTest.php b/tests/Core/Command/SystemTag/EditTest.php
index 637172222eb..cc68f8004f5 100644
--- a/tests/Core/Command/SystemTag/EditTest.php
+++ b/tests/Core/Command/SystemTag/EditTest.php
@@ -134,7 +134,7 @@ class EditTest extends TestCase {
});
$this->systemTagManager->method('updateTag')
- ->willReturnCallback(function ($tagId, $tagName, $userVisible, $userAssignable) {
+ ->willReturnCallback(function ($tagId, $tagName, $userVisible, $userAssignable): void {
throw new TagAlreadyExistsException(
'Tag ("' . $tagName . '", ' . $userVisible . ', ' . $userAssignable . ') already exists'
);
diff --git a/tests/Core/Command/User/AddTest.php b/tests/Core/Command/User/AddTest.php
index 91535ea6670..546061fc2f0 100644
--- a/tests/Core/Command/User/AddTest.php
+++ b/tests/Core/Command/User/AddTest.php
@@ -111,11 +111,11 @@ class AddTest extends TestCase {
->method('sendMail');
$this->consoleInput->method('getOption')
- ->will(static::returnValueMap([
+ ->willReturnMap([
['generate-password', 'true'],
['email', $email],
['group', []],
- ]));
+ ]);
$this->invokePrivate($this->addCommand, 'execute', [
$this->consoleInput,