Browse Source

refactor: Cleanup some unit tests

- use declare(strict_types=1)
- use strong typing
- Remove some weird things in ControllerTest

Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
pull/55405/head
Carl Schwan 7 days ago
parent
commit
60c2875670
  1. 2
      tests/lib/Accounts/AccountManagerTest.php
  2. 8
      tests/lib/Accounts/AccountPropertyCollectionTest.php
  3. 2
      tests/lib/Accounts/AccountPropertyTest.php
  4. 2
      tests/lib/Accounts/AccountTest.php
  5. 12
      tests/lib/Accounts/HooksTest.php
  6. 8
      tests/lib/Activity/ManagerTest.php
  7. 18
      tests/lib/App/AppStore/Bundles/BundleBase.php
  8. 9
      tests/lib/App/AppStore/Bundles/BundleFetcherTest.php
  9. 2
      tests/lib/App/AppStore/Bundles/EducationBundleTest.php
  10. 2
      tests/lib/App/AppStore/Bundles/EnterpriseBundleTest.php
  11. 2
      tests/lib/App/AppStore/Bundles/GroupwareBundleTest.php
  12. 2
      tests/lib/App/AppStore/Bundles/SocialSharingBundleTest.php
  13. 4
      tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php
  14. 33
      tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
  15. 2
      tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php
  16. 33
      tests/lib/App/AppStore/Fetcher/FetcherBase.php
  17. 5
      tests/lib/App/AppStore/Version/VersionParserTest.php
  18. 2
      tests/lib/App/AppStore/Version/VersionTest.php
  19. 3
      tests/lib/App/CompareVersionTest.php
  20. 6
      tests/lib/App/DependencyAnalyzerTest.php
  21. 5
      tests/lib/App/InfoParserTest.php
  22. 8
      tests/lib/App/PlatformRepositoryTest.php
  23. 6
      tests/lib/AppFramework/Bootstrap/BootContextTest.php
  24. 31
      tests/lib/AppFramework/Bootstrap/CoordinatorTest.php
  25. 7
      tests/lib/AppFramework/Bootstrap/FunctionInjectorTest.php
  26. 7
      tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php
  27. 5
      tests/lib/AppFramework/Controller/ApiControllerTest.php
  28. 16
      tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php
  29. 23
      tests/lib/AppFramework/Controller/ControllerTest.php
  30. 2
      tests/lib/AppFramework/Controller/OCSControllerTest.php
  31. 9
      tests/lib/AppFramework/Controller/PublicShareControllerTest.php
  32. 2
      tests/lib/AppFramework/Db/EntityTest.php
  33. 5
      tests/lib/AppFramework/Db/QBMapperDBTest.php
  34. 3
      tests/lib/AppFramework/Db/TransactionalTest.php
  35. 2
      tests/lib/AppFramework/DependencyInjection/DIContainerTest.php
  36. 7
      tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php
  37. 5
      tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php
  38. 7
      tests/lib/AppFramework/Http/DataResponseTest.php

2
tests/lib/Accounts/AccountManagerTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.

8
tests/lib/Accounts/AccountPropertyCollectionTest.php

