mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
test: Fix coding standards
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
57a49a50aa
commit
5f9117b939
22 changed files with 38 additions and 39 deletions
|
|
@ -27,12 +27,12 @@ use PHPUnit\Framework\MockObject\MockObject;
|
|||
use Test\TestCase;
|
||||
|
||||
class ListenerTest extends TestCase {
|
||||
protected IManager&MockObject $activityManager;
|
||||
protected IUserSession&MockObject $session;
|
||||
protected IManager&MockObject $activityManager;
|
||||
protected IUserSession&MockObject $session;
|
||||
protected IAppManager&MockObject $appManager;
|
||||
protected IMountProviderCollection&MockObject $mountProviderCollection;
|
||||
protected IRootFolder&MockObject $rootFolder;
|
||||
protected IShareHelper&MockObject $shareHelper;
|
||||
protected IMountProviderCollection&MockObject $mountProviderCollection;
|
||||
protected IRootFolder&MockObject $rootFolder;
|
||||
protected IShareHelper&MockObject $shareHelper;
|
||||
protected Listener $listener;
|
||||
|
||||
protected function setUp(): void {
|
||||
|
|
|
|||
|
|
@ -9,17 +9,17 @@ declare(strict_types=1);
|
|||
*/
|
||||
namespace OCA\Comments\Tests\Unit\AppInfo;
|
||||
|
||||
use OCA\Comments\Activity\Filter;
|
||||
use OCA\Comments\Activity\Listener;
|
||||
use OCA\Comments\Activity\Provider;
|
||||
use OCA\Comments\Activity\Setting;
|
||||
use OCA\Comments\AppInfo\Application;
|
||||
use OCA\Comments\Controller\NotificationsController;
|
||||
use OCA\Comments\Notification\Notifier;
|
||||
use OCP\IUserManager;
|
||||
use OCP\IUserSession;
|
||||
use OCP\Server;
|
||||
use Test\TestCase;
|
||||
use OCA\Comments\Controller\NotificationsController;
|
||||
use OCA\Comments\Activity\Filter;
|
||||
use OCA\Comments\Activity\Listener;
|
||||
use OCA\Comments\Activity\Provider;
|
||||
use OCA\Comments\Activity\Setting;
|
||||
|
||||
/**
|
||||
* Class ApplicationTest
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use Test\TestCase;
|
|||
|
||||
class ClearNotificationsTest extends TestCase {
|
||||
private IManager&MockObject $notificationManager;
|
||||
private ClearNotifications$listener;
|
||||
private ClearNotifications $listener;
|
||||
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use Test\TestCase;
|
|||
|
||||
class UserStatusProviderTest extends TestCase {
|
||||
private StatusService&MockObject $service;
|
||||
private UserStatusProvider$provider;
|
||||
private UserStatusProvider $provider;
|
||||
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use Test\TestCase;
|
|||
|
||||
class PredefinedStatusControllerTest extends TestCase {
|
||||
private PredefinedStatusService&MockObject $service;
|
||||
private PredefinedStatusController$controller;
|
||||
private PredefinedStatusController $controller;
|
||||
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ namespace OCA\UserStatus\Tests\Listener;
|
|||
use OCA\DAV\CalDAV\Status\StatusService as CalendarStatusService;
|
||||
use OCA\UserStatus\Db\UserStatus;
|
||||
use OCA\UserStatus\Db\UserStatusMapper;
|
||||
use OCA\UserStatus\Listener\UserDeletedListener;
|
||||
use OCA\UserStatus\Listener\UserLiveStatusListener;
|
||||
use OCA\UserStatus\Service\StatusService;
|
||||
use OCP\AppFramework\Db\DoesNotExistException;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class AppConfigTest extends TestCase {
|
|||
|
||||
/**
|
||||
* @var array<string, array<string, array<string, string, int, bool, bool>>>
|
||||
* [appId => [configKey, configValue, valueType, lazy, sensitive]]
|
||||
* [appId => [configKey, configValue, valueType, lazy, sensitive]]
|
||||
*/
|
||||
private static array $baseStruct =
|
||||
[
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ class QBMapperTest extends \Test\TestCase {
|
|||
];
|
||||
$this->qb->expects($this->exactly(6))
|
||||
->method('createNamedParameter')
|
||||
->willReturnCallback(function() use (&$createNamedParameterCalls) {
|
||||
->willReturnCallback(function () use (&$createNamedParameterCalls) {
|
||||
$expected = array_shift($createNamedParameterCalls);
|
||||
$this->assertEquals($expected, func_get_args());
|
||||
});
|
||||
|
|
@ -142,7 +142,7 @@ class QBMapperTest extends \Test\TestCase {
|
|||
];
|
||||
$this->qb->expects($this->exactly(6))
|
||||
->method('setValue')
|
||||
->willReturnCallback(function() use (&$setValueCalls) {
|
||||
->willReturnCallback(function () use (&$setValueCalls) {
|
||||
$expected = array_shift($setValueCalls);
|
||||
$this->assertEquals($expected, func_get_args());
|
||||
});
|
||||
|
|
@ -184,7 +184,7 @@ class QBMapperTest extends \Test\TestCase {
|
|||
];
|
||||
$this->qb->expects($this->exactly(8))
|
||||
->method('createNamedParameter')
|
||||
->willReturnCallback(function() use (&$createNamedParameterCalls) {
|
||||
->willReturnCallback(function () use (&$createNamedParameterCalls) {
|
||||
$expected = array_shift($createNamedParameterCalls);
|
||||
$this->assertEquals($expected, func_get_args());
|
||||
});
|
||||
|
|
@ -200,7 +200,7 @@ class QBMapperTest extends \Test\TestCase {
|
|||
];
|
||||
$this->qb->expects($this->exactly(7))
|
||||
->method('set')
|
||||
->willReturnCallback(function() use (&$setCalls) {
|
||||
->willReturnCallback(function () use (&$setCalls) {
|
||||
$expected = array_shift($setCalls);
|
||||
$this->assertEquals($expected, func_get_args());
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
namespace Test\AppFramework\Http;
|
||||
|
||||
use OC\AppFramework\DependencyInjection\DIContainer;
|
||||
use OC\AppFramework\Http\Dispatcher;
|
||||
use OC\AppFramework\Http\Request;
|
||||
use OC\AppFramework\Middleware\MiddlewareDispatcher;
|
||||
|
|
@ -26,7 +27,6 @@ use OCP\IRequestId;
|
|||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use OC\AppFramework\DependencyInjection\DIContainer;
|
||||
|
||||
class TestController extends Controller {
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -86,7 +86,8 @@ class TestMiddleware extends Middleware {
|
|||
}
|
||||
|
||||
class TestController extends Controller {
|
||||
public function method(): void {}
|
||||
public function method(): void {
|
||||
}
|
||||
}
|
||||
|
||||
class MiddlewareDispatcherTest extends \Test\TestCase {
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ class BruteForceMiddlewareTest extends TestCase {
|
|||
$this->throttler
|
||||
->expects($this->exactly(2))
|
||||
->method('sleepDelayOrThrowOnMax')
|
||||
->willReturnCallback(function() use (&$calls) {
|
||||
->willReturnCallback(function () use (&$calls) {
|
||||
$expected = array_shift($calls);
|
||||
$this->assertEquals($expected, func_get_args());
|
||||
return 0;
|
||||
|
|
@ -235,7 +235,7 @@ class BruteForceMiddlewareTest extends TestCase {
|
|||
$this->throttler
|
||||
->expects($this->exactly(2))
|
||||
->method('sleepDelayOrThrowOnMax')
|
||||
->willReturnCallback(function() use (&$sleepCalls) {
|
||||
->willReturnCallback(function () use (&$sleepCalls) {
|
||||
$expected = array_shift($sleepCalls);
|
||||
$this->assertEquals($expected, func_get_args());
|
||||
return 0;
|
||||
|
|
@ -248,7 +248,7 @@ class BruteForceMiddlewareTest extends TestCase {
|
|||
$this->throttler
|
||||
->expects($this->exactly(2))
|
||||
->method('registerAttempt')
|
||||
->willReturnCallback(function() use (&$attemptCalls) {
|
||||
->willReturnCallback(function () use (&$attemptCalls) {
|
||||
$expected = array_shift($attemptCalls);
|
||||
$this->assertEquals($expected, func_get_args());
|
||||
});
|
||||
|
|
|
|||
|
|
@ -360,7 +360,7 @@ class RoutingTest extends \Test\TestCase {
|
|||
$router
|
||||
->expects($this->exactly(5))
|
||||
->method('create')
|
||||
->willReturnCallback(function(string $name, string $pattern) use (&$calls) {
|
||||
->willReturnCallback(function (string $name, string $pattern) use (&$calls) {
|
||||
$expected = array_shift($calls);
|
||||
$this->assertEquals($expected['name'], $name);
|
||||
$this->assertEquals($expected['pattern'], $pattern);
|
||||
|
|
@ -414,7 +414,7 @@ class RoutingTest extends \Test\TestCase {
|
|||
$router
|
||||
->expects($this->exactly(5))
|
||||
->method('create')
|
||||
->willReturnCallback(function(string $name, string $pattern) use (&$calls) {
|
||||
->willReturnCallback(function (string $name, string $pattern) use (&$calls) {
|
||||
$expected = array_shift($calls);
|
||||
$this->assertEquals($expected['name'], $name);
|
||||
$this->assertEquals($expected['pattern'], $pattern);
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ class UserDeletedTokenCleanupListenerTest extends TestCase {
|
|||
];
|
||||
$this->manager->expects($this->exactly(3))
|
||||
->method('invalidateTokenById')
|
||||
->willReturnCallback(function() use (&$calls) {
|
||||
->willReturnCallback(function () use (&$calls) {
|
||||
$expected = array_shift($calls);
|
||||
$this->assertEquals($expected, func_get_args());
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace Test\Authentication\Login;
|
||||
|
||||
use OC\Authentication\Login\ALoginCommand;
|
||||
use OC\Authentication\Login\LoginData;
|
||||
use OCP\IRequest;
|
||||
use OCP\IUser;
|
||||
|
|
|
|||
|
|
@ -382,7 +382,7 @@ class ManagerTest extends TestCase {
|
|||
$this->publicKeyTokenProvider
|
||||
->expects($this->exactly(2))
|
||||
->method('invalidateTokenById')
|
||||
->willReturnCallback(function() use (&$calls) {
|
||||
->willReturnCallback(function () use (&$calls) {
|
||||
$expected = array_shift($calls);
|
||||
$this->assertEquals($expected, func_get_args());
|
||||
});
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ class PublicKeyTokenProviderTest extends TestCase {
|
|||
|
||||
$this->mapper->expects($this->exactly(2))
|
||||
->method('invalidate')
|
||||
->willReturnCallback(function() use (&$calls) {
|
||||
->willReturnCallback(function () use (&$calls) {
|
||||
$expected = array_shift($calls);
|
||||
$this->assertEquals($expected, func_get_args());
|
||||
});
|
||||
|
|
@ -350,7 +350,7 @@ class PublicKeyTokenProviderTest extends TestCase {
|
|||
];
|
||||
$this->mapper->expects($this->exactly(4))
|
||||
->method('invalidateOld')
|
||||
->willReturnCallback(function() use (&$calls) {
|
||||
->willReturnCallback(function () use (&$calls) {
|
||||
$expected = array_shift($calls);
|
||||
$this->assertEquals($expected, func_get_args());
|
||||
});
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ class RegistryTest extends TestCase {
|
|||
];
|
||||
$this->dispatcher->expects($this->exactly(2))
|
||||
->method('dispatchTyped')
|
||||
->willReturnCallback(function() use (&$calls) {
|
||||
->willReturnCallback(function () use (&$calls) {
|
||||
$expected = array_shift($calls);
|
||||
$this->assertEquals($expected, func_get_args());
|
||||
});
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class DateTimeFormatterTest extends TestCase {
|
|||
$this->assertEquals((string)$expected, (string)$this->formatter->formatTimeSpan($timestamp, $compare, $locale));
|
||||
}
|
||||
|
||||
public static function formatDateSpanData(): array{
|
||||
public static function formatDateSpanData(): array {
|
||||
$time = 1416916800; // Use a fixed timestamp so we don't switch days/years with the getTimestampAgo
|
||||
$deL10N = \OCP\Util::getL10N('lib', 'de');
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -9,14 +9,14 @@ namespace Test\Encryption;
|
|||
|
||||
use OC\Encryption\EncryptionWrapper;
|
||||
use OC\Encryption\Manager;
|
||||
use OC\Files\Storage\Wrapper\Encryption;
|
||||
use OC\Memcache\ArrayCache;
|
||||
use OCA\Files_Trashbin\Storage;
|
||||
use OCP\Files\Mount\IMountPoint;
|
||||
use OCP\Files\Storage\IDisableEncryptionStorage;
|
||||
use OCP\Files\Storage\IStorage;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Test\TestCase;
|
||||
use OCA\Files_Trashbin\Storage;
|
||||
use OC\Files\Storage\Wrapper\Encryption;
|
||||
|
||||
class EncryptionWrapperTest extends TestCase {
|
||||
/** @var EncryptionWrapper */
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ namespace Test\Files\Node;
|
|||
|
||||
use OC\Files\FileInfo;
|
||||
use OC\Files\Mount\Manager;
|
||||
use OC\Files\Node\Root;
|
||||
use OC\Files\View;
|
||||
use OC\Memcache\ArrayCache;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
|
|
@ -21,7 +22,6 @@ use OCP\ICacheFactory;
|
|||
use OCP\IUser;
|
||||
use OCP\IUserManager;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use OC\Files\Node\Root;
|
||||
|
||||
/**
|
||||
* Class NodeTest
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ abstract class ObjectStoreTestCase extends TestCase {
|
|||
/** @var string[] */
|
||||
private $cleanup = [];
|
||||
|
||||
private $instance = nulL;
|
||||
private $instance = null;
|
||||
|
||||
/**
|
||||
* @return \OCP\Files\ObjectStore\IObjectStore
|
||||
|
|
|
|||
|
|
@ -10,9 +10,11 @@ declare(strict_types=1);
|
|||
namespace Test\Files\Stream;
|
||||
|
||||
use OC\Encryption\File;
|
||||
use OC\Encryption\Util;
|
||||
use OC\Files\Cache\CacheEntry;
|
||||
use OC\Files\Storage\Storage;
|
||||
use OC\Files\Storage\Wrapper\Wrapper;
|
||||
use OC\Files\Stream\Encryption;
|
||||
use OC\Files\View;
|
||||
use OC\Memcache\ArrayCache;
|
||||
use OCP\Encryption\IEncryptionModule;
|
||||
|
|
@ -22,8 +24,6 @@ use OCP\ICacheFactory;
|
|||
use OCP\IConfig;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use OC\Files\Stream\Encryption;
|
||||
use OC\Encryption\Util;
|
||||
|
||||
class EncryptionTest extends \Test\TestCase {
|
||||
public const DEFAULT_WRAPPER = '\OC\Files\Stream\Encryption';
|
||||
|
|
|
|||
Loading…
Reference in a new issue