Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test: Fix coding standards
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed May 15, 2025
commit 5f9117b9391f970d3acce3f0e6c0ddc5d1c9b626
10 changes: 5 additions & 5 deletions apps/comments/tests/Unit/Activity/ListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
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 {
Expand Down
10 changes: 5 additions & 5 deletions apps/comments/tests/Unit/AppInfo/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
*/
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

class ClearNotificationsTest extends TestCase {
private IManager&MockObject $notificationManager;
private ClearNotifications$listener;
private ClearNotifications $listener;

protected function setUp(): void {
parent::setUp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

class UserStatusProviderTest extends TestCase {
private StatusService&MockObject $service;
private UserStatusProvider$provider;
private UserStatusProvider $provider;

protected function setUp(): void {
parent::setUp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

class PredefinedStatusControllerTest extends TestCase {
private PredefinedStatusService&MockObject $service;
private PredefinedStatusController$controller;
private PredefinedStatusController $controller;

protected function setUp(): void {
parent::setUp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
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;
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/AppConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
[
Expand Down
8 changes: 4 additions & 4 deletions tests/lib/AppFramework/Db/QBMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function testInsertEntityParameterTypeMapping(): void {
];
$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());
});
Expand All @@ -142,7 +142,7 @@ public function testInsertEntityParameterTypeMapping(): void {
];
$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());
});
Expand Down Expand Up @@ -184,7 +184,7 @@ public function testUpdateEntityParameterTypeMapping(): void {
];
$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());
});
Expand All @@ -200,7 +200,7 @@ public function testUpdateEntityParameterTypeMapping(): void {
];
$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());
});
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/AppFramework/Http/DispatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -26,7 +27,6 @@
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
use OC\AppFramework\DependencyInjection\DIContainer;

class TestController extends Controller {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ public function beforeOutput($controller, $methodName, $output) {
}

class TestController extends Controller {
public function method(): void {}
public function method(): void {
}
}

class MiddlewareDispatcherTest extends \Test\TestCase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function testBeforeControllerWithMultipleAttributes(): void {
$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;
Expand Down Expand Up @@ -235,7 +235,7 @@ public function testAfterControllerWithMultipleAttributesGeneralMatch(): void {
$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;
Expand All @@ -248,7 +248,7 @@ public function testAfterControllerWithMultipleAttributesGeneralMatch(): void {
$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());
});
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/AppFramework/Routing/RoutingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ private function assertOCSResource($yaml, $resourceName, $url, $controllerName,
$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);
Expand Down Expand Up @@ -414,7 +414,7 @@ private function assertResource($yaml, $resourceName, $url, $controllerName, $pa
$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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function testHandle(): void {
];
$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());
});
Expand Down
1 change: 0 additions & 1 deletion tests/lib/Authentication/Login/ALoginTestCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace Test\Authentication\Login;

use OC\Authentication\Login\ALoginCommand;
use OC\Authentication\Login\LoginData;
use OCP\IRequest;
use OCP\IUser;
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/Authentication/Token/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ public function testInvalidateTokensOfUserNoClientName(): void {
$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());
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public function testInvalidateToken(): void {

$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());
});
Expand Down Expand Up @@ -350,7 +350,7 @@ public function testInvalidateOldTokens(): void {
];
$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());
});
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/Authentication/TwoFactorAuth/RegistryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function testDeleteUserData(): void {
];
$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());
});
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/DateTimeFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function testFormatTimeSpan($expected, $timestamp, $compare, $locale = nu
$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 [
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/Encryption/EncryptionWrapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

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 */
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/Files/Node/NodeTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

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;
Expand All @@ -21,7 +22,6 @@
use OCP\IUser;
use OCP\IUserManager;
use Psr\Log\LoggerInterface;
use OC\Files\Node\Root;

/**
* Class NodeTest
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/Files/ObjectStore/ObjectStoreTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ abstract class ObjectStoreTestCase extends TestCase {
/** @var string[] */
private $cleanup = [];

private $instance = nulL;
private $instance = null;

/**
* @return \OCP\Files\ObjectStore\IObjectStore
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/Files/Stream/EncryptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
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;
Expand All @@ -22,8 +24,6 @@
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';
Expand Down
Loading