@ -17,8 +17,7 @@ use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class AccountPropertyCollectionTest extends TestCase {
/** @var IAccountPropertyCollection */
protected $collection;
protected IAccountPropertyCollection $collection;
protected const COLLECTION_NAME = 'my_multivalue_property';
@ -28,10 +27,7 @@ class AccountPropertyCollectionTest extends TestCase {
$this->collection = new AccountPropertyCollection(self::COLLECTION_NAME);
}
/**
* @return IAccountProperty|MockObject
*/
protected function makePropertyMock(string $propertyName): MockObject {
protected function makePropertyMock(string $propertyName): IAccountProperty&MockObject {
$mock = $this->createMock(IAccountProperty::class);
$mock->expects($this->any())
->method('getName')

2
tests/lib/Accounts/AccountPropertyTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

2
tests/lib/Accounts/AccountTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

12
tests/lib/Accounts/HooksTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -24,14 +26,10 @@ use Test\TestCase;
* @group DB
*/
class HooksTest extends TestCase {
/** @var LoggerInterface|MockObject */
private $logger;
/** @var AccountManager|MockObject */
private $accountManager;
/** @var Hooks */
private $hooks;
private LoggerInterface&MockObject $logger;
private AccountManager&MockObject $accountManager;
private Hooks $hooks;
protected function setUp(): void {
parent::setUp();

8
tests/lib/Activity/ManagerTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@ -8,6 +10,7 @@
namespace Test\Activity;
use OC\Activity\Manager;
use OCP\Activity\Exceptions\IncompleteActivityException;
use OCP\Activity\IConsumer;
use OCP\Activity\IEvent;
@ -23,8 +26,7 @@ use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class ManagerTest extends TestCase {
/** @var \OC\Activity\Manager */
private $activityManager;
private Manager $activityManager;
protected IRequest&MockObject $request;
protected IUserSession&MockObject $session;
@ -43,7 +45,7 @@ class ManagerTest extends TestCase {
$this->richTextFormatter = $this->createMock(IRichTextFormatter::class);
$this->time = $this->createMock(ITimeFactory::class);
$this->activityManager = new \OC\Activity\Manager(
$this->activityManager = new Manager(
$this->request,
$this->session,
$this->config,

18
tests/lib/App/AppStore/Bundles/BundleBase.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -9,19 +11,15 @@ namespace Test\App\AppStore\Bundles;
use OC\App\AppStore\Bundles\Bundle;
use OCP\IL10N;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
abstract class BundleBase extends TestCase {
/** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
protected $l10n;
/** @var Bundle */
protected $bundle;
/** @var string */
protected $bundleIdentifier;
/** @var string */
protected $bundleName;
/** @var array */
protected $bundleAppIds;
protected IL10N&MockObject $l10n;
protected Bundle $bundle;
protected string $bundleIdentifier;
protected string $bundleName;
protected array $bundleAppIds;
protected function setUp(): void {
parent::setUp();

9
tests/lib/App/AppStore/Bundles/BundleFetcherTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -15,13 +17,12 @@ use OC\App\AppStore\Bundles\HubBundle;
use OC\App\AppStore\Bundles\PublicSectorBundle;
use OC\App\AppStore\Bundles\SocialSharingBundle;
use OCP\IL10N;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class BundleFetcherTest extends TestCase {
/** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
private $l10n;
/** @var BundleFetcher */
private $bundleFetcher;
private IL10N&MockObject $l10n;
private BundleFetcher $bundleFetcher;
protected function setUp(): void {
parent::setUp();

2
tests/lib/App/AppStore/Bundles/EducationBundleTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

2
tests/lib/App/AppStore/Bundles/EnterpriseBundleTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

2
tests/lib/App/AppStore/Bundles/GroupwareBundleTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

2
tests/lib/App/AppStore/Bundles/SocialSharingBundleTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

4
tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -15,7 +17,7 @@ use OCP\Files\SimpleFS\ISimpleFolder;
use PHPUnit\Framework\MockObject\MockObject;
class AppDiscoverFetcherTest extends FetcherBase {
protected CompareVersion|MockObject $compareVersion;
protected CompareVersion&MockObject $compareVersion;
protected function setUp(): void {
parent::setUp();

33
tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
File diff suppressed because it is too large
View File

2
tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

33
tests/lib/App/AppStore/Fetcher/FetcherBase.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -20,30 +22,21 @@ use OCP\Http\Client\IClientService;
use OCP\Http\Client\IResponse;
use OCP\IConfig;
use OCP\Support\Subscription\IRegistry;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Test\TestCase;
abstract class FetcherBase extends TestCase {
/** @var Factory|\PHPUnit\Framework\MockObject\MockObject */
protected $appDataFactory;
/** @var IAppData|\PHPUnit\Framework\MockObject\MockObject */
protected $appData;
/** @var IClientService|\PHPUnit\Framework\MockObject\MockObject */
protected $clientService;
/** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
protected $timeFactory;
/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
/** @var IRegistry|\PHPUnit\Framework\MockObject\MockObject */
protected $registry;
/** @var Fetcher */
protected $fetcher;
/** @var string */
protected $fileName;
/** @var string */
protected $endpoint;
protected Factory&MockObject $appDataFactory;
protected IAppData&MockObject $appData;
protected IClientService&MockObject $clientService;
protected ITimeFactory&MockObject $timeFactory;
protected IConfig&MockObject $config;
protected LoggerInterface&MockObject $logger;
protected IRegistry&MockObject $registry;
protected Fetcher $fetcher;
protected string $fileName;
protected string $endpoint;
protected function setUp(): void {
parent::setUp();

5
tests/lib/App/AppStore/Version/VersionParserTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -12,8 +14,7 @@ use OC\App\AppStore\Version\VersionParser;
use Test\TestCase;
class VersionParserTest extends TestCase {
/** @var VersionParser */
private $versionParser;
private VersionParser $versionParser;
protected function setUp(): void {
parent::setUp();

2
tests/lib/App/AppStore/Version/VersionTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

3
tests/lib/App/CompareVersionTest.php

@ -14,8 +14,7 @@ use OC\App\CompareVersion;
use Test\TestCase;
class CompareVersionTest extends TestCase {
/** @var CompareVersion */
private $compare;
private CompareVersion $compare;
protected function setUp(): void {
parent::setUp();

6
tests/lib/App/DependencyAnalyzerTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2016-2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2014-2016 ownCloud, Inc.
@ -9,11 +11,11 @@ namespace Test\App;
use OC\App\DependencyAnalyzer;
use OC\App\Platform;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class DependencyAnalyzerTest extends TestCase {
/** @var Platform|\PHPUnit\Framework\MockObject\MockObject */
private $platformMock;
private Platform&MockObject $platformMock;
private DependencyAnalyzer $analyser;

5
tests/lib/App/InfoParserTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2016-2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2014-2016 ownCloud, Inc.
@ -13,8 +15,7 @@ use OCP\Cache\CappedMemoryCache;
use Test\TestCase;
class InfoParserTest extends TestCase {
/** @var CappedMemoryCache */
private static $cache;
private static CappedMemoryCache $cache;
public static function setUpBeforeClass(): void {
self::$cache = new CappedMemoryCache();

8
tests/lib/App/PlatformRepositoryTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2020-2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2014-2016 ownCloud, Inc.
@ -10,12 +12,8 @@ namespace Test\App;
use OC\App\PlatformRepository;
class PlatformRepositoryTest extends \Test\TestCase {
/**
* @param $expected
* @param $input
*/
#[\PHPUnit\Framework\Attributes\DataProvider('providesVersions')]
public function testVersion($input, $expected): void {
public function testVersion(string $input, string $expected): void {
$pr = new PlatformRepository();
$normalizedVersion = $pr->normalizeVersion($input);
$this->assertEquals($expected, $normalizedVersion);

6
tests/lib/AppFramework/Bootstrap/BootContextTest.php

@ -16,11 +16,9 @@ use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class BootContextTest extends TestCase {
/** @var IAppContainer|MockObject */
private $appContainer;
private IAppContainer&MockObject $appContainer;
/** @var BootContext */
private $context;
private BootContext $context;
protected function setUp(): void {
parent::setUp();

31
tests/lib/AppFramework/Bootstrap/CoordinatorTest.php

@ -27,29 +27,14 @@ use Psr\Log\LoggerInterface;
use Test\TestCase;
class CoordinatorTest extends TestCase {
/** @var IAppManager|MockObject */
private $appManager;
/** @var IServerContainer|MockObject */
private $serverContainer;
/** @var Registry|MockObject */
private $crashReporterRegistry;
/** @var IManager|MockObject */
private $dashboardManager;
/** @var IEventDispatcher|MockObject */
private $eventDispatcher;
/** @var IEventLogger|MockObject */
private $eventLogger;
/** @var LoggerInterface|MockObject */
private $logger;
/** @var Coordinator */
private $coordinator;
private IAppManager&MockObject $appManager;
private IServerContainer&MockObject $serverContainer;
private Registry&MockObject $crashReporterRegistry;
private IManager&MockObject $dashboardManager;
private IEventDispatcher&MockObject $eventDispatcher;
private IEventLogger&MockObject $eventLogger;
private LoggerInterface&MockObject $logger;
private Coordinator $coordinator;
protected function setUp(): void {
parent::setUp();

7
tests/lib/AppFramework/Bootstrap/FunctionInjectorTest.php

@ -11,15 +11,14 @@ namespace lib\AppFramework\Bootstrap;
use OC\AppFramework\Bootstrap\FunctionInjector;
use OC\AppFramework\Utility\SimpleContainer;
use OCP\AppFramework\QueryException;
use Psr\Container\ContainerExceptionInterface;
use Test\TestCase;
interface Foo {
}
class FunctionInjectorTest extends TestCase {
/** @var SimpleContainer */
private $container;
private SimpleContainer $container;
protected function setUp(): void {
parent::setUp();
@ -28,7 +27,7 @@ class FunctionInjectorTest extends TestCase {
}
public function testInjectFnNotRegistered(): void {
$this->expectException(QueryException::class);
$this->expectException(ContainerExceptionInterface::class);
(new FunctionInjector($this->container))->injectFn(static function (Foo $p1): void {
});

7
tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php

@ -20,11 +20,8 @@ use Psr\Log\LoggerInterface;
use Test\TestCase;
class RegistrationContextTest extends TestCase {
/** @var LoggerInterface|MockObject */
private $logger;
/** @var RegistrationContext */
private $context;
private LoggerInterface&MockObject $logger;
private RegistrationContext $context;
protected function setUp(): void {
parent::setUp();

5
tests/lib/AppFramework/Controller/ApiControllerTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@ -18,8 +20,7 @@ class ChildApiController extends ApiController {
class ApiControllerTest extends \Test\TestCase {
/** @var ChildApiController */
protected $controller;
protected ChildApiController $controller;
public function testCors(): void {
$request = new Request(

16
tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -13,17 +15,13 @@ use OCP\AppFramework\Http\TemplateResponse;
use OCP\IRequest;
use OCP\ISession;
use OCP\IURLGenerator;
use PHPUnit\Framework\MockObject\MockObject;
class AuthPublicShareControllerTest extends \Test\TestCase {
/** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */
private $request;
/** @var ISession|\PHPUnit\Framework\MockObject\MockObject */
private $session;
/** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */
private $urlGenerator;
/** @var AuthPublicShareController|\PHPUnit\Framework\MockObject\MockObject */
private $controller;
private IRequest&MockObject $request;
private ISession&MockObject $session;
private IURLGenerator&MockObject $urlGenerator;
private AuthPublicShareController&MockObject $controller;
protected function setUp(): void {

23
tests/lib/AppFramework/Controller/ControllerTest.php

@ -8,7 +8,6 @@
namespace Test\AppFramework\Controller;
use OC\AppFramework\DependencyInjection\DIContainer;
use OC\AppFramework\Http\Request;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\DataResponse;
@ -18,7 +17,7 @@ use OCP\IRequest;
use OCP\IRequestId;
class ChildController extends Controller {
public function __construct($appName, $request) {
public function __construct(string $appName, IRequest $request) {
parent::__construct($appName, $request);
$this->registerResponder('tom', function ($respone) {
return 'hi';
@ -33,7 +32,7 @@ class ChildController extends Controller {
return $in;
}
public function customDataResponse($in) {
public function customDataResponse(mixed $in): DataResponse {
$response = new DataResponse($in, 300);
$response->addHeader('test', 'something');
return $response;
@ -41,12 +40,8 @@ class ChildController extends Controller {
};
class ControllerTest extends \Test\TestCase {
/**
* @var Controller
*/
private $controller;
private $app;
private $request;
private Controller $controller;
private Request $request;
protected function setUp(): void {
parent::setUp();
@ -65,15 +60,7 @@ class ControllerTest extends \Test\TestCase {
$this->createMock(IConfig::class)
);
$this->app = $this->getMockBuilder(DIContainer::class)
->onlyMethods(['getAppName'])
->setConstructorArgs(['test'])
->getMock();
$this->app->expects($this->any())
->method('getAppName')
->willReturn('apptemplate_advanced');
$this->controller = new ChildController($this->app, $request);
$this->controller = new ChildController('apptemplate_advanced', $request);
$this->overwriteService(IRequest::class, $request);
$this->request = $request;
}

2
tests/lib/AppFramework/Controller/OCSControllerTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.

9
tests/lib/AppFramework/Controller/PublicShareControllerTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -10,6 +12,7 @@ namespace Test\AppFramework\Controller;
use OCP\AppFramework\PublicShareController;
use OCP\IRequest;
use OCP\ISession;
use PHPUnit\Framework\MockObject\MockObject;
class TestController extends PublicShareController {
public function __construct(
@ -36,10 +39,8 @@ class TestController extends PublicShareController {
}
class PublicShareControllerTest extends \Test\TestCase {
/** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */
private $request;
/** @var ISession|\PHPUnit\Framework\MockObject\MockObject */
private $session;
private IRequest&MockObject $request;
private ISession&MockObject $session;
protected function setUp(): void {
parent::setUp();

2
tests/lib/AppFramework/Db/EntityTest.php

@ -73,7 +73,7 @@ class TestEntity extends Entity {
class EntityTest extends \Test\TestCase {
private $entity;
private TestEntity $entity;
protected function setUp(): void {
parent::setUp();

5
tests/lib/AppFramework/Db/QBMapperDBTest.php

@ -64,9 +64,8 @@ class QBDBTestMapper extends QBMapper {
* @group DB
*/
class QBMapperDBTest extends TestCase {
/** @var \Doctrine\DBAL\Connection|IDBConnection */
protected $connection;
protected $schemaSetup = false;
protected IDBConnection $connection;
protected bool $schemaSetup = false;
protected function setUp(): void {
parent::setUp();

3
tests/lib/AppFramework/Db/TransactionalTest.php

@ -15,8 +15,7 @@ use RuntimeException;
use Test\TestCase;
class TransactionalTest extends TestCase {
/** @var IDBConnection|MockObject */
private IDBConnection $db;
private IDBConnection&MockObject $db;
protected function setUp(): void {
parent::setUp();

2
tests/lib/AppFramework/DependencyInjection/DIContainerTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.

7
tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php

@ -34,11 +34,8 @@ class ClassB {
}
class DIIntergrationTests extends TestCase {
/** @var DIContainer */
private $container;
/** @var ServerContainer */
private $server;
private DIContainer $container;
private ServerContainer $server;
protected function setUp(): void {
parent::setUp();

5
tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@ -16,8 +18,7 @@ use OCP\AppFramework\Http\ContentSecurityPolicy;
* @package OC\AppFramework\Http
*/
class ContentSecurityPolicyTest extends \Test\TestCase {
/** @var ContentSecurityPolicy */
private $contentSecurityPolicy;
private ContentSecurityPolicy $contentSecurityPolicy;
protected function setUp(): void {
parent::setUp();

7
tests/lib/AppFramework/Http/DataResponseTest.php

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@ -14,10 +16,7 @@ use OCP\IRequest;
use OCP\Server;
class DataResponseTest extends \Test\TestCase {
/**
* @var DataResponse
*/
private $response;
private DataResponse $response;
protected function setUp(): void {
parent::setUp();

Loading…
Cancel
Save