Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions tests/lib/Accounts/AccountManagerTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
Expand Down
8 changes: 2 additions & 6 deletions tests/lib/Accounts/AccountPropertyCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
use Test\TestCase;

class AccountPropertyCollectionTest extends TestCase {
/** @var IAccountPropertyCollection */
protected $collection;
protected IAccountPropertyCollection $collection;

protected const COLLECTION_NAME = 'my_multivalue_property';

Expand All @@ -28,10 +27,7 @@ public function setUp(): void {
$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')
Expand Down
2 changes: 2 additions & 0 deletions tests/lib/Accounts/AccountPropertyTest.php
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/lib/Accounts/AccountTest.php
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 5 additions & 7 deletions tests/lib/Accounts/HooksTest.php
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -24,14 +26,10 @@
* @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();
Expand Down
8 changes: 5 additions & 3 deletions tests/lib/Activity/ManagerTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
Expand All @@ -8,6 +10,7 @@

namespace Test\Activity;

use OC\Activity\Manager;
use OCP\Activity\Exceptions\IncompleteActivityException;
use OCP\Activity\IConsumer;
use OCP\Activity\IEvent;
Expand All @@ -23,8 +26,7 @@
use Test\TestCase;

class ManagerTest extends TestCase {
/** @var \OC\Activity\Manager */
private $activityManager;
private Manager $activityManager;

protected IRequest&MockObject $request;
protected IUserSession&MockObject $session;
Expand All @@ -43,7 +45,7 @@ protected function setUp(): void {
$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,
Expand Down
18 changes: 8 additions & 10 deletions tests/lib/App/AppStore/Bundles/BundleBase.php
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -9,19 +11,15 @@

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();
Expand Down
9 changes: 5 additions & 4 deletions tests/lib/App/AppStore/Bundles/BundleFetcherTest.php
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,13 +17,12 @@
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();
Expand Down
2 changes: 2 additions & 0 deletions tests/lib/App/AppStore/Bundles/EducationBundleTest.php
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/lib/App/AppStore/Bundles/EnterpriseBundleTest.php
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/lib/App/AppStore/Bundles/GroupwareBundleTest.php
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/lib/App/AppStore/Bundles/SocialSharingBundleTest.php
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,7 +17,7 @@
use PHPUnit\Framework\MockObject\MockObject;

class AppDiscoverFetcherTest extends FetcherBase {
protected CompareVersion|MockObject $compareVersion;
protected CompareVersion&MockObject $compareVersion;

protected function setUp(): void {
parent::setUp();
Expand Down
33 changes: 14 additions & 19 deletions tests/lib/App/AppStore/Fetcher/AppFetcherTest.php

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php
Original file line number Diff line number Diff line change
@@ -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
Expand Down
33 changes: 13 additions & 20 deletions tests/lib/App/AppStore/Fetcher/FetcherBase.php
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -20,30 +22,21 @@
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();
Expand Down
5 changes: 3 additions & 2 deletions tests/lib/App/AppStore/Version/VersionParserTest.php
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -12,8 +14,7 @@
use Test\TestCase;

class VersionParserTest extends TestCase {
/** @var VersionParser */
private $versionParser;
private VersionParser $versionParser;

protected function setUp(): void {
parent::setUp();
Expand Down
2 changes: 2 additions & 0 deletions tests/lib/App/AppStore/Version/VersionTest.php
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 1 addition & 2 deletions tests/lib/App/CompareVersionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
use Test\TestCase;

class CompareVersionTest extends TestCase {
/** @var CompareVersion */
private $compare;
private CompareVersion $compare;

protected function setUp(): void {
parent::setUp();
Expand Down
6 changes: 4 additions & 2 deletions tests/lib/App/DependencyAnalyzerTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2016-2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2014-2016 ownCloud, Inc.
Expand All @@ -9,11 +11,11 @@

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;

Expand Down
5 changes: 3 additions & 2 deletions tests/lib/App/InfoParserTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2016-2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2014-2016 ownCloud, Inc.
Expand All @@ -13,8 +15,7 @@
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();
Expand Down
8 changes: 3 additions & 5 deletions tests/lib/App/PlatformRepositoryTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2020-2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2014-2016 ownCloud, Inc.
Expand All @@ -10,12 +12,8 @@
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);
Expand Down
6 changes: 2 additions & 4 deletions tests/lib/AppFramework/Bootstrap/BootContextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@
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();
Expand Down
Loading
Loading