From 4b98ea41df05ea2014ea090fbffbe2514297c658 Mon Sep 17 00:00:00 2001 From: Wouter Wolters <typo3@wouterwolters.nl> Date: Fri, 13 Aug 2021 16:24:15 +0200 Subject: [PATCH] [TASK] Strictify UnitTests part 6 The following core extensions are handled: EXT:install Resolves: #94880 Releases: master Change-Id: I2ae58f7f1c5a944394c82bb592ccbdac3bb57352 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70585 Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com> Tested-by: core-ci <typo3@b13.com> Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com> --- .../Unit/Controller/UpgradeControllerTest.php | 11 +- .../Php/CodeStatisticsTest.php | 2 +- .../Php/Fixtures/CodeStatisticsFixture.php | 2 +- .../Php/GeneratorClassesResolverTest.php | 4 +- .../Php/Matcher/AbstractCoreMatcherTest.php | 10 +- .../Php/Matcher/ArrayDimensionMatcherTest.php | 4 +- .../Php/Matcher/ArrayGlobalMatcherTest.php | 6 +- .../Php/Matcher/ClassConstantMatcherTest.php | 6 +- .../Php/Matcher/ClassNameMatcherTest.php | 2 +- .../Php/Matcher/ConstantMatcherTest.php | 6 +- .../ConstructorArgumentMatcherTest.php | 2 +- .../Fixtures/ArrayDimensionMatcherFixture.php | 2 +- .../Fixtures/ArrayGlobalMatcherFixture.php | 2 +- .../Fixtures/ClassConstantMatcherFixture.php | 2 +- .../Fixtures/ClassNameMatcherFixture.php | 2 +- .../Fixtures/ConstantMatcherFixture.php | 2 +- .../Fixtures/FunctionCallMatcherFixture.php | 2 +- .../InterfaceMethodChangedMatcherFixture.php | 10 +- .../MethodArgumentDroppedMatcherFixture.php | 2 +- ...hodArgumentDroppedStaticMatcherFixture.php | 2 +- .../MethodArgumentRequiredMatcherFixture.php | 2 +- ...odArgumentRequiredStaticMatcherFixture.php | 2 +- .../MethodArgumentUnusedMatcherFixture.php | 2 +- .../Fixtures/MethodCallMatcherFixture.php | 2 +- .../MethodCallStaticMatcherFixture.php | 2 +- .../PropertyProtectedMatcherFixture.php | 2 +- .../Fixtures/PropertyPublicMatcherFixture.php | 2 +- .../Php/Matcher/FunctionCallMatcherTest.php | 4 +- .../InterfaceMethodChangedMatcherTest.php | 2 +- .../Matcher/MethodAnnotationMatcherTest.php | 2 +- .../MethodArgumentDroppedMatcherTest.php | 4 +- ...MethodArgumentDroppedStaticMatcherTest.php | 4 +- .../MethodArgumentRequiredMatcherTest.php | 4 +- ...ethodArgumentRequiredStaticMatcherTest.php | 4 +- .../MethodArgumentUnusedMatcherTest.php | 6 +- .../Php/Matcher/MethodCallMatcherTest.php | 6 +- .../Matcher/MethodCallStaticMatcherTest.php | 6 +- .../Matcher/PropertyAnnotationMatcherTest.php | 2 +- .../PropertyExistsStaticMatcherTest.php | 2 +- .../Matcher/PropertyProtectedMatcherTest.php | 6 +- .../Php/Matcher/PropertyPublicMatcherTest.php | 6 +- .../Php/MatcherFactoryTest.php | 14 +- .../Unit/FolderStructure/AbstractNodeTest.php | 123 +++---- .../FolderStructure/DefaultFactoryTest.php | 2 +- .../FolderStructure/DirectoryNodeTest.php | 59 +-- .../Unit/FolderStructure/FileNodeTest.php | 343 +++++++++--------- .../Unit/FolderStructure/LinkNodeTest.php | 135 +++---- .../Unit/FolderStructure/RootNodeTest.php | 67 ++-- .../FolderStructure/StructureFacadeTest.php | 9 +- .../Tests/Unit/FolderStructureTestCase.php | 4 +- .../Unit/Service/ClearTableServiceTest.php | 2 +- .../Unit/Service/CoreUpdateServiceTest.php | 18 +- .../Unit/Service/CoreVersionServiceTest.php | 14 +- .../Unit/Service/EnableFileServiceTest.php | 17 +- .../SilentConfigurationUpgradeServiceTest.php | 77 ++-- .../Unit/Service/Typo3tempFileServiceTest.php | 8 +- .../ContentSecurityPolicyHeaderTest.php | 2 +- .../L18nDiffsourceToJsonMigrationTest.php | 13 +- .../UpgradeAnalysis/DocumentationFileTest.php | 32 +- 59 files changed, 553 insertions(+), 539 deletions(-) diff --git a/typo3/sysext/install/Tests/Unit/Controller/UpgradeControllerTest.php b/typo3/sysext/install/Tests/Unit/Controller/UpgradeControllerTest.php index cd8ed49a8c06..9a4005ce0236 100644 --- a/typo3/sysext/install/Tests/Unit/Controller/UpgradeControllerTest.php +++ b/typo3/sysext/install/Tests/Unit/Controller/UpgradeControllerTest.php @@ -17,6 +17,8 @@ declare(strict_types=1); namespace TYPO3\CMS\Install\Tests\Unit\Controller; +use PHPUnit\Framework\MockObject\MockObject; +use Prophecy\PhpUnit\ProphecyTrait; use Psr\Http\Message\ServerRequestInterface; use TYPO3\CMS\Fluid\View\StandaloneView; use TYPO3\CMS\Install\Controller\UpgradeController; @@ -27,7 +29,8 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; */ class UpgradeControllerTest extends UnitTestCase { - use \Prophecy\PhpUnit\ProphecyTrait; + use ProphecyTrait; + /** * @return array */ @@ -72,18 +75,18 @@ class UpgradeControllerTest extends UnitTestCase ], ]); - /** @var UpgradeController|\PHPUnit\Framework\MockObject\MockObject $subject */ + /** @var UpgradeController|MockObject $subject */ $subject = $this->getMockBuilder(UpgradeController::class) ->disableOriginalConstructor() ->onlyMethods(['getDocumentationFiles', 'initializeStandaloneView']) ->getMock(); - $subject->expects(self::any())->method('getDocumentationFiles')->willReturn([ + $subject->method('getDocumentationFiles')->willReturn([ 'normalFiles' => [], 'readFiles' => [], 'notAffectedFiles' => [], ]); - $subject->expects(self::any()) + $subject ->method('initializeStandaloneView') ->willReturn($this->prophesize(StandaloneView::class)->reveal()); $subject->upgradeDocsGetChangelogForVersionAction($requestProphecy->reveal()); diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/CodeStatisticsTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/CodeStatisticsTest.php index 24f3a7f964ed..bc05b1aac07b 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/CodeStatisticsTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/CodeStatisticsTest.php @@ -30,7 +30,7 @@ class CodeStatisticsTest extends UnitTestCase /** * @test */ - public function enterNodeSumsStatistics() + public function enterNodeSumsStatistics(): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $fixtureFile = __DIR__ . '/Fixtures/CodeStatisticsFixture.php'; diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Fixtures/CodeStatisticsFixture.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Fixtures/CodeStatisticsFixture.php index 1c87dbc3ceb5..21acd66707bb 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Fixtures/CodeStatisticsFixture.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Fixtures/CodeStatisticsFixture.php @@ -25,7 +25,7 @@ class CodeStatisticsFixture /** * Some comment */ - public function aMethod() + public function aMethod(): void { // @extensionScannerIgnoreLine $some = 'ignored line'; diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/GeneratorClassesResolverTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/GeneratorClassesResolverTest.php index 93b5a85e53bd..fba6a9334ecf 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/GeneratorClassesResolverTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/GeneratorClassesResolverTest.php @@ -36,7 +36,7 @@ class GeneratorClassesResolverTest extends UnitTestCase /** * @test */ - public function visitorCreatesFullyQualifiedNameFromStringArgumentInMakeInstance() + public function visitorCreatesFullyQualifiedNameFromStringArgumentInMakeInstance(): void { $phpCode = <<<'EOC' <?php @@ -59,7 +59,7 @@ EOC; /** * @test */ - public function visitorDoesNotTransformDynamicallyCreatesFullyQualifiedNameFromStringArgumentInMakeInstance() + public function visitorDoesNotTransformDynamicallyCreatesFullyQualifiedNameFromStringArgumentInMakeInstance(): void { $phpCode = <<<'EOC' <?php diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/AbstractCoreMatcherTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/AbstractCoreMatcherTest.php index a4e72875acb9..5b60a037af8d 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/AbstractCoreMatcherTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/AbstractCoreMatcherTest.php @@ -28,7 +28,7 @@ class AbstractCoreMatcherTest extends UnitTestCase /** * @test */ - public function validateMatcherDefinitionsRunsFineWithProperDefinition() + public function validateMatcherDefinitionsRunsFineWithProperDefinition(): void { $matcher = $this->getAccessibleMockForAbstractClass(AbstractCoreMatcher::class, [], '', false); $configuration = [ @@ -46,7 +46,7 @@ class AbstractCoreMatcherTest extends UnitTestCase /** * @test */ - public function validateMatcherDefinitionsThrowsIfRequiredArgIsNotInConfig() + public function validateMatcherDefinitionsThrowsIfRequiredArgIsNotInConfig(): void { $matcher = $this->getAccessibleMockForAbstractClass(AbstractCoreMatcher::class, [], '', false); $configuration = [ @@ -66,7 +66,7 @@ class AbstractCoreMatcherTest extends UnitTestCase /** * @test */ - public function validateMatcherDefinitionsThrowsWithMissingRestFiles() + public function validateMatcherDefinitionsThrowsWithMissingRestFiles(): void { $matcher = $this->getAccessibleMockForAbstractClass(AbstractCoreMatcher::class, [], '', false); $configuration = [ @@ -83,7 +83,7 @@ class AbstractCoreMatcherTest extends UnitTestCase /** * @test */ - public function validateMatcherDefinitionsThrowsWithEmptySingleRestFile() + public function validateMatcherDefinitionsThrowsWithEmptySingleRestFile(): void { $matcher = $this->getAccessibleMockForAbstractClass(AbstractCoreMatcher::class, [], '', false); $configuration = [ @@ -103,7 +103,7 @@ class AbstractCoreMatcherTest extends UnitTestCase /** * @test */ - public function initializeMethodNameArrayThrowsWithInvalidKeys() + public function initializeMethodNameArrayThrowsWithInvalidKeys(): void { $matcher = $this->getAccessibleMockForAbstractClass(AbstractCoreMatcher::class, [], '', false); $configuration = [ diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ArrayDimensionMatcherTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ArrayDimensionMatcherTest.php index 8951eadbf549..3a7bbca9b176 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ArrayDimensionMatcherTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ArrayDimensionMatcherTest.php @@ -31,7 +31,7 @@ class ArrayDimensionMatcherTest extends UnitTestCase /** * @test */ - public function hitsFromFixtureAreFound() + public function hitsFromFixtureAreFound(): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $fixtureFile = __DIR__ . '/Fixtures/ArrayDimensionMatcherFixture.php'; @@ -131,7 +131,7 @@ class ArrayDimensionMatcherTest extends UnitTestCase * @param string $phpCode * @param array $expected */ - public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected) + public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $statements = $parser->parse($phpCode); diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ArrayGlobalMatcherTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ArrayGlobalMatcherTest.php index 981f7c038081..7af04b6dfbec 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ArrayGlobalMatcherTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ArrayGlobalMatcherTest.php @@ -31,7 +31,7 @@ class ArrayGlobalMatcherTest extends UnitTestCase /** * @test */ - public function hitsFromFixtureAreFound() + public function hitsFromFixtureAreFound(): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $fixtureFile = __DIR__ . '/Fixtures/ArrayGlobalMatcherFixture.php'; @@ -63,7 +63,7 @@ class ArrayGlobalMatcherTest extends UnitTestCase /** * @return array */ - public function matchesReturnsExpectedRestFilesDataProvider() + public function matchesReturnsExpectedRestFilesDataProvider(): array { return [ 'one match' => [ @@ -93,7 +93,7 @@ class ArrayGlobalMatcherTest extends UnitTestCase * @test * @dataProvider matchesReturnsExpectedRestFilesDataProvider */ - public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected) + public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $statements = $parser->parse($phpCode); diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ClassConstantMatcherTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ClassConstantMatcherTest.php index cf967bc23fb4..41e532d17d1a 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ClassConstantMatcherTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ClassConstantMatcherTest.php @@ -32,7 +32,7 @@ class ClassConstantMatcherTest extends UnitTestCase /** * @test */ - public function hitsFromFixtureAreFound() + public function hitsFromFixtureAreFound(): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $fixtureFile = __DIR__ . '/Fixtures/ClassConstantMatcherFixture.php'; @@ -72,7 +72,7 @@ class ClassConstantMatcherTest extends UnitTestCase /** * @return array */ - public function matchesReturnsExpectedRestFilesDataProvider() + public function matchesReturnsExpectedRestFilesDataProvider(): array { return [ 'a straight match' => [ @@ -102,7 +102,7 @@ class ClassConstantMatcherTest extends UnitTestCase * @test * @dataProvider matchesReturnsExpectedRestFilesDataProvider */ - public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected) + public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $statements = $parser->parse($phpCode); diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ClassNameMatcherTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ClassNameMatcherTest.php index 8d979abcd705..0fd0554880e5 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ClassNameMatcherTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ClassNameMatcherTest.php @@ -32,7 +32,7 @@ class ClassNameMatcherTest extends UnitTestCase /** * @test */ - public function hitsFromFixtureAreFound() + public function hitsFromFixtureAreFound(): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $fixtureFile = __DIR__ . '/Fixtures/ClassNameMatcherFixture.php'; diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ConstantMatcherTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ConstantMatcherTest.php index 95bf46b56673..5a3b9bd1d29b 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ConstantMatcherTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ConstantMatcherTest.php @@ -32,7 +32,7 @@ class ConstantMatcherTest extends UnitTestCase /** * @test */ - public function hitsFromFixtureAreFound() + public function hitsFromFixtureAreFound(): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $fixtureFile = __DIR__ . '/Fixtures/ConstantMatcherFixture.php'; @@ -65,7 +65,7 @@ class ConstantMatcherTest extends UnitTestCase /** * @return array */ - public function matchesReturnsExpectedRestFilesDataProvider() + public function matchesReturnsExpectedRestFilesDataProvider(): array { return [ 'a straight match' => [ @@ -95,7 +95,7 @@ class ConstantMatcherTest extends UnitTestCase * @test * @dataProvider matchesReturnsExpectedRestFilesDataProvider */ - public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected) + public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $statements = $parser->parse($phpCode); diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ConstructorArgumentMatcherTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ConstructorArgumentMatcherTest.php index 941001ee5b6a..06d73ad331d8 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ConstructorArgumentMatcherTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ConstructorArgumentMatcherTest.php @@ -82,7 +82,7 @@ class ConstructorArgumentMatcherTest extends TestCase * @test * @dataProvider hitsFromFixtureAreFoundDataProvider */ - public function hitsFromFixtureAreFound(array $configuration, array $expectation) + public function hitsFromFixtureAreFound(array $configuration, array $expectation): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $fixtureFile = __DIR__ . '/Fixtures/ConstructorArgumentMatcherFixture.php'; diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/ArrayDimensionMatcherFixture.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/ArrayDimensionMatcherFixture.php index 945868b47925..702e2573ab35 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/ArrayDimensionMatcherFixture.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/ArrayDimensionMatcherFixture.php @@ -22,7 +22,7 @@ namespace TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\Fixtures; */ class ArrayDimensionMatcherFixture { - public function aMethod() + public function aMethod(): void { // Match $foo['maxSessionDataSize']; diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/ArrayGlobalMatcherFixture.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/ArrayGlobalMatcherFixture.php index 56881cbfb943..b2ada13b4229 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/ArrayGlobalMatcherFixture.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/ArrayGlobalMatcherFixture.php @@ -22,7 +22,7 @@ namespace TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\Fixtures; */ class ArrayGlobalMatcherFixture { - public function aMethod() + public function aMethod(): void { // Match $GLOBALS['TYPO3_DB']; diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/ClassConstantMatcherFixture.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/ClassConstantMatcherFixture.php index 5c8b85f1ff47..fd03b968c5ce 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/ClassConstantMatcherFixture.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/ClassConstantMatcherFixture.php @@ -24,7 +24,7 @@ use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; */ class ClassConstantMatcherFixture { - public function aMethod() + public function aMethod(): void { // Matches $foo = \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_FE; diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/ClassNameMatcherFixture.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/ClassNameMatcherFixture.php index 266b839b32c5..8651358f3be4 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/ClassNameMatcherFixture.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/ClassNameMatcherFixture.php @@ -29,7 +29,7 @@ use TYPO3\CMS\Backend\Console as Con2; */ class ClassNameMatcherFixture extends App2 implements App3, Con\Application { - public function aMethod(Con2\Application $app) + public function aMethod(Con2\Application $app): void { // Matches $foo = new \RemoveXSS(); diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/ConstantMatcherFixture.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/ConstantMatcherFixture.php index 306795b9ba69..56b860241573 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/ConstantMatcherFixture.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/ConstantMatcherFixture.php @@ -22,7 +22,7 @@ namespace TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\Fixtures; */ class ConstantMatcherFixture { - public function aMethod() + public function aMethod(): void { // Matches $foo = TYPO3_DLOG; diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/FunctionCallMatcherFixture.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/FunctionCallMatcherFixture.php index 8f8c324ed6de..d8a25bfd2004 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/FunctionCallMatcherFixture.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/FunctionCallMatcherFixture.php @@ -22,7 +22,7 @@ namespace TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\Fixtures; */ class FunctionCallMatcherFixture { - public function aMethod() + public function aMethod(): void { // Matches \debugBegin(); diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/InterfaceMethodChangedMatcherFixture.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/InterfaceMethodChangedMatcherFixture.php index 351034226121..b5761c61fac7 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/InterfaceMethodChangedMatcherFixture.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/InterfaceMethodChangedMatcherFixture.php @@ -29,7 +29,7 @@ class InterfaceMethodChangedMatcherFixture * @param $arg2 * @param $arg3 */ - public function like1($arg1, $arg2, $arg3) + public function like1($arg1, $arg2, $arg3): void { // Match: Call to ->like() with three arguments has been removed $foo->like1('arg1', 'arg2', 'arg3'); @@ -43,7 +43,7 @@ class InterfaceMethodChangedMatcherFixture * @param $arg3 * @extensionScannerIgnoreLine */ - public function like2($arg1, $arg2, $arg3) + public function like2($arg1, $arg2, $arg3): void { // @extensionScannerIgnoreLine // Match: Call to ->like() with three arguments has been removed @@ -56,7 +56,7 @@ class InterfaceMethodChangedMatcherFixture * @param $arg1 * @param $arg2 */ - public function like3($arg1, $arg2) + public function like3($arg1, $arg2): void { // No match: Two arguments is ok $foo->like1('arg1', 'arg2'); @@ -71,7 +71,7 @@ class InterfaceMethodChangedMatcherFixture * @param $arg2 * @param $arg3 */ - public static function like4($arg1, $arg2, $arg3) + public static function like4($arg1, $arg2, $arg3): void { } @@ -82,7 +82,7 @@ class InterfaceMethodChangedMatcherFixture * @param $arg2 * @param $arg3 */ - protected function like5($arg1, $arg2, $arg3) + protected function like5($arg1, $arg2, $arg3): void { } } diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodArgumentDroppedMatcherFixture.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodArgumentDroppedMatcherFixture.php index 1e610d13d118..c04ef9fbb4a5 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodArgumentDroppedMatcherFixture.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodArgumentDroppedMatcherFixture.php @@ -22,7 +22,7 @@ namespace TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\Fixtures; */ class MethodArgumentDroppedMatcherFixture { - public function aMethod() + public function aMethod(): void { // Match: euc_char_mapping() shouldn't be called with more than 2 args $foo->euc_char_mapping('arg1', 'arg2', 'arg3'); diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodArgumentDroppedStaticMatcherFixture.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodArgumentDroppedStaticMatcherFixture.php index 82b3a7a1630c..081e0075371e 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodArgumentDroppedStaticMatcherFixture.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodArgumentDroppedStaticMatcherFixture.php @@ -24,7 +24,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; */ class MethodArgumentDroppedStaticMatcherFixture { - public function aMethod() + public function aMethod(): void { // Match: getFileAbsFileName() uses one argument only \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('foo', 'bar'); diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodArgumentRequiredMatcherFixture.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodArgumentRequiredMatcherFixture.php index eca4474aabfa..477486122b76 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodArgumentRequiredMatcherFixture.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodArgumentRequiredMatcherFixture.php @@ -22,7 +22,7 @@ namespace TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\Fixtures; */ class MethodArgumentRequiredMatcherFixture { - public function aMethod() + public function aMethod(): void { // Match: searchWhere() needs at least 3 arguments $foo->searchWhere('arg1', 'arg2'); diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodArgumentRequiredStaticMatcherFixture.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodArgumentRequiredStaticMatcherFixture.php index c7d83f513840..d8dfbf672469 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodArgumentRequiredStaticMatcherFixture.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodArgumentRequiredStaticMatcherFixture.php @@ -24,7 +24,7 @@ use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; */ class MethodArgumentRequiredStaticMatcherFixture { - public function aMethod() + public function aMethod(): void { // Match: addNavigationComponent() uses less than three arguments \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addNavigationComponent('foo', 'bar'); diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodArgumentUnusedMatcherFixture.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodArgumentUnusedMatcherFixture.php index 2c284cf98b8d..21033edda56f 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodArgumentUnusedMatcherFixture.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodArgumentUnusedMatcherFixture.php @@ -22,7 +22,7 @@ namespace TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\Fixtures; */ class MethodArgumentUnusedMatcherFixture { - public function aMethod() + public function aMethod(): void { // Match: RTE_transform() should have arg2 as null if given $foo->RTE_transform('arg1', 'arg2'); diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodCallMatcherFixture.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodCallMatcherFixture.php index 5abd8ff3fec9..4dae1e09b8e4 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodCallMatcherFixture.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodCallMatcherFixture.php @@ -22,7 +22,7 @@ namespace TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\Fixtures; */ class MethodCallMatcherFixture { - public function aMethod() + public function aMethod(): void { // Match: confirmMsg() needs at least 4 args $foo->confirmMsg('arg1', 'arg2', 'arg3', 'arg4'); diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodCallStaticMatcherFixture.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodCallStaticMatcherFixture.php index 8d983cc32fd0..c27da73219c1 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodCallStaticMatcherFixture.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/MethodCallStaticMatcherFixture.php @@ -24,7 +24,7 @@ use TYPO3\CMS\Backend\Utility\BackendUtility; */ class MethodCallStaticMatcherFixture { - public function aMethod() + public function aMethod(): void { // Matches BackendUtility::getAjaxUrl(); diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/PropertyProtectedMatcherFixture.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/PropertyProtectedMatcherFixture.php index 8c47ab4ab69e..e363472a6e0f 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/PropertyProtectedMatcherFixture.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/PropertyProtectedMatcherFixture.php @@ -22,7 +22,7 @@ namespace TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\Fixtures; */ class PropertyProtectedMatcherFixture { - public function aMethod() + public function aMethod(): void { // Match $foo->recUpdateAccessCache; diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/PropertyPublicMatcherFixture.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/PropertyPublicMatcherFixture.php index 73d8bfc919e6..e2ad010c1447 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/PropertyPublicMatcherFixture.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/PropertyPublicMatcherFixture.php @@ -22,7 +22,7 @@ namespace TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\Fixtures; */ class PropertyPublicMatcherFixture { - public function aMethod() + public function aMethod(): void { // Match $foo->localizationMode; diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/FunctionCallMatcherTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/FunctionCallMatcherTest.php index d4673e6b52e0..5ddef6bb58d2 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/FunctionCallMatcherTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/FunctionCallMatcherTest.php @@ -31,7 +31,7 @@ class FunctionCallMatcherTest extends UnitTestCase /** * @test */ - public function hitsFromFixtureAreFound() + public function hitsFromFixtureAreFound(): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $fixtureFile = __DIR__ . '/Fixtures/FunctionCallMatcherFixture.php'; @@ -65,7 +65,7 @@ class FunctionCallMatcherTest extends UnitTestCase /** * @test */ - public function matchIsIgnoredIfIgnoreFileIsSet() + public function matchIsIgnoredIfIgnoreFileIsSet(): void { $phpCode = <<<'EOC' <?php diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/InterfaceMethodChangedMatcherTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/InterfaceMethodChangedMatcherTest.php index ac0245ed9e4f..540b57606984 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/InterfaceMethodChangedMatcherTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/InterfaceMethodChangedMatcherTest.php @@ -31,7 +31,7 @@ class InterfaceMethodChangedMatcherTest extends UnitTestCase /** * @test */ - public function hitsFromFixtureAreFound() + public function hitsFromFixtureAreFound(): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $fixtureFile = __DIR__ . '/Fixtures/InterfaceMethodChangedMatcherFixture.php'; diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodAnnotationMatcherTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodAnnotationMatcherTest.php index 6a74bf41ce2c..d3c1d60793c3 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodAnnotationMatcherTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodAnnotationMatcherTest.php @@ -31,7 +31,7 @@ class MethodAnnotationMatcherTest extends UnitTestCase /** * @test */ - public function hitsFromFixtureAreFound() + public function hitsFromFixtureAreFound(): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $fixtureFile = __DIR__ . '/Fixtures/MethodAnnotationMatcherFixture.php'; diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodArgumentDroppedMatcherTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodArgumentDroppedMatcherTest.php index 5dba9de48541..4e6fc0a74d92 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodArgumentDroppedMatcherTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodArgumentDroppedMatcherTest.php @@ -31,7 +31,7 @@ class MethodArgumentDroppedMatcherTest extends UnitTestCase /** * @test */ - public function hitsFromFixtureAreFound() + public function hitsFromFixtureAreFound(): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $fixtureFile = __DIR__ . '/Fixtures/MethodArgumentDroppedMatcherFixture.php'; @@ -232,7 +232,7 @@ class MethodArgumentDroppedMatcherTest extends UnitTestCase * @param string $phpCode * @param array $expected */ - public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected) + public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $statements = $parser->parse($phpCode); diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodArgumentDroppedStaticMatcherTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodArgumentDroppedStaticMatcherTest.php index 9d3830d3d889..8a9fa6cb8d94 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodArgumentDroppedStaticMatcherTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodArgumentDroppedStaticMatcherTest.php @@ -31,7 +31,7 @@ class MethodArgumentDroppedStaticMatcherTest extends UnitTestCase /** * @test */ - public function hitsFromFixtureAreFound() + public function hitsFromFixtureAreFound(): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $fixtureFile = __DIR__ . '/Fixtures/MethodArgumentDroppedStaticMatcherFixture.php'; @@ -235,7 +235,7 @@ class MethodArgumentDroppedStaticMatcherTest extends UnitTestCase * @param string $phpCode * @param array $expected */ - public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected) + public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $statements = $parser->parse($phpCode); diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodArgumentRequiredMatcherTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodArgumentRequiredMatcherTest.php index 4cf6e13bb470..4a21be36b01d 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodArgumentRequiredMatcherTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodArgumentRequiredMatcherTest.php @@ -31,7 +31,7 @@ class MethodArgumentRequiredMatcherTest extends UnitTestCase /** * @test */ - public function hitsFromFixtureAreFound() + public function hitsFromFixtureAreFound(): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $fixtureFile = __DIR__ . '/Fixtures/MethodArgumentRequiredMatcherFixture.php'; @@ -225,7 +225,7 @@ class MethodArgumentRequiredMatcherTest extends UnitTestCase * @param string $phpCode * @param array $expected */ - public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected) + public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $statements = $parser->parse($phpCode); diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodArgumentRequiredStaticMatcherTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodArgumentRequiredStaticMatcherTest.php index dd5f32fb69e0..0467d43d9994 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodArgumentRequiredStaticMatcherTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodArgumentRequiredStaticMatcherTest.php @@ -31,7 +31,7 @@ class MethodArgumentRequiredStaticMatcherTest extends UnitTestCase /** * @test */ - public function hitsFromFixtureAreFound() + public function hitsFromFixtureAreFound(): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $fixtureFile = __DIR__ . '/Fixtures/MethodArgumentRequiredStaticMatcherFixture.php'; @@ -203,7 +203,7 @@ class MethodArgumentRequiredStaticMatcherTest extends UnitTestCase * @param string $phpCode * @param array $expected */ - public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected) + public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $statements = $parser->parse($phpCode); diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodArgumentUnusedMatcherTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodArgumentUnusedMatcherTest.php index 13b349764207..b6f76baa0f7e 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodArgumentUnusedMatcherTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodArgumentUnusedMatcherTest.php @@ -31,7 +31,7 @@ class MethodArgumentUnusedMatcherTest extends UnitTestCase /** * @test */ - public function hitsFromFixtureAreFound() + public function hitsFromFixtureAreFound(): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $fixtureFile = __DIR__ . '/Fixtures/MethodArgumentUnusedMatcherFixture.php'; @@ -66,7 +66,7 @@ class MethodArgumentUnusedMatcherTest extends UnitTestCase /** * @return array */ - public function matchesReturnsExpectedRestFilesDataProvider() + public function matchesReturnsExpectedRestFilesDataProvider(): array { return [ 'two rest candidates with same number of arguments' => [ @@ -218,7 +218,7 @@ class MethodArgumentUnusedMatcherTest extends UnitTestCase * @test * @dataProvider matchesReturnsExpectedRestFilesDataProvider */ - public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected) + public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $statements = $parser->parse($phpCode); diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodCallMatcherTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodCallMatcherTest.php index e7fdc4b5840a..a9bc99742363 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodCallMatcherTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodCallMatcherTest.php @@ -31,7 +31,7 @@ class MethodCallMatcherTest extends UnitTestCase /** * @test */ - public function hitsFromFixtureAreFound() + public function hitsFromFixtureAreFound(): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $fixtureFile = __DIR__ . '/Fixtures/MethodCallMatcherFixture.php'; @@ -68,7 +68,7 @@ class MethodCallMatcherTest extends UnitTestCase /** * @test */ - public function matchIsIgnoredIfIgnoreFileIsSet() + public function matchIsIgnoredIfIgnoreFileIsSet(): void { $phpCode = <<<'EOC' <?php @@ -315,7 +315,7 @@ EOC; * @param string $phpCode * @param array $expected */ - public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected) + public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $statements = $parser->parse($phpCode); diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodCallStaticMatcherTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodCallStaticMatcherTest.php index 76d17f951c11..6133990e7c13 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodCallStaticMatcherTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/MethodCallStaticMatcherTest.php @@ -32,7 +32,7 @@ class MethodCallStaticMatcherTest extends UnitTestCase /** * @test */ - public function hitsFromFixtureAreFound() + public function hitsFromFixtureAreFound(): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $fixtureFile = __DIR__ . '/Fixtures/MethodCallStaticMatcherFixture.php'; @@ -69,7 +69,7 @@ class MethodCallStaticMatcherTest extends UnitTestCase /** * @return array */ - public function matchesReturnsExpectedRestFilesDataProvider() + public function matchesReturnsExpectedRestFilesDataProvider(): array { return [ 'two rest candidates with same number of arguments' => [ @@ -273,7 +273,7 @@ class MethodCallStaticMatcherTest extends UnitTestCase * @test * @dataProvider matchesReturnsExpectedRestFilesDataProvider */ - public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected) + public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $statements = $parser->parse($phpCode); diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/PropertyAnnotationMatcherTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/PropertyAnnotationMatcherTest.php index ee61a33e79f5..861bb6497054 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/PropertyAnnotationMatcherTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/PropertyAnnotationMatcherTest.php @@ -31,7 +31,7 @@ class PropertyAnnotationMatcherTest extends UnitTestCase /** * @test */ - public function hitsFromFixtureAreFound() + public function hitsFromFixtureAreFound(): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $fixtureFile = __DIR__ . '/Fixtures/PropertyAnnotationMatcherFixture.php'; diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/PropertyExistsStaticMatcherTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/PropertyExistsStaticMatcherTest.php index f368f9cf3995..7014cc49ea01 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/PropertyExistsStaticMatcherTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/PropertyExistsStaticMatcherTest.php @@ -31,7 +31,7 @@ class PropertyExistsStaticMatcherTest extends UnitTestCase /** * @test */ - public function hitsFromFixtureAreFound() + public function hitsFromFixtureAreFound(): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $fixtureFile = __DIR__ . '/Fixtures/PropertyExistsStaticMatcherFixture.php'; diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/PropertyProtectedMatcherTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/PropertyProtectedMatcherTest.php index a0026edb06eb..3bae7fd8bc52 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/PropertyProtectedMatcherTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/PropertyProtectedMatcherTest.php @@ -31,7 +31,7 @@ class PropertyProtectedMatcherTest extends UnitTestCase /** * @test */ - public function hitsFromFixtureAreFound() + public function hitsFromFixtureAreFound(): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $fixtureFile = __DIR__ . '/Fixtures/PropertyProtectedMatcherFixture.php'; @@ -64,7 +64,7 @@ class PropertyProtectedMatcherTest extends UnitTestCase /** * @return array */ - public function matchesReturnsExpectedRestFilesDataProvider() + public function matchesReturnsExpectedRestFilesDataProvider(): array { return [ 'two candidates' => [ @@ -127,7 +127,7 @@ class PropertyProtectedMatcherTest extends UnitTestCase * @test * @dataProvider matchesReturnsExpectedRestFilesDataProvider */ - public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected) + public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $statements = $parser->parse($phpCode); diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/PropertyPublicMatcherTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/PropertyPublicMatcherTest.php index ebeb5212bc11..252f5dc53878 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/PropertyPublicMatcherTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/PropertyPublicMatcherTest.php @@ -31,7 +31,7 @@ class PropertyPublicMatcherTest extends UnitTestCase /** * @test */ - public function hitsFromFixtureAreFound() + public function hitsFromFixtureAreFound(): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $fixtureFile = __DIR__ . '/Fixtures/PropertyPublicMatcherFixture.php'; @@ -64,7 +64,7 @@ class PropertyPublicMatcherTest extends UnitTestCase /** * @return array */ - public function matchesReturnsExpectedRestFilesDataProvider() + public function matchesReturnsExpectedRestFilesDataProvider(): array { return [ 'two candidates' => [ @@ -127,7 +127,7 @@ class PropertyPublicMatcherTest extends UnitTestCase * @test * @dataProvider matchesReturnsExpectedRestFilesDataProvider */ - public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected) + public function matchesReturnsExpectedRestFiles(array $configuration, string $phpCode, array $expected): void { $parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); $statements = $parser->parse($phpCode); diff --git a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/MatcherFactoryTest.php b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/MatcherFactoryTest.php index 260502ec2fba..a37fc8029468 100644 --- a/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/MatcherFactoryTest.php +++ b/typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/MatcherFactoryTest.php @@ -28,7 +28,7 @@ class MatcherFactoryTest extends UnitTestCase /** * @test */ - public function createAllThrowWithMissingClass() + public function createAllThrowWithMissingClass(): void { $subject = new MatcherFactory(); $this->expectException(\RuntimeException::class); @@ -44,7 +44,7 @@ class MatcherFactoryTest extends UnitTestCase /** * @test */ - public function createAllThrowsWithMissingConfiguration() + public function createAllThrowsWithMissingConfiguration(): void { $subject = new MatcherFactory(); $this->expectException(\RuntimeException::class); @@ -60,7 +60,7 @@ class MatcherFactoryTest extends UnitTestCase /** * @test */ - public function createAllThrowsWithBothConfigurationFileAndConfigurationArray() + public function createAllThrowsWithBothConfigurationFileAndConfigurationArray(): void { $subject = new MatcherFactory(); $this->expectException(\RuntimeException::class); @@ -78,7 +78,7 @@ class MatcherFactoryTest extends UnitTestCase /** * @test */ - public function createAllThrowsIfConfigurationFileDoesNotExist() + public function createAllThrowsIfConfigurationFileDoesNotExist(): void { $subject = new MatcherFactory(); $this->expectException(\RuntimeException::class); @@ -95,7 +95,7 @@ class MatcherFactoryTest extends UnitTestCase /** * @test */ - public function createAllThrowsIfConfigurationFileDoesNotReturnArray() + public function createAllThrowsIfConfigurationFileDoesNotReturnArray(): void { $subject = new MatcherFactory(); $this->expectException(\RuntimeException::class); @@ -112,7 +112,7 @@ class MatcherFactoryTest extends UnitTestCase /** * @test */ - public function createAllThrowsIfConfigurationArrayIsNotAnArray() + public function createAllThrowsIfConfigurationArrayIsNotAnArray(): void { $subject = new MatcherFactory(); $this->expectException(\RuntimeException::class); @@ -129,7 +129,7 @@ class MatcherFactoryTest extends UnitTestCase /** * @test */ - public function createAllThrowIfMatcherDoesNotImplementCodeScannerInterface() + public function createAllThrowIfMatcherDoesNotImplementCodeScannerInterface(): void { $subject = new MatcherFactory(); $this->expectException(\RuntimeException::class); diff --git a/typo3/sysext/install/Tests/Unit/FolderStructure/AbstractNodeTest.php b/typo3/sysext/install/Tests/Unit/FolderStructure/AbstractNodeTest.php index f73be00a0ca1..ffecd8850406 100644 --- a/typo3/sysext/install/Tests/Unit/FolderStructure/AbstractNodeTest.php +++ b/typo3/sysext/install/Tests/Unit/FolderStructure/AbstractNodeTest.php @@ -17,6 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Install\Tests\Unit\FolderStructure; +use PHPUnit\Framework\MockObject\MockObject; use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Messaging\FlashMessage; use TYPO3\CMS\Core\Utility\StringUtility; @@ -36,9 +37,9 @@ class AbstractNodeTest extends FolderStructureTestCase /** * @test */ - public function getNameReturnsSetName() + public function getNameReturnsSetName(): void { - /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node AbstractNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(AbstractNode::class, ['dummy'], [], '', false); $name = StringUtility::getUniqueId('name_'); $node->_set('name', $name); @@ -48,9 +49,9 @@ class AbstractNodeTest extends FolderStructureTestCase /** * @test */ - public function getTargetPermissionReturnsSetTargetPermission() + public function getTargetPermissionReturnsSetTargetPermission(): void { - /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node AbstractNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(AbstractNode::class, ['dummy'], [], '', false); $permission = '1234'; $node->_set('targetPermission', $permission); @@ -60,9 +61,9 @@ class AbstractNodeTest extends FolderStructureTestCase /** * @test */ - public function getChildrenReturnsSetChildren() + public function getChildrenReturnsSetChildren(): void { - /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node AbstractNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(AbstractNode::class, ['dummy'], [], '', false); $children = ['1234']; $node->_set('children', $children); @@ -72,9 +73,9 @@ class AbstractNodeTest extends FolderStructureTestCase /** * @test */ - public function getParentReturnsSetParent() + public function getParentReturnsSetParent(): void { - /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node AbstractNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(AbstractNode::class, ['dummy'], [], '', false); $parent = $this->createMock(RootNodeInterface::class); $node->_set('parent', $parent); @@ -84,9 +85,9 @@ class AbstractNodeTest extends FolderStructureTestCase /** * @test */ - public function getAbsolutePathCallsParentForPathAndAppendsOwnName() + public function getAbsolutePathCallsParentForPathAndAppendsOwnName(): void { - /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node AbstractNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(AbstractNode::class, ['dummy'], [], '', false); $parent = $this->createMock(RootNodeInterface::class); $parentPath = '/foo/bar'; @@ -100,9 +101,9 @@ class AbstractNodeTest extends FolderStructureTestCase /** * @test */ - public function isWritableCallsParentIsWritable() + public function isWritableCallsParentIsWritable(): void { - /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node AbstractNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(AbstractNode::class, ['dummy'], [], '', false); $parentMock = $this->createMock(NodeInterface::class); $parentMock->expects(self::once())->method('isWritable'); @@ -113,9 +114,9 @@ class AbstractNodeTest extends FolderStructureTestCase /** * @test */ - public function isWritableReturnsWritableStatusOfParent() + public function isWritableReturnsWritableStatusOfParent(): void { - /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node AbstractNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(AbstractNode::class, ['dummy'], [], '', false); $parentMock = $this->createMock(NodeInterface::class); $parentMock->expects(self::once())->method('isWritable')->willReturn(true); @@ -126,12 +127,12 @@ class AbstractNodeTest extends FolderStructureTestCase /** * @test */ - public function existsReturnsTrueIfNodeExists() + public function existsReturnsTrueIfNodeExists(): void { - /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node AbstractNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(AbstractNode::class, ['getAbsolutePath'], [], '', false); $path = $this->getVirtualTestDir('dir_'); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); + $node->method('getAbsolutePath')->willReturn($path); self::assertTrue($node->_call('exists')); } @@ -139,9 +140,9 @@ class AbstractNodeTest extends FolderStructureTestCase * @test * @see https://github.com/mikey179/vfsStream/wiki/Known-Issues - symlink doesn't work with vfsStream */ - public function existsReturnsTrueIfIsLinkAndTargetIsDead() + public function existsReturnsTrueIfIsLinkAndTargetIsDead(): void { - /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node AbstractNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(AbstractNode::class, ['getAbsolutePath'], [], '', false); $path = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('link_'); $target = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('notExists_'); @@ -149,28 +150,28 @@ class AbstractNodeTest extends FolderStructureTestCase symlink($target, $path); unlink($target); $this->testFilesToDelete[] = $path; - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); + $node->method('getAbsolutePath')->willReturn($path); self::assertTrue($node->_call('exists')); } /** * @test */ - public function existsReturnsFalseIfNodeNotExists() + public function existsReturnsFalseIfNodeNotExists(): void { - /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node AbstractNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(AbstractNode::class, ['getAbsolutePath'], [], '', false); $path = $this->getVirtualTestFilePath('dir_'); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); + $node->method('getAbsolutePath')->willReturn($path); self::assertFalse($node->_call('exists')); } /** * @test */ - public function fixPermissionThrowsExceptionIfPermissionAreAlreadyCorrect() + public function fixPermissionThrowsExceptionIfPermissionAreAlreadyCorrect(): void { - /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node AbstractNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( AbstractNode::class, ['isPermissionCorrect', 'getAbsolutePath'], @@ -180,7 +181,7 @@ class AbstractNodeTest extends FolderStructureTestCase ); $this->expectException(Exception::class); $this->expectExceptionCode(1366744035); - $node->expects(self::any())->method('getAbsolutePath')->willReturn(''); + $node->method('getAbsolutePath')->willReturn(''); $node->expects(self::once())->method('isPermissionCorrect')->willReturn(true); $node->_call('fixPermission'); } @@ -188,12 +189,12 @@ class AbstractNodeTest extends FolderStructureTestCase /** * @test */ - public function fixPermissionReturnsNoticeStatusIfPermissionCanNotBeChanged() + public function fixPermissionReturnsNoticeStatusIfPermissionCanNotBeChanged(): void { if (function_exists('posix_getegid') && posix_getegid() === 0) { self::markTestSkipped('Test skipped if run on linux as root'); } - /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node AbstractNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( AbstractNode::class, ['isPermissionCorrect', 'getRelativePathBelowSiteRoot', 'getAbsolutePath'], @@ -201,13 +202,13 @@ class AbstractNodeTest extends FolderStructureTestCase '', false ); - $node->expects(self::any())->method('getRelativePathBelowSiteRoot')->willReturn(''); + $node->method('getRelativePathBelowSiteRoot')->willReturn(''); $node->expects(self::once())->method('isPermissionCorrect')->willReturn(false); - $path = $this->getVirtualTestDir('root_'); + $path = $this->getVirtualTestDir(); $subPath = $path . '/' . StringUtility::getUniqueId('dir_'); mkdir($subPath); chmod($path, 02000); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($subPath); + $node->method('getAbsolutePath')->willReturn($subPath); $node->_set('targetPermission', '2770'); self::assertEquals(FlashMessage::NOTICE, $node->_call('fixPermission')->getSeverity()); chmod($path, 02770); @@ -216,12 +217,12 @@ class AbstractNodeTest extends FolderStructureTestCase /** * @test */ - public function fixPermissionReturnsNoticeStatusIfPermissionsCanNotBeChanged() + public function fixPermissionReturnsNoticeStatusIfPermissionsCanNotBeChanged(): void { if (function_exists('posix_getegid') && posix_getegid() === 0) { self::markTestSkipped('Test skipped if run on linux as root'); } - /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node AbstractNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( AbstractNode::class, ['isPermissionCorrect', 'getRelativePathBelowSiteRoot', 'getAbsolutePath'], @@ -229,13 +230,13 @@ class AbstractNodeTest extends FolderStructureTestCase '', false ); - $node->expects(self::any())->method('getRelativePathBelowSiteRoot')->willReturn(''); + $node->method('getRelativePathBelowSiteRoot')->willReturn(''); $node->expects(self::once())->method('isPermissionCorrect')->willReturn(false); - $path = $this->getVirtualTestDir('root_'); + $path = $this->getVirtualTestDir(); $subPath = $path . '/' . StringUtility::getUniqueId('dir_'); mkdir($subPath); chmod($path, 02000); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($subPath); + $node->method('getAbsolutePath')->willReturn($subPath); $node->_set('targetPermission', '2770'); self::assertEquals(FlashMessage::NOTICE, $node->_call('fixPermission')->getSeverity()); chmod($path, 02770); @@ -244,9 +245,9 @@ class AbstractNodeTest extends FolderStructureTestCase /** * @test */ - public function fixPermissionReturnsOkStatusIfPermissionCanBeFixedAndSetsPermissionToCorrectValue() + public function fixPermissionReturnsOkStatusIfPermissionCanBeFixedAndSetsPermissionToCorrectValue(): void { - /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node AbstractNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( AbstractNode::class, ['isPermissionCorrect', 'getRelativePathBelowSiteRoot', 'getAbsolutePath'], @@ -254,14 +255,14 @@ class AbstractNodeTest extends FolderStructureTestCase '', false ); - $node->expects(self::any())->method('getRelativePathBelowSiteRoot')->willReturn(''); + $node->method('getRelativePathBelowSiteRoot')->willReturn(''); $node->expects(self::once())->method('isPermissionCorrect')->willReturn(false); - $path = $this->getVirtualTestDir('root_'); + $path = $this->getVirtualTestDir(); $subPath = $path . '/' . StringUtility::getUniqueId('dir_'); mkdir($subPath); chmod($path, 02770); $node->_set('targetPermission', '2770'); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($subPath); + $node->method('getAbsolutePath')->willReturn($subPath); self::assertEquals(FlashMessage::OK, $node->_call('fixPermission')->getSeverity()); $resultDirectoryPermissions = substr(decoct(fileperms($subPath)), 1); self::assertSame('2770', $resultDirectoryPermissions); @@ -270,9 +271,9 @@ class AbstractNodeTest extends FolderStructureTestCase /** * @test */ - public function isPermissionCorrectReturnsTrueOnWindowsOs() + public function isPermissionCorrectReturnsTrueOnWindowsOs(): void { - /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node AbstractNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(AbstractNode::class, ['isWindowsOs'], [], '', false); $node->expects(self::once())->method('isWindowsOs')->willReturn(true); self::assertTrue($node->_call('isPermissionCorrect')); @@ -281,12 +282,12 @@ class AbstractNodeTest extends FolderStructureTestCase /** * @test */ - public function isPermissionCorrectReturnsFalseIfTargetPermissionAndCurrentPermissionAreNotIdentical() + public function isPermissionCorrectReturnsFalseIfTargetPermissionAndCurrentPermissionAreNotIdentical(): void { - /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node AbstractNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(AbstractNode::class, ['isWindowsOs', 'getCurrentPermission'], [], '', false); - $node->expects(self::any())->method('isWindowsOs')->willReturn(false); - $node->expects(self::any())->method('getCurrentPermission')->willReturn('foo'); + $node->method('isWindowsOs')->willReturn(false); + $node->method('getCurrentPermission')->willReturn('foo'); $node->_set('targetPermission', 'bar'); self::assertFalse($node->_call('isPermissionCorrect')); } @@ -294,40 +295,40 @@ class AbstractNodeTest extends FolderStructureTestCase /** * @test */ - public function getCurrentPermissionReturnsCurrentDirectoryPermission() + public function getCurrentPermissionReturnsCurrentDirectoryPermission(): void { - /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node AbstractNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(AbstractNode::class, ['getAbsolutePath'], [], '', false); $path = $this->getVirtualTestDir('dir_'); chmod($path, 02775); clearstatcache(); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); + $node->method('getAbsolutePath')->willReturn($path); self::assertSame('2775', $node->_call('getCurrentPermission')); } /** * @test */ - public function getCurrentPermissionReturnsCurrentFilePermission() + public function getCurrentPermissionReturnsCurrentFilePermission(): void { - /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node AbstractNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(AbstractNode::class, ['getAbsolutePath'], [], '', false); $file = $this->getVirtualTestFilePath('file_'); touch($file); chmod($file, 0770); clearstatcache(); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($file); + $node->method('getAbsolutePath')->willReturn($file); self::assertSame('0770', $node->_call('getCurrentPermission')); } /** * @test */ - public function getRelativePathBelowSiteRootThrowsExceptionIfGivenPathIsNotBelowPathSiteConstant() + public function getRelativePathBelowSiteRootThrowsExceptionIfGivenPathIsNotBelowPathSiteConstant(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionCode(1366398198); - /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node AbstractNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(AbstractNode::class, ['dummy'], [], '', false); $node->_call('getRelativePathBelowSiteRoot', '/tmp'); } @@ -335,9 +336,9 @@ class AbstractNodeTest extends FolderStructureTestCase /** * @test */ - public function getRelativePathCallsGetAbsolutePathIfPathIsNull() + public function getRelativePathCallsGetAbsolutePathIfPathIsNull(): void { - /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node AbstractNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( AbstractNode::class, ['getAbsolutePath'], @@ -352,9 +353,9 @@ class AbstractNodeTest extends FolderStructureTestCase /** * @test */ - public function getRelativePathBelowSiteRootReturnsSingleForwardSlashIfGivenPathEqualsPathSiteConstant() + public function getRelativePathBelowSiteRootReturnsSingleForwardSlashIfGivenPathEqualsPathSiteConstant(): void { - /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node AbstractNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(AbstractNode::class, ['dummy'], [], '', false); $result = $node->_call('getRelativePathBelowSiteRoot', Environment::getPublicPath() . '/'); self::assertSame('/', $result); @@ -363,9 +364,9 @@ class AbstractNodeTest extends FolderStructureTestCase /** * @test */ - public function getRelativePathBelowSiteRootReturnsSubPath() + public function getRelativePathBelowSiteRootReturnsSubPath(): void { - /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node AbstractNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(AbstractNode::class, ['dummy'], [], '', false); $result = $node->_call('getRelativePathBelowSiteRoot', Environment::getPublicPath() . '/foo/bar'); self::assertSame('/foo/bar', $result); diff --git a/typo3/sysext/install/Tests/Unit/FolderStructure/DefaultFactoryTest.php b/typo3/sysext/install/Tests/Unit/FolderStructure/DefaultFactoryTest.php index 78e073665726..d91a532ab40c 100644 --- a/typo3/sysext/install/Tests/Unit/FolderStructure/DefaultFactoryTest.php +++ b/typo3/sysext/install/Tests/Unit/FolderStructure/DefaultFactoryTest.php @@ -29,7 +29,7 @@ class DefaultFactoryTest extends UnitTestCase /** * @test */ - public function getStructureReturnsInstanceOfStructureFacadeInterface() + public function getStructureReturnsInstanceOfStructureFacadeInterface(): void { $object = new DefaultFactory(); self::assertInstanceOf(StructureFacadeInterface::class, $object->getStructure()); diff --git a/typo3/sysext/install/Tests/Unit/FolderStructure/DirectoryNodeTest.php b/typo3/sysext/install/Tests/Unit/FolderStructure/DirectoryNodeTest.php index 2b63a23205da..9087babbe296 100644 --- a/typo3/sysext/install/Tests/Unit/FolderStructure/DirectoryNodeTest.php +++ b/typo3/sysext/install/Tests/Unit/FolderStructure/DirectoryNodeTest.php @@ -17,6 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Install\Tests\Unit\FolderStructure; +use PHPUnit\Framework\MockObject\MockObject; use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Messaging\FlashMessage; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -64,7 +65,7 @@ class DirectoryNodeTest extends FolderStructureTestCase public function constructorCallsCreateChildrenIfChildrenAreSet(): void { $parent = $this->createMock(NodeInterface::class); - /** @var $node DirectoryNode|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|MockObject */ $node = $this->getMockBuilder(DirectoryNode::class) ->onlyMethods(['createChildren']) ->disableOriginalConstructor() @@ -86,7 +87,7 @@ class DirectoryNodeTest extends FolderStructureTestCase public function constructorSetsParent(): void { $parent = $this->createMock(NodeInterface::class); - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(DirectoryNode::class, ['dummy'], [], '', false); $structure = [ 'name' => 'foo', @@ -101,7 +102,7 @@ class DirectoryNodeTest extends FolderStructureTestCase public function constructorSetsTargetPermission(): void { $parent = $this->createMock(NodeInterface::class); - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(DirectoryNode::class, ['dummy'], [], '', false); $targetPermission = '2550'; $structure = [ @@ -128,7 +129,7 @@ class DirectoryNodeTest extends FolderStructureTestCase */ public function getStatusReturnsArray(): void { - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( DirectoryNode::class, ['getAbsolutePath', 'getRelativePathBelowSiteRoot', 'exists', 'isDirectory', 'isWritable', 'isPermissionCorrect'], @@ -151,7 +152,7 @@ class DirectoryNodeTest extends FolderStructureTestCase */ public function getStatusReturnsArrayWithWarningStatusIfDirectoryNotExists(): void { - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( DirectoryNode::class, ['getAbsolutePath', 'getRelativePathBelowSiteRoot', 'exists', 'isDirectory', 'isWritable', 'isPermissionCorrect'], @@ -175,7 +176,7 @@ class DirectoryNodeTest extends FolderStructureTestCase */ public function getStatusReturnsArrayWithErrorStatusIfNodeIsNotADirectory(): void { - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( DirectoryNode::class, ['getAbsolutePath', 'getRelativePathBelowSiteRoot', 'exists', 'isDirectory', 'isWritable', 'isPermissionCorrect'], @@ -200,7 +201,7 @@ class DirectoryNodeTest extends FolderStructureTestCase */ public function getStatusReturnsArrayWithErrorStatusIfDirectoryExistsButIsNotWritable(): void { - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( DirectoryNode::class, ['getAbsolutePath', 'getRelativePathBelowSiteRoot', 'exists', 'isDirectory', 'isWritable', 'isPermissionCorrect'], @@ -225,7 +226,7 @@ class DirectoryNodeTest extends FolderStructureTestCase */ public function getStatusReturnsArrayWithNoticeStatusIfDirectoryExistsButPermissionAreNotCorrect(): void { - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( DirectoryNode::class, ['getAbsolutePath', 'getRelativePathBelowSiteRoot', 'exists', 'isDirectory', 'isWritable', 'isPermissionCorrect'], @@ -250,7 +251,7 @@ class DirectoryNodeTest extends FolderStructureTestCase */ public function getStatusReturnsArrayWithOkStatusIfDirectoryExistsAndPermissionAreCorrect(): void { - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( DirectoryNode::class, ['getAbsolutePath', 'getRelativePathBelowSiteRoot', 'exists', 'isDirectory', 'isWritable', 'isPermissionCorrect'], @@ -275,7 +276,7 @@ class DirectoryNodeTest extends FolderStructureTestCase */ public function getStatusCallsGetStatusOnChildren(): void { - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( DirectoryNode::class, ['exists', 'isDirectory', 'isPermissionCorrect', 'getRelativePathBelowSiteRoot', 'isWritable'], @@ -300,7 +301,7 @@ class DirectoryNodeTest extends FolderStructureTestCase */ public function getStatusReturnsArrayWithOwnStatusAndStatusOfChild(): void { - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( DirectoryNode::class, ['exists', 'isDirectory', 'isPermissionCorrect', 'getRelativePathBelowSiteRoot', 'isWritable'], @@ -328,7 +329,7 @@ class DirectoryNodeTest extends FolderStructureTestCase */ public function fixCallsFixSelfAndReturnsItsResult(): void { - /** @var $node DirectoryNode|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|MockObject */ $node = $this->getMockBuilder(DirectoryNode::class) ->disableOriginalConstructor() ->onlyMethods(['fixSelf']) @@ -343,7 +344,7 @@ class DirectoryNodeTest extends FolderStructureTestCase */ public function fixCallsFixOnChildrenAndReturnsMergedResult(): void { - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(DirectoryNode::class, ['fixSelf'], [], '', false); $uniqueReturnSelf = StringUtility::getUniqueId('foo_'); $node->expects(self::once())->method('fixSelf')->willReturn([$uniqueReturnSelf]); @@ -366,7 +367,7 @@ class DirectoryNodeTest extends FolderStructureTestCase */ public function fixSelfCallsCreateDirectoryIfDirectoryDoesNotExistAndReturnsResult(): void { - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( DirectoryNode::class, ['exists', 'createDirectory', 'isPermissionCorrect'], @@ -386,7 +387,7 @@ class DirectoryNodeTest extends FolderStructureTestCase */ public function fixSelfReturnsErrorStatusIfNodeExistsButIsNotADirectoryAndReturnsResult(): void { - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( DirectoryNode::class, ['exists', 'isWritable', 'getRelativePathBelowSiteRoot', 'isDirectory', 'getAbsolutePath'], @@ -408,7 +409,7 @@ class DirectoryNodeTest extends FolderStructureTestCase */ public function fixSelfCallsFixPermissionIfDirectoryExistsButIsNotWritable(): void { - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( DirectoryNode::class, ['exists', 'isWritable', 'fixPermission'], @@ -430,7 +431,7 @@ class DirectoryNodeTest extends FolderStructureTestCase { $this->expectException(Exception::class); $this->expectExceptionCode(1366740091); - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(DirectoryNode::class, ['exists', 'getAbsolutePath'], [], '', false); $node->expects(self::once())->method('getAbsolutePath')->willReturn(''); $node->expects(self::once())->method('exists')->willReturn(true); @@ -442,7 +443,7 @@ class DirectoryNodeTest extends FolderStructureTestCase */ public function createDirectoryCreatesDirectory(): void { - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(DirectoryNode::class, ['exists', 'getAbsolutePath', 'getRelativePathBelowSiteRoot'], [], '', false); $path = $this->getVirtualTestFilePath('dir_'); $node->expects(self::once())->method('exists')->willReturn(false); @@ -457,7 +458,7 @@ class DirectoryNodeTest extends FolderStructureTestCase */ public function createDirectoryReturnsOkStatusIfDirectoryWasCreated(): void { - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(DirectoryNode::class, ['exists', 'getAbsolutePath', 'getRelativePathBelowSiteRoot'], [], '', false); $path = $this->getVirtualTestFilePath('dir_'); $node->expects(self::once())->method('exists')->willReturn(false); @@ -471,7 +472,7 @@ class DirectoryNodeTest extends FolderStructureTestCase */ public function createDirectoryReturnsErrorStatusIfDirectoryWasNotCreated(): void { - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(DirectoryNode::class, ['exists', 'getAbsolutePath', 'getRelativePathBelowSiteRoot'], [], '', false); $path = $this->getVirtualTestDir('root_'); chmod($path, 02550); @@ -489,7 +490,7 @@ class DirectoryNodeTest extends FolderStructureTestCase { $this->expectException(InvalidArgumentException::class); $this->expectExceptionCode(1366222204); - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(DirectoryNode::class, ['dummy'], [], '', false); $brokenStructure = [ [ @@ -506,7 +507,7 @@ class DirectoryNodeTest extends FolderStructureTestCase { $this->expectException(InvalidArgumentException::class); $this->expectExceptionCode(1366222205); - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(DirectoryNode::class, ['dummy'], [], '', false); $brokenStructure = [ [ @@ -523,7 +524,7 @@ class DirectoryNodeTest extends FolderStructureTestCase { $this->expectException(InvalidArgumentException::class); $this->expectExceptionCode(1366222206); - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(DirectoryNode::class, ['dummy'], [], '', false); $brokenStructure = [ [ @@ -543,7 +544,7 @@ class DirectoryNodeTest extends FolderStructureTestCase */ public function getChildrenReturnsCreatedChild(): void { - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(DirectoryNode::class, ['dummy'], [], '', false); $parent = $this->createMock(NodeInterface::class); $childName = StringUtility::getUniqueId('test_'); @@ -570,7 +571,7 @@ class DirectoryNodeTest extends FolderStructureTestCase */ public function isWritableReturnsFalseIfNodeDoesNotExist(): void { - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(DirectoryNode::class, ['getAbsolutePath'], [], '', false); $path = $this->getVirtualTestFilePath('dir_'); $node->method('getAbsolutePath')->willReturn($path); @@ -582,7 +583,7 @@ class DirectoryNodeTest extends FolderStructureTestCase */ public function isWritableReturnsTrueIfNodeExistsAndFileCanBeCreated(): void { - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(DirectoryNode::class, ['getAbsolutePath'], [], '', false); $path = $this->getVirtualTestDir('root_'); $node->method('getAbsolutePath')->willReturn($path); @@ -597,7 +598,7 @@ class DirectoryNodeTest extends FolderStructureTestCase if (function_exists('posix_getegid') && posix_getegid() === 0) { self::markTestSkipped('Test skipped if run on linux as root'); } - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(DirectoryNode::class, ['getAbsolutePath'], [], '', false); $path = $this->getVirtualTestDir('root_'); chmod($path, 02550); @@ -610,7 +611,7 @@ class DirectoryNodeTest extends FolderStructureTestCase */ public function isDirectoryReturnsTrueIfNameIsADirectory(): void { - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(DirectoryNode::class, ['getAbsolutePath'], [], '', false); $path = $this->getVirtualTestDir('dir_'); $node->method('getAbsolutePath')->willReturn($path); @@ -623,7 +624,7 @@ class DirectoryNodeTest extends FolderStructureTestCase */ public function isDirectoryReturnsFalseIfNameIsALinkToADirectory(): void { - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(DirectoryNode::class, ['getAbsolutePath'], [], '', false); $path = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('root_'); GeneralUtility::mkdir_deep($path); diff --git a/typo3/sysext/install/Tests/Unit/FolderStructure/FileNodeTest.php b/typo3/sysext/install/Tests/Unit/FolderStructure/FileNodeTest.php index 72f8eb138641..3c815b10e2ca 100644 --- a/typo3/sysext/install/Tests/Unit/FolderStructure/FileNodeTest.php +++ b/typo3/sysext/install/Tests/Unit/FolderStructure/FileNodeTest.php @@ -17,6 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Install\Tests\Unit\FolderStructure; +use PHPUnit\Framework\MockObject\MockObject; use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Messaging\FlashMessage; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -37,11 +38,11 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function constructorThrowsExceptionIfParentIsNull() + public function constructorThrowsExceptionIfParentIsNull(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionCode(1366927513); - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['dummy'], [], '', false); $node->__construct([], null); } @@ -49,12 +50,12 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function constructorThrowsExceptionIfNameContainsForwardSlash() + public function constructorThrowsExceptionIfNameContainsForwardSlash(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionCode(1366222207); $parent = $this->createMock(NodeInterface::class); - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['dummy'], [], '', false); $structure = [ 'name' => 'foo/bar', @@ -65,10 +66,10 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function constructorSetsParent() + public function constructorSetsParent(): void { $parent = $this->createMock(NodeInterface::class); - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['dummy'], [], '', false); $structure = [ 'name' => 'foo', @@ -80,10 +81,10 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function constructorSetsTargetPermission() + public function constructorSetsTargetPermission(): void { $parent = $this->createMock(NodeInterface::class); - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['dummy'], [], '', false); $targetPermission = '0660'; $structure = [ @@ -97,9 +98,9 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function constructorSetsName() + public function constructorSetsName(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['dummy'], [], '', false); $parent = $this->createMock(RootNodeInterface::class); $name = StringUtility::getUniqueId('test_'); @@ -110,11 +111,11 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function constructorThrowsExceptionIfBothTargetContentAndTargetContentFileAreSet() + public function constructorThrowsExceptionIfBothTargetContentAndTargetContentFileAreSet(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionCode(1380364361); - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['dummy'], [], '', false); $parent = $this->createMock(RootNodeInterface::class); $structure = [ @@ -128,9 +129,9 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function constructorSetsTargetContent() + public function constructorSetsTargetContent(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['dummy'], [], '', false); $parent = $this->createMock(RootNodeInterface::class); $targetContent = StringUtility::getUniqueId('content_'); @@ -145,9 +146,9 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function constructorSetsTargetContentToContentOfTargetContentFile() + public function constructorSetsTargetContentToContentOfTargetContentFile(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['dummy'], [], '', false); $parent = $this->createMock(RootNodeInterface::class); $targetFile = $this->getVirtualTestFilePath('test_'); @@ -164,11 +165,11 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function constructorThrowsExceptionIfTargetContentFileDoesNotExist() + public function constructorThrowsExceptionIfTargetContentFileDoesNotExist(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionCode(1380364362); - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['dummy'], [], '', false); $parent = $this->createMock(RootNodeInterface::class); $targetFile = $this->getVirtualTestFilePath('test_'); @@ -182,9 +183,9 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function targetContentIsNullIfNotGiven() + public function targetContentIsNullIfNotGiven(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['dummy'], [], '', false); $parent = $this->createMock(RootNodeInterface::class); $structure = [ @@ -197,9 +198,9 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function getStatusReturnsArray() + public function getStatusReturnsArray(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( FileNode::class, ['getAbsolutePath', 'exists', 'isFile', 'isWritable', 'isPermissionCorrect', 'isContentCorrect'], @@ -209,21 +210,21 @@ class FileNodeTest extends FolderStructureTestCase ); // do not use var path here, as file nodes explicitly check for public path $path = Environment::getPublicPath() . '/typo3temp/tests/' . StringUtility::getUniqueId('dir_'); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); - $node->expects(self::any())->method('exists')->willReturn(true); - $node->expects(self::any())->method('isFile')->willReturn(true); - $node->expects(self::any())->method('isPermissionCorrect')->willReturn(true); - $node->expects(self::any())->method('isWritable')->willReturn(true); - $node->expects(self::any())->method('isContentCorrect')->willReturn(true); + $node->method('getAbsolutePath')->willReturn($path); + $node->method('exists')->willReturn(true); + $node->method('isFile')->willReturn(true); + $node->method('isPermissionCorrect')->willReturn(true); + $node->method('isWritable')->willReturn(true); + $node->method('isContentCorrect')->willReturn(true); self::assertIsArray($node->getStatus()); } /** * @test */ - public function getStatusReturnsArrayWithWarningStatusIFileNotExists() + public function getStatusReturnsArrayWithWarningStatusIFileNotExists(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( FileNode::class, ['getAbsolutePath', 'getRelativePathBelowSiteRoot', 'exists', 'isFile', 'isWritable', 'isPermissionCorrect', 'isContentCorrect'], @@ -232,13 +233,13 @@ class FileNodeTest extends FolderStructureTestCase false ); $path = $this->getVirtualTestDir('dir_'); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); - $node->expects(self::any())->method('getRelativePathBelowSiteRoot')->willReturn($path); - $node->expects(self::any())->method('exists')->willReturn(false); - $node->expects(self::any())->method('isFile')->willReturn(true); - $node->expects(self::any())->method('isPermissionCorrect')->willReturn(true); - $node->expects(self::any())->method('isWritable')->willReturn(true); - $node->expects(self::any())->method('isContentCorrect')->willReturn(true); + $node->method('getAbsolutePath')->willReturn($path); + $node->method('getRelativePathBelowSiteRoot')->willReturn($path); + $node->method('exists')->willReturn(false); + $node->method('isFile')->willReturn(true); + $node->method('isPermissionCorrect')->willReturn(true); + $node->method('isWritable')->willReturn(true); + $node->method('isContentCorrect')->willReturn(true); $statusArray = $node->getStatus(); self::assertSame(FlashMessage::WARNING, $statusArray[0]->getSeverity()); } @@ -246,9 +247,9 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function getStatusReturnsArrayWithErrorStatusIfNodeIsNotAFile() + public function getStatusReturnsArrayWithErrorStatusIfNodeIsNotAFile(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( FileNode::class, ['getAbsolutePath', 'getRelativePathBelowSiteRoot', 'exists', 'isFile', 'isWritable', 'isPermissionCorrect', 'isContentCorrect'], @@ -258,13 +259,13 @@ class FileNodeTest extends FolderStructureTestCase ); $path = $this->getVirtualTestFilePath('dir_'); touch($path); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); - $node->expects(self::any())->method('getRelativePathBelowSiteRoot')->willReturn($path); - $node->expects(self::any())->method('exists')->willReturn(true); - $node->expects(self::any())->method('isFile')->willReturn(false); - $node->expects(self::any())->method('isPermissionCorrect')->willReturn(true); - $node->expects(self::any())->method('isWritable')->willReturn(true); - $node->expects(self::any())->method('isContentCorrect')->willReturn(true); + $node->method('getAbsolutePath')->willReturn($path); + $node->method('getRelativePathBelowSiteRoot')->willReturn($path); + $node->method('exists')->willReturn(true); + $node->method('isFile')->willReturn(false); + $node->method('isPermissionCorrect')->willReturn(true); + $node->method('isWritable')->willReturn(true); + $node->method('isContentCorrect')->willReturn(true); $statusArray = $node->getStatus(); self::assertSame(FlashMessage::ERROR, $statusArray[0]->getSeverity()); } @@ -272,9 +273,9 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function getStatusReturnsArrayNoticeStatusIfFileExistsButIsNotWritable() + public function getStatusReturnsArrayNoticeStatusIfFileExistsButIsNotWritable(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( FileNode::class, ['getAbsolutePath', 'getRelativePathBelowSiteRoot', 'exists', 'isFile', 'isWritable', 'isPermissionCorrect', 'isContentCorrect'], @@ -284,13 +285,13 @@ class FileNodeTest extends FolderStructureTestCase ); $path = $this->getVirtualTestFilePath('dir_'); touch($path); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); - $node->expects(self::any())->method('getRelativePathBelowSiteRoot')->willReturn($path); - $node->expects(self::any())->method('exists')->willReturn(true); - $node->expects(self::any())->method('isFile')->willReturn(true); - $node->expects(self::any())->method('isPermissionCorrect')->willReturn(true); - $node->expects(self::any())->method('isWritable')->willReturn(false); - $node->expects(self::any())->method('isContentCorrect')->willReturn(true); + $node->method('getAbsolutePath')->willReturn($path); + $node->method('getRelativePathBelowSiteRoot')->willReturn($path); + $node->method('exists')->willReturn(true); + $node->method('isFile')->willReturn(true); + $node->method('isPermissionCorrect')->willReturn(true); + $node->method('isWritable')->willReturn(false); + $node->method('isContentCorrect')->willReturn(true); $statusArray = $node->getStatus(); self::assertSame(FlashMessage::NOTICE, $statusArray[0]->getSeverity()); } @@ -298,9 +299,9 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function getStatusReturnsArrayWithNoticeStatusIfFileExistsButPermissionAreNotCorrect() + public function getStatusReturnsArrayWithNoticeStatusIfFileExistsButPermissionAreNotCorrect(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( FileNode::class, ['getAbsolutePath', 'getRelativePathBelowSiteRoot', 'exists', 'isFile', 'isWritable', 'isPermissionCorrect', 'isContentCorrect'], @@ -310,13 +311,13 @@ class FileNodeTest extends FolderStructureTestCase ); $path = $this->getVirtualTestFilePath('dir_'); touch($path); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); - $node->expects(self::any())->method('getRelativePathBelowSiteRoot')->willReturn($path); - $node->expects(self::any())->method('exists')->willReturn(true); - $node->expects(self::any())->method('isFile')->willReturn(true); - $node->expects(self::any())->method('isPermissionCorrect')->willReturn(false); - $node->expects(self::any())->method('isWritable')->willReturn(true); - $node->expects(self::any())->method('isContentCorrect')->willReturn(true); + $node->method('getAbsolutePath')->willReturn($path); + $node->method('getRelativePathBelowSiteRoot')->willReturn($path); + $node->method('exists')->willReturn(true); + $node->method('isFile')->willReturn(true); + $node->method('isPermissionCorrect')->willReturn(false); + $node->method('isWritable')->willReturn(true); + $node->method('isContentCorrect')->willReturn(true); $statusArray = $node->getStatus(); self::assertSame(FlashMessage::NOTICE, $statusArray[0]->getSeverity()); } @@ -324,9 +325,9 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function getStatusReturnsArrayWithNoticeStatusIfFileExistsButContentIsNotCorrect() + public function getStatusReturnsArrayWithNoticeStatusIfFileExistsButContentIsNotCorrect(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( FileNode::class, ['getAbsolutePath', 'getRelativePathBelowSiteRoot', 'exists', 'isFile', 'isWritable', 'isPermissionCorrect', 'isContentCorrect'], @@ -336,13 +337,13 @@ class FileNodeTest extends FolderStructureTestCase ); $path = $this->getVirtualTestFilePath('dir_'); touch($path); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); - $node->expects(self::any())->method('getRelativePathBelowSiteRoot')->willReturn($path); - $node->expects(self::any())->method('exists')->willReturn(true); - $node->expects(self::any())->method('isFile')->willReturn(true); - $node->expects(self::any())->method('isPermissionCorrect')->willReturn(true); - $node->expects(self::any())->method('isWritable')->willReturn(true); - $node->expects(self::any())->method('isContentCorrect')->willReturn(false); + $node->method('getAbsolutePath')->willReturn($path); + $node->method('getRelativePathBelowSiteRoot')->willReturn($path); + $node->method('exists')->willReturn(true); + $node->method('isFile')->willReturn(true); + $node->method('isPermissionCorrect')->willReturn(true); + $node->method('isWritable')->willReturn(true); + $node->method('isContentCorrect')->willReturn(false); $statusArray = $node->getStatus(); self::assertSame(FlashMessage::NOTICE, $statusArray[0]->getSeverity()); } @@ -350,9 +351,9 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function getStatusReturnsArrayWithOkStatusIfFileExistsAndPermissionAreCorrect() + public function getStatusReturnsArrayWithOkStatusIfFileExistsAndPermissionAreCorrect(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( FileNode::class, ['getAbsolutePath', 'getRelativePathBelowSiteRoot', 'exists', 'isFile', 'isWritable', 'isPermissionCorrect', 'isContentCorrect'], @@ -362,13 +363,13 @@ class FileNodeTest extends FolderStructureTestCase ); $path = $this->getVirtualTestFilePath('dir_'); touch($path); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); - $node->expects(self::any())->method('getRelativePathBelowSiteRoot')->willReturn($path); - $node->expects(self::any())->method('exists')->willReturn(true); - $node->expects(self::any())->method('isFile')->willReturn(true); - $node->expects(self::any())->method('isPermissionCorrect')->willReturn(true); - $node->expects(self::any())->method('isWritable')->willReturn(true); - $node->expects(self::any())->method('isContentCorrect')->willReturn(true); + $node->method('getAbsolutePath')->willReturn($path); + $node->method('getRelativePathBelowSiteRoot')->willReturn($path); + $node->method('exists')->willReturn(true); + $node->method('isFile')->willReturn(true); + $node->method('isPermissionCorrect')->willReturn(true); + $node->method('isWritable')->willReturn(true); + $node->method('isContentCorrect')->willReturn(true); $statusArray = $node->getStatus(); self::assertSame(FlashMessage::OK, $statusArray[0]->getSeverity()); } @@ -376,9 +377,9 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function fixCallsFixSelfAndReturnsItsResult() + public function fixCallsFixSelfAndReturnsItsResult(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( FileNode::class, ['fixSelf'], @@ -394,9 +395,9 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function fixSelfCallsCreateFileIfFileDoesNotExistAndReturnsResult() + public function fixSelfCallsCreateFileIfFileDoesNotExistAndReturnsResult(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( FileNode::class, ['exists', 'createFile', 'setContent', 'getAbsolutePath', 'isFile', 'isPermissionCorrect'], @@ -404,9 +405,9 @@ class FileNodeTest extends FolderStructureTestCase '', false ); - $node->expects(self::any())->method('exists')->willReturn(false); - $node->expects(self::any())->method('isFile')->willReturn(true); - $node->expects(self::any())->method('isPermissionCorrect')->willReturn(true); + $node->method('exists')->willReturn(false); + $node->method('isFile')->willReturn(true); + $node->method('isPermissionCorrect')->willReturn(true); $message = new FlashMessage('foo'); $node->expects(self::once())->method('createFile')->willReturn($message); $actualReturn = $node->_call('fixSelf'); @@ -417,9 +418,9 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function fixSelfCallsSetsContentIfFileCreationWasSuccessfulAndTargetContentIsNotNullAndReturnsResult() + public function fixSelfCallsSetsContentIfFileCreationWasSuccessfulAndTargetContentIsNotNullAndReturnsResult(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( FileNode::class, ['exists', 'createFile', 'setContent', 'getAbsolutePath', 'isFile', 'isPermissionCorrect'], @@ -427,11 +428,11 @@ class FileNodeTest extends FolderStructureTestCase '', false ); - $node->expects(self::any())->method('exists')->willReturn(false); - $node->expects(self::any())->method('isFile')->willReturn(true); - $node->expects(self::any())->method('isPermissionCorrect')->willReturn(true); + $node->method('exists')->willReturn(false); + $node->method('isFile')->willReturn(true); + $node->method('isPermissionCorrect')->willReturn(true); $message1 = new FlashMessage('foo'); - $node->expects(self::any())->method('createFile')->willReturn($message1); + $node->method('createFile')->willReturn($message1); $node->_set('targetContent', 'foo'); $message2 = new FlashMessage('foo'); $node->expects(self::once())->method('setContent')->willReturn($message2); @@ -443,9 +444,9 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function fixSelfDoesNotCallSetContentIfFileCreationFailed() + public function fixSelfDoesNotCallSetContentIfFileCreationFailed(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( FileNode::class, ['exists', 'createFile', 'setContent', 'getAbsolutePath', 'isFile', 'isPermissionCorrect'], @@ -453,11 +454,11 @@ class FileNodeTest extends FolderStructureTestCase '', false ); - $node->expects(self::any())->method('exists')->willReturn(false); - $node->expects(self::any())->method('isFile')->willReturn(true); - $node->expects(self::any())->method('isPermissionCorrect')->willReturn(true); + $node->method('exists')->willReturn(false); + $node->method('isFile')->willReturn(true); + $node->method('isPermissionCorrect')->willReturn(true); $message = new FlashMessage('foo', '', FlashMessage::ERROR); - $node->expects(self::any())->method('createFile')->willReturn($message); + $node->method('createFile')->willReturn($message); $node->_set('targetContent', 'foo'); $node->expects(self::never())->method('setContent'); $node->_call('fixSelf'); @@ -466,9 +467,9 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function fixSelfDoesNotCallSetContentIfFileTargetContentIsNull() + public function fixSelfDoesNotCallSetContentIfFileTargetContentIsNull(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( FileNode::class, ['exists', 'createFile', 'setContent', 'getAbsolutePath', 'isFile', 'isPermissionCorrect'], @@ -476,11 +477,11 @@ class FileNodeTest extends FolderStructureTestCase '', false ); - $node->expects(self::any())->method('exists')->willReturn(false); - $node->expects(self::any())->method('isFile')->willReturn(true); - $node->expects(self::any())->method('isPermissionCorrect')->willReturn(true); + $node->method('exists')->willReturn(false); + $node->method('isFile')->willReturn(true); + $node->method('isPermissionCorrect')->willReturn(true); $message = new FlashMessage('foo'); - $node->expects(self::any())->method('createFile')->willReturn($message); + $node->method('createFile')->willReturn($message); $node->_set('targetContent', null); $node->expects(self::never())->method('setContent'); $node->_call('fixSelf'); @@ -489,9 +490,9 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function fixSelfReturnsErrorStatusIfNodeExistsButIsNotAFileAndReturnsResult() + public function fixSelfReturnsErrorStatusIfNodeExistsButIsNotAFileAndReturnsResult(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( FileNode::class, ['exists', 'createFile', 'getAbsolutePath', 'isFile', 'isPermissionCorrect', 'fixPermission'], @@ -499,9 +500,9 @@ class FileNodeTest extends FolderStructureTestCase '', false ); - $node->expects(self::any())->method('exists')->willReturn(true); - $node->expects(self::any())->method('isFile')->willReturn(true); - $node->expects(self::any())->method('isPermissionCorrect')->willReturn(false); + $node->method('exists')->willReturn(true); + $node->method('isFile')->willReturn(true); + $node->method('isPermissionCorrect')->willReturn(false); $message = new FlashMessage('foo'); $node->expects(self::once())->method('fixPermission')->willReturn($message); self::assertSame([$message], $node->_call('fixSelf')); @@ -510,9 +511,9 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function fixSelfCallsFixPermissionIfFileExistsButPermissionAreWrong() + public function fixSelfCallsFixPermissionIfFileExistsButPermissionAreWrong(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( FileNode::class, ['exists', 'createFile', 'getAbsolutePath', 'isFile', 'isPermissionCorrect', 'getRelativePathBelowSiteRoot'], @@ -520,16 +521,16 @@ class FileNodeTest extends FolderStructureTestCase '', false ); - $node->expects(self::any())->method('exists')->willReturn(true); + $node->method('exists')->willReturn(true); $node->expects(self::once())->method('isFile')->willReturn(false); - $node->expects(self::any())->method('isPermissionCorrect')->willReturn(true); + $node->method('isPermissionCorrect')->willReturn(true); $node->_call('fixSelf'); } /** * @test */ - public function fixSelfReturnsArrayOfStatusMessages() + public function fixSelfReturnsArrayOfStatusMessages(): void { $node = $this->getAccessibleMock( FileNode::class, @@ -538,20 +539,20 @@ class FileNodeTest extends FolderStructureTestCase '', false ); - $node->expects(self::any())->method('exists')->willReturn(true); - $node->expects(self::any())->method('isFile')->willReturn(true); - $node->expects(self::any())->method('isPermissionCorrect')->willReturn(true); + $node->method('exists')->willReturn(true); + $node->method('isFile')->willReturn(true); + $node->method('isPermissionCorrect')->willReturn(true); self::assertIsArray($node->_call('fixSelf')); } /** * @test */ - public function createFileThrowsExceptionIfNodeExists() + public function createFileThrowsExceptionIfNodeExists(): void { $this->expectException(Exception::class); $this->expectExceptionCode(1366398198); - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['exists', 'getAbsolutePath'], [], '', false); $node->expects(self::once())->method('getAbsolutePath')->willReturn(''); $node->expects(self::once())->method('exists')->willReturn(true); @@ -561,28 +562,28 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function createFileReturnsOkStatusIfFileWasCreated() + public function createFileReturnsOkStatusIfFileWasCreated(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['exists', 'getAbsolutePath', 'getRelativePathBelowSiteRoot'], [], '', false); $path = $this->getVirtualTestFilePath('file_'); $node->expects(self::once())->method('exists')->willReturn(false); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); - $node->expects(self::any())->method('getRelativePathBelowSiteRoot')->willReturn($path); + $node->method('getAbsolutePath')->willReturn($path); + $node->method('getRelativePathBelowSiteRoot')->willReturn($path); self::assertSame(FlashMessage::OK, $node->_call('createFile')->getSeverity()); } /** * @test */ - public function createFileCreatesFile() + public function createFileCreatesFile(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['exists', 'getAbsolutePath', 'getRelativePathBelowSiteRoot'], [], '', false); $path = $this->getVirtualTestFilePath('file_'); $node->expects(self::once())->method('exists')->willReturn(false); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); - $node->expects(self::any())->method('getRelativePathBelowSiteRoot')->willReturn($path); + $node->method('getAbsolutePath')->willReturn($path); + $node->method('getRelativePathBelowSiteRoot')->willReturn($path); $node->_call('createFile'); self::assertTrue(is_file($path)); } @@ -590,43 +591,43 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function createFileReturnsErrorStatusIfFileWasNotCreated() + public function createFileReturnsErrorStatusIfFileWasNotCreated(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['exists', 'getAbsolutePath', 'getRelativePathBelowSiteRoot'], [], '', false); $path = $this->getVirtualTestDir(); chmod($path, 02550); $subPath = $path . '/' . StringUtility::getUniqueId('file_'); $node->expects(self::once())->method('exists')->willReturn(false); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($subPath); - $node->expects(self::any())->method('getRelativePathBelowSiteRoot')->willReturn($subPath); + $node->method('getAbsolutePath')->willReturn($subPath); + $node->method('getRelativePathBelowSiteRoot')->willReturn($subPath); self::assertSame(FlashMessage::ERROR, $node->_call('createFile')->getSeverity()); } /** * @test */ - public function isContentCorrectThrowsExceptionIfTargetIsNotAFile() + public function isContentCorrectThrowsExceptionIfTargetIsNotAFile(): void { $this->expectException(Exception::class); $this->expectExceptionCode(1367056363); - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['getAbsolutePath'], [], '', false); $path = $this->getVirtualTestDir('dir_'); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); + $node->method('getAbsolutePath')->willReturn($path); $node->_call('isContentCorrect'); } /** * @test */ - public function isContentCorrectReturnsTrueIfTargetContentPropertyIsNull() + public function isContentCorrectReturnsTrueIfTargetContentPropertyIsNull(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['getAbsolutePath'], [], '', false); $path = $this->getVirtualTestFilePath('file_'); touch($path); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); + $node->method('getAbsolutePath')->willReturn($path); $node->_set('targetContent', null); self::assertTrue($node->_call('isContentCorrect')); } @@ -634,14 +635,14 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function isContentCorrectReturnsTrueIfTargetContentEqualsCurrentContent() + public function isContentCorrectReturnsTrueIfTargetContentEqualsCurrentContent(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['getAbsolutePath'], [], '', false); $path = $this->getVirtualTestFilePath('file_'); $content = StringUtility::getUniqueId('content_'); file_put_contents($path, $content); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); + $node->method('getAbsolutePath')->willReturn($path); $node->_set('targetContent', $content); self::assertTrue($node->_call('isContentCorrect')); } @@ -649,15 +650,15 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function isContentCorrectReturnsFalseIfTargetContentNotEqualsCurrentContent() + public function isContentCorrectReturnsFalseIfTargetContentNotEqualsCurrentContent(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['getAbsolutePath'], [], '', false); $path = $this->getVirtualTestFilePath('file_'); $content = StringUtility::getUniqueId('content1_'); $targetContent = StringUtility::getUniqueId('content2_'); file_put_contents($path, $content); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); + $node->method('getAbsolutePath')->willReturn($path); $node->_set('targetContent', $targetContent); self::assertFalse($node->_call('isContentCorrect')); } @@ -665,13 +666,13 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function isPermissionCorrectReturnsTrueIfTargetPermissionAndCurrentPermissionAreIdentical() + public function isPermissionCorrectReturnsTrueIfTargetPermissionAndCurrentPermissionAreIdentical(): void { $parent = $this->createMock(NodeInterface::class); - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['getCurrentPermission', 'isWindowsOs'], [], '', false); - $node->expects(self::any())->method('isWindowsOs')->willReturn(false); - $node->expects(self::any())->method('getCurrentPermission')->willReturn('0664'); + $node->method('isWindowsOs')->willReturn(false); + $node->method('getCurrentPermission')->willReturn('0664'); $targetPermission = '0664'; $structure = [ 'name' => 'foo', @@ -684,14 +685,14 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function setContentThrowsExceptionIfTargetIsNotAFile() + public function setContentThrowsExceptionIfTargetIsNotAFile(): void { $this->expectException(Exception::class); $this->expectExceptionCode(1367060201); - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['getAbsolutePath'], [], '', false); $path = $this->getVirtualTestDir('dir_'); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); + $node->method('getAbsolutePath')->willReturn($path); $node->_set('targetContent', 'foo'); $node->_call('setContent'); } @@ -699,15 +700,15 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function setContentThrowsExceptionIfTargetContentIsNull() + public function setContentThrowsExceptionIfTargetContentIsNull(): void { $this->expectException(Exception::class); $this->expectExceptionCode(1367060202); - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['getAbsolutePath'], [], '', false); $path = $this->getVirtualTestFilePath('file_'); touch($path); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); + $node->method('getAbsolutePath')->willReturn($path); $node->_set('targetContent', null); $node->_call('setContent'); } @@ -715,13 +716,13 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function setContentSetsContentToFile() + public function setContentSetsContentToFile(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['getAbsolutePath', 'getRelativePathBelowSiteRoot'], [], '', false); $path = $this->getVirtualTestFilePath('file_'); touch($path); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); + $node->method('getAbsolutePath')->willReturn($path); $targetContent = StringUtility::getUniqueId('content_'); $node->_set('targetContent', $targetContent); $node->_call('setContent'); @@ -732,13 +733,13 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function setContentReturnsOkStatusIfContentWasSuccessfullySet() + public function setContentReturnsOkStatusIfContentWasSuccessfullySet(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['getAbsolutePath', 'getRelativePathBelowSiteRoot'], [], '', false); $path = $this->getVirtualTestFilePath('file_'); touch($path); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); + $node->method('getAbsolutePath')->willReturn($path); $targetContent = StringUtility::getUniqueId('content_'); $node->_set('targetContent', $targetContent); self::assertSame(FlashMessage::OK, $node->_call('setContent')->getSeverity()); @@ -747,18 +748,18 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function setContentReturnsErrorStatusIfContentCanNotBeSetSet() + public function setContentReturnsErrorStatusIfContentCanNotBeSetSet(): void { if (function_exists('posix_getegid') && posix_getegid() === 0) { self::markTestSkipped('Test skipped if run on linux as root'); } - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['getAbsolutePath', 'getRelativePathBelowSiteRoot'], [], '', false); $dir = $this->getVirtualTestDir('dir_'); $file = $dir . '/' . StringUtility::getUniqueId('file_'); touch($file); chmod($file, 0440); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($file); + $node->method('getAbsolutePath')->willReturn($file); $targetContent = StringUtility::getUniqueId('content_'); $node->_set('targetContent', $targetContent); self::assertSame(FlashMessage::ERROR, $node->_call('setContent')->getSeverity()); @@ -767,13 +768,13 @@ class FileNodeTest extends FolderStructureTestCase /** * @test */ - public function isFileReturnsTrueIfNameIsFile() + public function isFileReturnsTrueIfNameIsFile(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['getAbsolutePath', 'getRelativePathBelowSiteRoot'], [], '', false); $path = $this->getVirtualTestFilePath('file_'); touch($path); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); + $node->method('getAbsolutePath')->willReturn($path); self::assertTrue($node->_call('isFile')); } @@ -781,9 +782,9 @@ class FileNodeTest extends FolderStructureTestCase * @test * @see https://github.com/mikey179/vfsStream/wiki/Known-Issues - symlink doesn't work with vfsStream */ - public function isFileReturnsFalseIfNameIsALinkFile() + public function isFileReturnsFalseIfNameIsALinkFile(): void { - /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node FileNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(FileNode::class, ['getAbsolutePath'], [], '', false); $path = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('root_'); GeneralUtility::mkdir_deep($path); @@ -792,7 +793,7 @@ class FileNodeTest extends FolderStructureTestCase $file = StringUtility::getUniqueId('file_'); touch($path . '/' . $file); symlink($path . '/' . $file, $path . '/' . $link); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path . '/' . $link); + $node->method('getAbsolutePath')->willReturn($path . '/' . $link); self::assertFalse($node->_call('isFile')); } } diff --git a/typo3/sysext/install/Tests/Unit/FolderStructure/LinkNodeTest.php b/typo3/sysext/install/Tests/Unit/FolderStructure/LinkNodeTest.php index 6e660bf6566b..6fd0bca4ee18 100644 --- a/typo3/sysext/install/Tests/Unit/FolderStructure/LinkNodeTest.php +++ b/typo3/sysext/install/Tests/Unit/FolderStructure/LinkNodeTest.php @@ -17,6 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Install\Tests\Unit\FolderStructure; +use PHPUnit\Framework\MockObject\MockObject; use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Messaging\FlashMessage; use TYPO3\CMS\Core\Utility\StringUtility; @@ -35,11 +36,11 @@ class LinkNodeTest extends UnitTestCase /** * @test */ - public function constructorThrowsExceptionIfParentIsNull() + public function constructorThrowsExceptionIfParentIsNull(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionCode(1380485700); - /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node LinkNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(LinkNode::class, ['dummy'], [], '', false); $node->__construct([], null); } @@ -47,12 +48,12 @@ class LinkNodeTest extends UnitTestCase /** * @test */ - public function constructorThrowsExceptionIfNameContainsForwardSlash() + public function constructorThrowsExceptionIfNameContainsForwardSlash(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionCode(1380546061); $parent = $this->createMock(NodeInterface::class); - /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node LinkNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(LinkNode::class, ['dummy'], [], '', false); $structure = [ 'name' => 'foo/bar', @@ -63,10 +64,10 @@ class LinkNodeTest extends UnitTestCase /** * @test */ - public function constructorSetsParent() + public function constructorSetsParent(): void { $parent = $this->createMock(NodeInterface::class); - /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node LinkNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(LinkNode::class, ['dummy'], [], '', false); $structure = [ 'name' => 'foo', @@ -78,9 +79,9 @@ class LinkNodeTest extends UnitTestCase /** * @test */ - public function constructorSetsName() + public function constructorSetsName(): void { - /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node LinkNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(LinkNode::class, ['dummy'], [], '', false); $parent = $this->createMock(RootNodeInterface::class); $name = StringUtility::getUniqueId('test_'); @@ -91,9 +92,9 @@ class LinkNodeTest extends UnitTestCase /** * @test */ - public function constructorSetsNameAndTarget() + public function constructorSetsNameAndTarget(): void { - /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node LinkNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(LinkNode::class, ['dummy'], [], '', false); $parent = $this->createMock(RootNodeInterface::class); $name = StringUtility::getUniqueId('test_'); @@ -105,9 +106,9 @@ class LinkNodeTest extends UnitTestCase /** * @test */ - public function getStatusReturnsArray() + public function getStatusReturnsArray(): void { - /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node LinkNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( LinkNode::class, ['isWindowsOs', 'getAbsolutePath', 'exists'], @@ -117,16 +118,16 @@ class LinkNodeTest extends UnitTestCase ); // do not use var path here, as link nodes get checked for public path as first part $path = Environment::getPublicPath() . '/typo3temp/tests/' . StringUtility::getUniqueId('dir_'); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); + $node->method('getAbsolutePath')->willReturn($path); self::assertIsArray($node->getStatus()); } /** * @test */ - public function getStatusReturnsArrayWithInformationStatusIfRunningOnWindows() + public function getStatusReturnsArrayWithInformationStatusIfRunningOnWindows(): void { - /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node LinkNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( LinkNode::class, ['isWindowsOs', 'getAbsolutePath', 'exists'], @@ -136,7 +137,7 @@ class LinkNodeTest extends UnitTestCase ); // do not use var path here, as link nodes get checked for public path as first part $path = Environment::getPublicPath() . '/tests/' . StringUtility::getUniqueId('dir_'); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); + $node->method('getAbsolutePath')->willReturn($path); $node->expects(self::once())->method('isWindowsOs')->willReturn(true); $statusArray = $node->getStatus(); self::assertSame(FlashMessage::INFO, $statusArray[0]->getSeverity()); @@ -145,9 +146,9 @@ class LinkNodeTest extends UnitTestCase /** * @test */ - public function getStatusReturnsArrayWithErrorStatusIfLinkNotExists() + public function getStatusReturnsArrayWithErrorStatusIfLinkNotExists(): void { - /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node LinkNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( LinkNode::class, ['isWindowsOs', 'getAbsolutePath', 'exists'], @@ -157,8 +158,8 @@ class LinkNodeTest extends UnitTestCase ); // do not use var path here, as link nodes get checked for public path as first part $path = Environment::getPublicPath() . '/tests/' . StringUtility::getUniqueId('dir_'); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); - $node->expects(self::any())->method('isWindowsOs')->willReturn(false); + $node->method('getAbsolutePath')->willReturn($path); + $node->method('isWindowsOs')->willReturn(false); $node->expects(self::once())->method('exists')->willReturn(false); $statusArray = $node->getStatus(); self::assertSame(FlashMessage::ERROR, $statusArray[0]->getSeverity()); @@ -167,9 +168,9 @@ class LinkNodeTest extends UnitTestCase /** * @test */ - public function getStatusReturnsArrayWithWarningStatusIfNodeIsNotALink() + public function getStatusReturnsArrayWithWarningStatusIfNodeIsNotALink(): void { - /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node LinkNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( LinkNode::class, ['isWindowsOs', 'getAbsolutePath', 'exists', 'isLink', 'getRelativePathBelowSiteRoot'], @@ -177,8 +178,8 @@ class LinkNodeTest extends UnitTestCase '', false ); - $node->expects(self::any())->method('getAbsolutePath')->willReturn(''); - $node->expects(self::any())->method('exists')->willReturn(true); + $node->method('getAbsolutePath')->willReturn(''); + $node->method('exists')->willReturn(true); $node->expects(self::once())->method('isLink')->willReturn(false); $statusArray = $node->getStatus(); self::assertSame(FlashMessage::WARNING, $statusArray[0]->getSeverity()); @@ -187,9 +188,9 @@ class LinkNodeTest extends UnitTestCase /** * @test */ - public function getStatusReturnsErrorStatusIfLinkTargetIsNotCorrect() + public function getStatusReturnsErrorStatusIfLinkTargetIsNotCorrect(): void { - /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node LinkNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( LinkNode::class, ['isWindowsOs', 'getAbsolutePath', 'exists', 'isLink', 'isTargetCorrect', 'getCurrentTarget', 'getRelativePathBelowSiteRoot'], @@ -197,10 +198,10 @@ class LinkNodeTest extends UnitTestCase '', false ); - $node->expects(self::any())->method('getAbsolutePath')->willReturn(''); - $node->expects(self::any())->method('getCurrentTarget')->willReturn(''); - $node->expects(self::any())->method('exists')->willReturn(true); - $node->expects(self::any())->method('isLink')->willReturn(true); + $node->method('getAbsolutePath')->willReturn(''); + $node->method('getCurrentTarget')->willReturn(''); + $node->method('exists')->willReturn(true); + $node->method('isLink')->willReturn(true); $node->expects(self::once())->method('isLink')->willReturn(false); $statusArray = $node->getStatus(); self::assertSame(FlashMessage::ERROR, $statusArray[0]->getSeverity()); @@ -209,9 +210,9 @@ class LinkNodeTest extends UnitTestCase /** * @test */ - public function getStatusReturnsOkStatusIfLinkExistsAndTargetIsCorrect() + public function getStatusReturnsOkStatusIfLinkExistsAndTargetIsCorrect(): void { - /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node LinkNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( LinkNode::class, ['isWindowsOs', 'getAbsolutePath', 'exists', 'isLink', 'isTargetCorrect', 'getRelativePathBelowSiteRoot'], @@ -219,8 +220,8 @@ class LinkNodeTest extends UnitTestCase '', false ); - $node->expects(self::any())->method('getAbsolutePath')->willReturn(''); - $node->expects(self::any())->method('exists')->willReturn(true); + $node->method('getAbsolutePath')->willReturn(''); + $node->method('exists')->willReturn(true); $node->expects(self::once())->method('isLink')->willReturn(true); $node->expects(self::once())->method('isTargetCorrect')->willReturn(true); $node->expects(self::once())->method('getRelativePathBelowSiteRoot')->willReturn(''); @@ -231,9 +232,9 @@ class LinkNodeTest extends UnitTestCase /** * @test */ - public function fixReturnsEmptyArray() + public function fixReturnsEmptyArray(): void { - /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node LinkNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( LinkNode::class, ['getRelativePathBelowSiteRoot'], @@ -248,11 +249,11 @@ class LinkNodeTest extends UnitTestCase /** * @test */ - public function isLinkThrowsExceptionIfLinkNotExists() + public function isLinkThrowsExceptionIfLinkNotExists(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionCode(1380556246); - /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node LinkNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(LinkNode::class, ['exists'], [], '', false); $node->expects(self::once())->method('exists')->willReturn(false); self::assertFalse($node->_call('isLink')); @@ -261,9 +262,9 @@ class LinkNodeTest extends UnitTestCase /** * @test */ - public function isLinkReturnsTrueIfNameIsLink() + public function isLinkReturnsTrueIfNameIsLink(): void { - /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node LinkNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(LinkNode::class, ['exists', 'getAbsolutePath'], [], '', false); $path = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('link_'); $target = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('linkTarget_'); @@ -271,34 +272,34 @@ class LinkNodeTest extends UnitTestCase symlink($target, $path); $this->testFilesToDelete[] = $path; $this->testFilesToDelete[] = $target; - $node->expects(self::any())->method('exists')->willReturn(true); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); + $node->method('exists')->willReturn(true); + $node->method('getAbsolutePath')->willReturn($path); self::assertTrue($node->_call('isLink')); } /** * @test */ - public function isFileReturnsFalseIfNameIsAFile() + public function isFileReturnsFalseIfNameIsAFile(): void { - /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node LinkNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(LinkNode::class, ['exists', 'getAbsolutePath'], [], '', false); $path = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('file_'); touch($path); $this->testFilesToDelete[] = $path; - $node->expects(self::any())->method('exists')->willReturn(true); - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); + $node->method('exists')->willReturn(true); + $node->method('getAbsolutePath')->willReturn($path); self::assertFalse($node->_call('isLink')); } /** * @test */ - public function isTargetCorrectThrowsExceptionIfLinkNotExists() + public function isTargetCorrectThrowsExceptionIfLinkNotExists(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionCode(1380556245); - /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node LinkNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(LinkNode::class, ['exists'], [], '', false); $node->expects(self::once())->method('exists')->willReturn(false); self::assertFalse($node->_call('isTargetCorrect')); @@ -307,13 +308,13 @@ class LinkNodeTest extends UnitTestCase /** * @test */ - public function isTargetCorrectThrowsExceptionIfNodeIsNotALink() + public function isTargetCorrectThrowsExceptionIfNodeIsNotALink(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionCode(1380556247); - /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node LinkNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(LinkNode::class, ['exists', 'isLink', 'getTarget'], [], '', false); - $node->expects(self::any())->method('exists')->willReturn(true); + $node->method('exists')->willReturn(true); $node->expects(self::once())->method('isLink')->willReturn(false); self::assertTrue($node->_call('isTargetCorrect')); } @@ -321,12 +322,12 @@ class LinkNodeTest extends UnitTestCase /** * @test */ - public function isTargetCorrectReturnsTrueIfNoExpectedLinkTargetIsSpecified() + public function isTargetCorrectReturnsTrueIfNoExpectedLinkTargetIsSpecified(): void { - /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node LinkNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(LinkNode::class, ['exists', 'isLink', 'getTarget'], [], '', false); - $node->expects(self::any())->method('exists')->willReturn(true); - $node->expects(self::any())->method('isLink')->willReturn(true); + $node->method('exists')->willReturn(true); + $node->method('isLink')->willReturn(true); $node->expects(self::once())->method('getTarget')->willReturn(''); self::assertTrue($node->_call('isTargetCorrect')); } @@ -334,12 +335,12 @@ class LinkNodeTest extends UnitTestCase /** * @test */ - public function isTargetCorrectAcceptsATargetWithATrailingSlash() + public function isTargetCorrectAcceptsATargetWithATrailingSlash(): void { - /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node LinkNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(LinkNode::class, ['exists', 'isLink', 'getCurrentTarget', 'getTarget'], [], '', false); - $node->expects(self::any())->method('exists')->willReturn(true); - $node->expects(self::any())->method('isLink')->willReturn(true); + $node->method('exists')->willReturn(true); + $node->method('isLink')->willReturn(true); $node->expects(self::once())->method('getCurrentTarget')->willReturn('someLinkTarget/'); $node->expects(self::once())->method('getTarget')->willReturn('someLinkTarget'); self::assertTrue($node->_call('isTargetCorrect')); @@ -349,7 +350,7 @@ class LinkNodeTest extends UnitTestCase * @test * @see https://github.com/mikey179/vfsStream/wiki/Known-Issues - symlink doesn't work with vfsStream */ - public function isTargetCorrectReturnsTrueIfActualTargetIsIdenticalToSpecifiedTarget() + public function isTargetCorrectReturnsTrueIfActualTargetIsIdenticalToSpecifiedTarget(): void { $path = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('link_'); $target = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('linkTarget_'); @@ -357,7 +358,7 @@ class LinkNodeTest extends UnitTestCase symlink($target, $path); $this->testFilesToDelete[] = $path; $this->testFilesToDelete[] = $target; - /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node LinkNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( LinkNode::class, ['exists', 'isLink', 'getTarget', 'getAbsolutePath'], @@ -365,8 +366,8 @@ class LinkNodeTest extends UnitTestCase '', false ); - $node->expects(self::any())->method('exists')->willReturn(true); - $node->expects(self::any())->method('isLink')->willReturn(true); + $node->method('exists')->willReturn(true); + $node->method('isLink')->willReturn(true); $node->expects(self::once())->method('getTarget')->willReturn(str_replace('/', DIRECTORY_SEPARATOR, $target)); $node->expects(self::once())->method('getAbsolutePath')->willReturn($path); self::assertTrue($node->_call('isTargetCorrect')); @@ -376,7 +377,7 @@ class LinkNodeTest extends UnitTestCase * @test * @see https://github.com/mikey179/vfsStream/wiki/Known-Issues - symlink doesn't work with vfsStream */ - public function isTargetCorrectReturnsFalseIfActualTargetIsNotIdenticalToSpecifiedTarget() + public function isTargetCorrectReturnsFalseIfActualTargetIsNotIdenticalToSpecifiedTarget(): void { $path = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('link_'); $target = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('linkTarget_'); @@ -384,7 +385,7 @@ class LinkNodeTest extends UnitTestCase symlink($target, $path); $this->testFilesToDelete[] = $path; $this->testFilesToDelete[] = $target; - /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node LinkNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( LinkNode::class, ['exists', 'isLink', 'getTarget', 'getAbsolutePath'], @@ -392,8 +393,8 @@ class LinkNodeTest extends UnitTestCase '', false ); - $node->expects(self::any())->method('exists')->willReturn(true); - $node->expects(self::any())->method('isLink')->willReturn(true); + $node->method('exists')->willReturn(true); + $node->method('isLink')->willReturn(true); $node->expects(self::once())->method('getTarget')->willReturn('foo'); $node->expects(self::once())->method('getAbsolutePath')->willReturn($path); self::assertFalse($node->_call('isTargetCorrect')); diff --git a/typo3/sysext/install/Tests/Unit/FolderStructure/RootNodeTest.php b/typo3/sysext/install/Tests/Unit/FolderStructure/RootNodeTest.php index 2c2b18550654..19b6ea001f80 100644 --- a/typo3/sysext/install/Tests/Unit/FolderStructure/RootNodeTest.php +++ b/typo3/sysext/install/Tests/Unit/FolderStructure/RootNodeTest.php @@ -17,6 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Install\Tests\Unit\FolderStructure; +use PHPUnit\Framework\MockObject\MockObject; use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Messaging\FlashMessage; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -24,6 +25,7 @@ use TYPO3\CMS\Core\Utility\StringUtility; use TYPO3\CMS\Install\FolderStructure\DirectoryNode; use TYPO3\CMS\Install\FolderStructure\Exception\InvalidArgumentException; use TYPO3\CMS\Install\FolderStructure\Exception\RootNodeException; +use TYPO3\CMS\install\FolderStructure\NodeInterface; use TYPO3\CMS\Install\FolderStructure\RootNode; use TYPO3\CMS\Install\FolderStructure\RootNodeInterface; use TYPO3\TestingFramework\Core\AccessibleObjectInterface; @@ -37,11 +39,11 @@ class RootNodeTest extends UnitTestCase /** * @test */ - public function constructorThrowsExceptionIfParentIsNotNull() + public function constructorThrowsExceptionIfParentIsNotNull(): void { $this->expectException(RootNodeException::class); $this->expectExceptionCode(1366140117); - /** @var $node RootNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node RootNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(RootNode::class, ['isWindowsOs'], [], '', false); $falseParent = $this->createMock(RootNodeInterface::class); $node->__construct([], $falseParent); @@ -50,11 +52,11 @@ class RootNodeTest extends UnitTestCase /** * @test */ - public function constructorThrowsExceptionIfAbsolutePathIsNotSet() + public function constructorThrowsExceptionIfAbsolutePathIsNotSet(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionCode(1366141329); - /** @var $node RootNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node RootNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(RootNode::class, ['isWindowsOs'], [], '', false); $structure = [ 'type' => 'root', @@ -65,14 +67,13 @@ class RootNodeTest extends UnitTestCase /** * @test */ - public function constructorThrowsExceptionIfAbsolutePathIsNotAbsoluteOnWindows() + public function constructorThrowsExceptionIfAbsolutePathIsNotAbsoluteOnWindows(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionCode(1366141329); - /** @var $node RootNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node RootNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(RootNode::class, ['isWindowsOs'], [], '', false); $node - ->expects(self::any()) ->method('isWindowsOs') ->willReturn(true); $structure = [ @@ -84,14 +85,13 @@ class RootNodeTest extends UnitTestCase /** * @test */ - public function constructorThrowsExceptionIfAbsolutePathIsNotAbsoluteOnUnix() + public function constructorThrowsExceptionIfAbsolutePathIsNotAbsoluteOnUnix(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionCode(1366141329); - /** @var $node RootNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node RootNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(RootNode::class, ['isWindowsOs'], [], '', false); $node - ->expects(self::any()) ->method('isWindowsOs') ->willReturn(false); $structure = [ @@ -103,12 +103,11 @@ class RootNodeTest extends UnitTestCase /** * @test */ - public function constructorSetsParentToNull() + public function constructorSetsParentToNull(): void { - /** @var $node RootNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node RootNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(RootNode::class, ['isWindowsOs'], [], '', false); $node - ->expects(self::any()) ->method('isWindowsOs') ->willReturn(false); $structure = [ @@ -121,12 +120,11 @@ class RootNodeTest extends UnitTestCase /** * @test */ - public function getChildrenReturnsChildCreatedByConstructor() + public function getChildrenReturnsChildCreatedByConstructor(): void { - /** @var $node RootNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node RootNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(RootNode::class, ['isWindowsOs'], [], '', false); $node - ->expects(self::any()) ->method('isWindowsOs') ->willReturn(false); $childName = StringUtility::getUniqueId('test_'); @@ -141,7 +139,7 @@ class RootNodeTest extends UnitTestCase ]; $node->__construct($structure, null); $children = $node->_call('getChildren'); - /** @var $child \TYPO3\CMS\install\FolderStructure\NodeInterface */ + /** @var $child NodeInterface */ $child = $children[0]; self::assertInstanceOf(DirectoryNode::class, $child); self::assertSame($childName, $child->getName()); @@ -150,12 +148,11 @@ class RootNodeTest extends UnitTestCase /** * @test */ - public function constructorSetsTargetPermission() + public function constructorSetsTargetPermission(): void { - /** @var $node RootNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node RootNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(RootNode::class, ['isWindowsOs'], [], '', false); $node - ->expects(self::any()) ->method('isWindowsOs') ->willReturn(false); $targetPermission = '2550'; @@ -170,12 +167,11 @@ class RootNodeTest extends UnitTestCase /** * @test */ - public function constructorSetsName() + public function constructorSetsName(): void { - /** @var $node RootNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node RootNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(RootNode::class, ['isWindowsOs'], [], '', false); $node - ->expects(self::any()) ->method('isWindowsOs') ->willReturn(false); $name = '/' . StringUtility::getUniqueId('test_'); @@ -186,9 +182,9 @@ class RootNodeTest extends UnitTestCase /** * @test */ - public function getStatusReturnsArrayWithOkStatusAndCallsOwnStatusMethods() + public function getStatusReturnsArrayWithOkStatusAndCallsOwnStatusMethods(): void { - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( RootNode::class, ['getAbsolutePath', 'exists', 'isDirectory', 'isWritable', 'isPermissionCorrect'], @@ -200,7 +196,7 @@ class RootNodeTest extends UnitTestCase $path = Environment::getPublicPath() . '/typo3temp/tests/' . StringUtility::getUniqueId('dir_'); GeneralUtility::mkdir_deep($path); $this->testFilesToDelete[] = $path; - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); + $node->method('getAbsolutePath')->willReturn($path); $node->expects(self::once())->method('exists')->willReturn(true); $node->expects(self::once())->method('isDirectory')->willReturn(true); $node->expects(self::once())->method('isPermissionCorrect')->willReturn(true); @@ -212,9 +208,9 @@ class RootNodeTest extends UnitTestCase /** * @test */ - public function getStatusCallsGetChildrenStatusForStatus() + public function getStatusCallsGetChildrenStatusForStatus(): void { - /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node DirectoryNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock( RootNode::class, ['getAbsolutePath', 'exists', 'isDirectory', 'isWritable', 'isPermissionCorrect', 'getChildrenStatus'], @@ -226,11 +222,11 @@ class RootNodeTest extends UnitTestCase $path = Environment::getPublicPath() . '/typo3temp/tests/' . StringUtility::getUniqueId('dir_'); GeneralUtility::mkdir_deep($path); $this->testFilesToDelete[] = $path; - $node->expects(self::any())->method('getAbsolutePath')->willReturn($path); - $node->expects(self::any())->method('exists')->willReturn(true); - $node->expects(self::any())->method('isDirectory')->willReturn(true); - $node->expects(self::any())->method('isPermissionCorrect')->willReturn(true); - $node->expects(self::any())->method('isWritable')->willReturn(true); + $node->method('getAbsolutePath')->willReturn($path); + $node->method('exists')->willReturn(true); + $node->method('isDirectory')->willReturn(true); + $node->method('isPermissionCorrect')->willReturn(true); + $node->method('isWritable')->willReturn(true); $childStatus = new FlashMessage('foo', '', FlashMessage::ERROR); $node->expects(self::once())->method('getChildrenStatus')->willReturn([$childStatus]); $statusArray = $node->getStatus(); @@ -243,12 +239,11 @@ class RootNodeTest extends UnitTestCase /** * @test */ - public function getAbsolutePathReturnsGivenName() + public function getAbsolutePathReturnsGivenName(): void { - /** @var $node RootNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $node RootNode|AccessibleObjectInterface|MockObject */ $node = $this->getAccessibleMock(RootNode::class, ['isWindowsOs'], [], '', false); $node - ->expects(self::any()) ->method('isWindowsOs') ->willReturn(false); $path = '/foo/bar'; diff --git a/typo3/sysext/install/Tests/Unit/FolderStructure/StructureFacadeTest.php b/typo3/sysext/install/Tests/Unit/FolderStructure/StructureFacadeTest.php index 38789254d2a5..ceb9ab12eb8d 100644 --- a/typo3/sysext/install/Tests/Unit/FolderStructure/StructureFacadeTest.php +++ b/typo3/sysext/install/Tests/Unit/FolderStructure/StructureFacadeTest.php @@ -17,6 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Install\Tests\Unit\FolderStructure; +use PHPUnit\Framework\MockObject\MockObject; use TYPO3\CMS\Core\Messaging\FlashMessageQueue; use TYPO3\CMS\Install\FolderStructure\RootNode; use TYPO3\CMS\Install\FolderStructure\StructureFacade; @@ -31,9 +32,9 @@ class StructureFacadeTest extends UnitTestCase /** * @test */ - public function getStatusReturnsStatusOfStructureAndReturnsItsResult() + public function getStatusReturnsStatusOfStructureAndReturnsItsResult(): void { - /** @var $facade StructureFacade|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $facade StructureFacade|AccessibleObjectInterface|MockObject */ $facade = $this->getAccessibleMock(StructureFacade::class, ['dummy'], [], '', false); $root = $this->createMock(RootNode::class); $root->expects(self::once())->method('getStatus')->willReturn([]); @@ -45,9 +46,9 @@ class StructureFacadeTest extends UnitTestCase /** * @test */ - public function fixCallsFixOfStructureAndReturnsItsResult() + public function fixCallsFixOfStructureAndReturnsItsResult(): void { - /** @var $facade StructureFacade|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $facade StructureFacade|AccessibleObjectInterface|MockObject */ $facade = $this->getAccessibleMock(StructureFacade::class, ['dummy'], [], '', false); $root = $this->createMock(RootNode::class); $root->expects(self::once())->method('fix')->willReturn([]); diff --git a/typo3/sysext/install/Tests/Unit/FolderStructureTestCase.php b/typo3/sysext/install/Tests/Unit/FolderStructureTestCase.php index 7b346adebe2e..733fea2d6016 100644 --- a/typo3/sysext/install/Tests/Unit/FolderStructureTestCase.php +++ b/typo3/sysext/install/Tests/Unit/FolderStructureTestCase.php @@ -33,7 +33,7 @@ abstract class FolderStructureTestCase extends UnitTestCase * @param string $prefix * @return string */ - protected function getVirtualTestDir($prefix = 'root_') + protected function getVirtualTestDir($prefix = 'root_'): string { $root = vfsStream::setup(); $path = $root->url() . '/typo3temp/var/tests/' . StringUtility::getUniqueId($prefix); @@ -47,7 +47,7 @@ abstract class FolderStructureTestCase extends UnitTestCase * @param string $prefix * @return string */ - protected function getVirtualTestFilePath($prefix = 'file_') + protected function getVirtualTestFilePath($prefix = 'file_'): string { return $this->getVirtualTestDir() . '/' . StringUtility::getUniqueId($prefix); } diff --git a/typo3/sysext/install/Tests/Unit/Service/ClearTableServiceTest.php b/typo3/sysext/install/Tests/Unit/Service/ClearTableServiceTest.php index 04ffd5a46a49..84291a6c12ae 100644 --- a/typo3/sysext/install/Tests/Unit/Service/ClearTableServiceTest.php +++ b/typo3/sysext/install/Tests/Unit/Service/ClearTableServiceTest.php @@ -28,7 +28,7 @@ class ClearTableServiceTest extends UnitTestCase /** * @test */ - public function clearSelectedTableThrowsWithInvalidTableName() + public function clearSelectedTableThrowsWithInvalidTableName(): void { $this->expectException(\RuntimeException::class); $this->expectExceptionCode(1501942151); diff --git a/typo3/sysext/install/Tests/Unit/Service/CoreUpdateServiceTest.php b/typo3/sysext/install/Tests/Unit/Service/CoreUpdateServiceTest.php index 05a9586eef51..8e965ed9544d 100644 --- a/typo3/sysext/install/Tests/Unit/Service/CoreUpdateServiceTest.php +++ b/typo3/sysext/install/Tests/Unit/Service/CoreUpdateServiceTest.php @@ -17,8 +17,10 @@ declare(strict_types=1); namespace TYPO3\CMS\Install\Tests\Unit\Service; +use PHPUnit\Framework\MockObject\MockObject; use TYPO3\CMS\Core\Messaging\FlashMessageQueue; use TYPO3\CMS\Install\Service\CoreUpdateService; +use TYPO3\TestingFramework\Core\AccessibleObjectInterface; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; /** @@ -29,9 +31,9 @@ class CoreUpdateServiceTest extends UnitTestCase /** * @test */ - public function getMessagesReturnsPreviouslySetMessage() + public function getMessagesReturnsPreviouslySetMessage(): void { - /** @var $instance \TYPO3\CMS\Install\Service\CoreUpdateService|\TYPO3\TestingFramework\Core\AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $instance CoreUpdateService|AccessibleObjectInterface|MockObject */ $instance = $this->getAccessibleMock(CoreUpdateService::class, ['dummy'], [], '', false); $aMessage = new FlashMessageQueue('install'); $instance->_set('messages', $aMessage); @@ -41,12 +43,12 @@ class CoreUpdateServiceTest extends UnitTestCase /** * @test */ - public function isCoreUpdateEnabledReturnsTrueForEnvironmentVariableNotSet() + public function isCoreUpdateEnabledReturnsTrueForEnvironmentVariableNotSet(): void { if (defined('TYPO3_COMPOSER_MODE') && TYPO3_COMPOSER_MODE) { self::markTestSkipped('This test is only available in Non-Composer mode.'); } - /** @var $instance \TYPO3\CMS\Install\Service\CoreUpdateService|\TYPO3\TestingFramework\Core\AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $instance CoreUpdateService|AccessibleObjectInterface|MockObject */ $instance = $this->getAccessibleMock(CoreUpdateService::class, ['dummy'], [], '', false); putenv('TYPO3_DISABLE_CORE_UPDATER'); putenv('REDIRECT_TYPO3_DISABLE_CORE_UPDATER'); @@ -56,9 +58,9 @@ class CoreUpdateServiceTest extends UnitTestCase /** * @test */ - public function isCoreUpdateEnabledReturnsFalseFor_TYPO3_DISABLE_CORE_UPDATER_EnvironmentVariableSet() + public function isCoreUpdateEnabledReturnsFalseFor_TYPO3_DISABLE_CORE_UPDATER_EnvironmentVariableSet(): void { - /** @var $instance \TYPO3\CMS\Install\Service\CoreUpdateService|\TYPO3\TestingFramework\Core\AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $instance CoreUpdateService|AccessibleObjectInterface|MockObject */ $instance = $this->getAccessibleMock(CoreUpdateService::class, ['dummy'], [], '', false); putenv('TYPO3_DISABLE_CORE_UPDATER=1'); putenv('REDIRECT_TYPO3_DISABLE_CORE_UPDATER'); @@ -68,9 +70,9 @@ class CoreUpdateServiceTest extends UnitTestCase /** * @test */ - public function isCoreUpdateEnabledReturnsFalseFor_REDIRECT_TYPO3_DISABLE_CORE_UPDATER_EnvironmentVariableSet() + public function isCoreUpdateEnabledReturnsFalseFor_REDIRECT_TYPO3_DISABLE_CORE_UPDATER_EnvironmentVariableSet(): void { - /** @var $instance \TYPO3\CMS\Install\Service\CoreUpdateService|\TYPO3\TestingFramework\Core\AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $instance CoreUpdateService|AccessibleObjectInterface|MockObject */ $instance = $this->getAccessibleMock(CoreUpdateService::class, ['dummy'], [], '', false); putenv('TYPO3_DISABLE_CORE_UPDATER'); putenv('REDIRECT_TYPO3_DISABLE_CORE_UPDATER=1'); diff --git a/typo3/sysext/install/Tests/Unit/Service/CoreVersionServiceTest.php b/typo3/sysext/install/Tests/Unit/Service/CoreVersionServiceTest.php index a010fb49ac5b..c5e859ab520c 100644 --- a/typo3/sysext/install/Tests/Unit/Service/CoreVersionServiceTest.php +++ b/typo3/sysext/install/Tests/Unit/Service/CoreVersionServiceTest.php @@ -17,12 +17,15 @@ declare(strict_types=1); namespace TYPO3\CMS\Install\Tests\Unit\Service; +use PHPUnit\Framework\MockObject\MockObject; use Prophecy\Argument; +use Prophecy\PhpUnit\ProphecyTrait; use TYPO3\CMS\Core\Http\JsonResponse; use TYPO3\CMS\Core\Http\RequestFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Install\CoreVersion\CoreRelease; use TYPO3\CMS\Install\Service\CoreVersionService; +use TYPO3\TestingFramework\Core\AccessibleObjectInterface; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; /** @@ -30,13 +33,14 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; */ class CoreVersionServiceTest extends UnitTestCase { - use \Prophecy\PhpUnit\ProphecyTrait; + use ProphecyTrait; + /** * @var bool Reset singletons created by subject */ protected $resetSingletonInstances = true; - public function setUpApiResponse(string $url, array $responseData) + public function setUpApiResponse(string $url, array $responseData): void { $response = new JsonResponse($responseData); $requestFactory = $this->prophesize(RequestFactory::class); @@ -594,7 +598,7 @@ class CoreVersionServiceTest extends UnitTestCase */ public function isInstalledVersionAReleasedVersionReturnsTrueForNonDevelopmentVersion(): void { - /** @var $instance CoreVersionService|\TYPO3\TestingFramework\Core\AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $instance CoreVersionService|AccessibleObjectInterface|MockObject */ $instance = $this->getAccessibleMock(CoreVersionService::class, ['getInstalledVersion'], [], '', false); $instance->expects(self::once())->method('getInstalledVersion')->willReturn('7.2.0'); self::assertTrue($instance->isInstalledVersionAReleasedVersion()); @@ -603,9 +607,9 @@ class CoreVersionServiceTest extends UnitTestCase /** * @test */ - public function isInstalledVersionAReleasedVersionReturnsFalseForDevelopmentVersion() + public function isInstalledVersionAReleasedVersionReturnsFalseForDevelopmentVersion(): void { - /** @var $instance CoreVersionService|\TYPO3\TestingFramework\Core\AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $instance CoreVersionService|AccessibleObjectInterface|MockObject */ $instance = $this->getAccessibleMock(CoreVersionService::class, ['getInstalledVersion'], [], '', false); $instance->expects(self::once())->method('getInstalledVersion')->willReturn('7.4-dev'); self::assertFalse($instance->isInstalledVersionAReleasedVersion()); diff --git a/typo3/sysext/install/Tests/Unit/Service/EnableFileServiceTest.php b/typo3/sysext/install/Tests/Unit/Service/EnableFileServiceTest.php index 8c59f3e31cb9..6ec5d4bf2a63 100644 --- a/typo3/sysext/install/Tests/Unit/Service/EnableFileServiceTest.php +++ b/typo3/sysext/install/Tests/Unit/Service/EnableFileServiceTest.php @@ -18,6 +18,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Install\Tests\Unit\Service; use org\bovigo\vfs\vfsStream; +use PHPUnit\Framework\MockObject\MockObject; use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Install\Service\EnableFileService; use TYPO3\TestingFramework\Core\AccessibleObjectInterface; @@ -38,7 +39,7 @@ class EnableFileServiceTest extends UnitTestCase * * @return array */ - public function getFirstInstallFilePathsDataProvider() + public function getFirstInstallFilePathsDataProvider(): array { return [ 'first-install-file-present' => [ @@ -74,11 +75,11 @@ class EnableFileServiceTest extends UnitTestCase * @test * @dataProvider getFirstInstallFilePathsDataProvider */ - public function getFirstInstallFilePaths($structure, $expected) + public function getFirstInstallFilePaths(array $structure, array $expected): void { - $vfs = vfsStream::setup('root'); + $vfs = vfsStream::setup(); vfsStream::create($structure, $vfs); - /** @var $subject EnableFileService|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $subject EnableFileService|AccessibleObjectInterface|MockObject */ $subject = $this->getAccessibleMock(EnableFileService::class, ['dummy'], [], '', false); Environment::initialize( Environment::getContext(), @@ -99,7 +100,7 @@ class EnableFileServiceTest extends UnitTestCase * * @return array */ - public function removeFirstInstallFileDataProvider() + public function removeFirstInstallFileDataProvider(): array { return [ 'first-install-file-present' => [ @@ -146,11 +147,11 @@ class EnableFileServiceTest extends UnitTestCase * @test * @dataProvider removeFirstInstallFileDataProvider */ - public function removeFirstInstallFile($structure, $expected) + public function removeFirstInstallFile(array $structure, array $expected): void { - $vfs = vfsStream::setup('root'); + $vfs = vfsStream::setup(); vfsStream::create($structure, $vfs); - /** @var $subject EnableFileService|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var $subject EnableFileService|AccessibleObjectInterface|MockObject */ $subject = $this->getAccessibleMock(EnableFileService::class, ['dummy'], [], '', false); Environment::initialize( Environment::getContext(), diff --git a/typo3/sysext/install/Tests/Unit/Service/SilentConfigurationUpgradeServiceTest.php b/typo3/sysext/install/Tests/Unit/Service/SilentConfigurationUpgradeServiceTest.php index 8043222d7fe3..9cb55b3c4384 100644 --- a/typo3/sysext/install/Tests/Unit/Service/SilentConfigurationUpgradeServiceTest.php +++ b/typo3/sysext/install/Tests/Unit/Service/SilentConfigurationUpgradeServiceTest.php @@ -17,6 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Install\Tests\Unit\Service; +use PHPUnit\Framework\MockObject\MockObject; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; @@ -27,12 +28,14 @@ use TYPO3\CMS\Core\Configuration\ConfigurationManager; use TYPO3\CMS\Core\Crypto\PasswordHashing\Argon2idPasswordHash; use TYPO3\CMS\Core\Crypto\PasswordHashing\Argon2iPasswordHash; use TYPO3\CMS\Core\Crypto\PasswordHashing\BcryptPasswordHash; +use TYPO3\CMS\Core\Package\UnitTestPackageManager; use TYPO3\CMS\Core\Tests\Unit\Utility\AccessibleProxies\ExtensionManagementUtilityAccessibleProxy; use TYPO3\CMS\Core\Utility\Exception\MissingArrayPathException; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Fluid\Core\Cache\FluidTemplateCache; use TYPO3\CMS\Install\Service\Exception\ConfigurationChangedException; use TYPO3\CMS\Install\Service\SilentConfigurationUpgradeService; +use TYPO3\TestingFramework\Core\AccessibleObjectInterface; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; /** @@ -43,12 +46,12 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase use ProphecyTrait; /** - * @var ConfigurationManager|\PHPUnit\Framework\MockObject\MockObject + * @var ConfigurationManager|MockObject */ protected $configurationManager; /** - * @var \TYPO3\CMS\Core\Package\UnitTestPackageManager A backup of unit test package manager + * @var UnitTestPackageManager A backup of unit test package manager */ protected $backupPackageManager; @@ -73,7 +76,7 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase /** * @param array $methods */ - protected function createConfigurationManagerWithMockedMethods(array $methods) + protected function createConfigurationManagerWithMockedMethods(array $methods): void { $this->configurationManager = $this->getMockBuilder(ConfigurationManager::class) ->onlyMethods($methods) @@ -83,9 +86,9 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase /** * @test */ - public function removeObsoleteLocalConfigurationSettingsIfThereAreOldSettings() + public function removeObsoleteLocalConfigurationSettingsIfThereAreOldSettings(): void { - /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|\PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */ + /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|MockObject|AccessibleObjectInterface */ $silentConfigurationUpgradeServiceInstance = $this->getAccessibleMock( SilentConfigurationUpgradeService::class, ['dummy'], @@ -121,9 +124,9 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase /** * @test */ - public function doNotRemoveObsoleteLocalConfigurationSettingsIfThereAreNoOldSettings() + public function doNotRemoveObsoleteLocalConfigurationSettingsIfThereAreNoOldSettings(): void { - /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|\PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */ + /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|MockObject|AccessibleObjectInterface */ $silentConfigurationUpgradeServiceInstance = $this->getAccessibleMock( SilentConfigurationUpgradeService::class, ['dummy'], @@ -157,9 +160,9 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase /** * @test */ - public function doNotGenerateEncryptionKeyIfExists() + public function doNotGenerateEncryptionKeyIfExists(): void { - /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|\PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */ + /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|MockObject|AccessibleObjectInterface */ $silentConfigurationUpgradeServiceInstance = $this->getAccessibleMock( SilentConfigurationUpgradeService::class, ['dummy'], @@ -192,9 +195,9 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase /** * @test */ - public function generateEncryptionKeyIfNotExists() + public function generateEncryptionKeyIfNotExists(): void { - /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|\PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */ + /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|MockObject|AccessibleObjectInterface */ $silentConfigurationUpgradeServiceInstance = $this->getAccessibleMock( SilentConfigurationUpgradeService::class, ['dummy'], @@ -333,9 +336,9 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase * @param array $newSettings * @param bool $localConfigurationNeedsUpdate */ - public function transferHttpSettingsIfSet($currentLocalConfiguration, $newSettings, $localConfigurationNeedsUpdate) + public function transferHttpSettingsIfSet(array $currentLocalConfiguration, array $newSettings, bool $localConfigurationNeedsUpdate): void { - /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|\PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */ + /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|MockObject|AccessibleObjectInterface */ $silentConfigurationUpgradeServiceInstance = $this->getAccessibleMock( SilentConfigurationUpgradeService::class, ['dummy'], @@ -352,7 +355,7 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase ] ); - $this->configurationManager->expects(self::any()) + $this->configurationManager ->method('getLocalConfiguration') ->willReturn(['HTTP' => $currentLocalConfiguration]); if ($localConfigurationNeedsUpdate) { @@ -376,9 +379,9 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase /** * @test */ - public function disableImageMagickDetailSettingsIfImageMagickIsDisabled() + public function disableImageMagickDetailSettingsIfImageMagickIsDisabled(): void { - /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|\PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */ + /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|MockObject|AccessibleObjectInterface */ $silentConfigurationUpgradeServiceInstance = $this->getAccessibleMock( SilentConfigurationUpgradeService::class, ['dummy'], @@ -422,9 +425,9 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase /** * @test */ - public function doNotDisableImageMagickDetailSettingsIfImageMagickIsEnabled() + public function doNotDisableImageMagickDetailSettingsIfImageMagickIsEnabled(): void { - /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|\PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */ + /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|MockObject|AccessibleObjectInterface */ $silentConfigurationUpgradeServiceInstance = $this->getAccessibleMock( SilentConfigurationUpgradeService::class, ['dummy'], @@ -463,9 +466,9 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase /** * @test */ - public function setImageMagickDetailSettings() + public function setImageMagickDetailSettings(): void { - /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|\PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */ + /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|MockObject|AccessibleObjectInterface */ $silentConfigurationUpgradeServiceInstance = $this->getAccessibleMock( SilentConfigurationUpgradeService::class, ['dummy'], @@ -509,9 +512,9 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase /** * @test */ - public function doNotSetImageMagickDetailSettings() + public function doNotSetImageMagickDetailSettings(): void { - /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|\PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */ + /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|MockObject|AccessibleObjectInterface */ $silentConfigurationUpgradeServiceInstance = $this->getAccessibleMock( SilentConfigurationUpgradeService::class, ['dummy'], @@ -552,7 +555,7 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase * @param mixed $currentValue * @param bool $expectedMigratedValue */ - public function migratesGraphicsProcessorEffects($currentValue, $expectedMigratedValue) + public function migratesGraphicsProcessorEffects($currentValue, bool $expectedMigratedValue): void { /** @var ConfigurationManager|\Prophecy\Prophecy\ObjectProphecy */ $configurationManager = $this->prophesize(ConfigurationManager::class); @@ -608,9 +611,9 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase /** * @test */ - public function migrateNonExistingLangDebug() + public function migrateNonExistingLangDebug(): void { - /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|\PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */ + /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|MockObject|AccessibleObjectInterface */ $silentConfigurationUpgradeServiceInstance = $this->getAccessibleMock( SilentConfigurationUpgradeService::class, ['dummy'], @@ -642,9 +645,9 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase /** * @test */ - public function migrateExistingLangDebug() + public function migrateExistingLangDebug(): void { - /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|\PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */ + /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|MockObject|AccessibleObjectInterface */ $silentConfigurationUpgradeServiceInstance = $this->getAccessibleMock( SilentConfigurationUpgradeService::class, ['dummy'], @@ -680,7 +683,7 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase /** * @test */ - public function migrateCacheHashOptions() + public function migrateCacheHashOptions(): void { $oldConfig = [ 'FE/cHashOnlyForParameters' => 'foo,bar', @@ -704,7 +707,7 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase $this->expectException(ConfigurationChangedException::class); $this->expectExceptionCode(1379024938); - /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|\PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */ + /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|MockObject|AccessibleObjectInterface */ $silentConfigurationUpgradeServiceInstance = $this->getAccessibleMock( SilentConfigurationUpgradeService::class, ['dummy'], @@ -720,7 +723,7 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase /** * @test */ - public function migrateSaltedPasswordsSettingsDoesNothingIfExtensionConfigsAreNotSet() + public function migrateSaltedPasswordsSettingsDoesNothingIfExtensionConfigsAreNotSet(): void { $configurationManagerProphecy = $this->prophesize(ConfigurationManager::class); $configurationManagerException = new MissingArrayPathException('Path does not exist in array', 1533989414); @@ -739,7 +742,7 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase /** * @test */ - public function migrateSaltedPasswordsSettingsDoesNothingIfExtensionConfigsAreEmpty() + public function migrateSaltedPasswordsSettingsDoesNothingIfExtensionConfigsAreEmpty(): void { $configurationManagerProphecy = $this->prophesize(ConfigurationManager::class); $configurationManagerProphecy->getLocalConfigurationValueByPath('EXTENSIONS/saltedpasswords') @@ -757,7 +760,7 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase /** * @test */ - public function migrateSaltedPasswordsSettingsRemovesExtensionsConfigAndSetsNothingElseIfArgon2iIsAvailable() + public function migrateSaltedPasswordsSettingsRemovesExtensionsConfigAndSetsNothingElseIfArgon2iIsAvailable(): void { $configurationManagerProphecy = $this->prophesize(ConfigurationManager::class); $configurationManagerProphecy->getLocalConfigurationValueByPath('EXTENSIONS/saltedpasswords') @@ -783,7 +786,7 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase /** * @test */ - public function migrateSaltedPasswordsSetsSpecificHashMethodIfArgon2idAndArgon2iIsNotAvailable() + public function migrateSaltedPasswordsSetsSpecificHashMethodIfArgon2idAndArgon2iIsNotAvailable(): void { $configurationManagerProphecy = $this->prophesize(ConfigurationManager::class); $configurationManagerProphecy->getLocalConfigurationValueByPath('EXTENSIONS/saltedpasswords') @@ -825,7 +828,7 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase /** * @test */ - public function migrateCachingFrameworkCachesMigratesData() + public function migrateCachingFrameworkCachesMigratesData(): void { $oldCacheConfigurations = [ 'cache_rootline' => [ @@ -868,7 +871,7 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase $this->expectException(ConfigurationChangedException::class); $this->expectExceptionCode(1379024938); - /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|\PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */ + /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|MockObject|AccessibleObjectInterface */ $silentConfigurationUpgradeServiceInstance = $this->getAccessibleMock( SilentConfigurationUpgradeService::class, ['dummy'], @@ -884,7 +887,7 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase /** * @test */ - public function migrateCachingFrameworkCachesDoesNotMigrateWithoutPrefix() + public function migrateCachingFrameworkCachesDoesNotMigrateWithoutPrefix(): void { $oldCacheConfigurations = [ 'rootline' => [ @@ -909,7 +912,7 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase $configurationManager->setLocalConfigurationValueByPath(Argument::cetera())->shouldNotBeCalled(); - /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|\PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */ + /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|MockObject|AccessibleObjectInterface */ $silentConfigurationUpgradeServiceInstance = $this->getAccessibleMock( SilentConfigurationUpgradeService::class, ['dummy'], diff --git a/typo3/sysext/install/Tests/Unit/Service/Typo3tempFileServiceTest.php b/typo3/sysext/install/Tests/Unit/Service/Typo3tempFileServiceTest.php index cdfacca7c190..c6e05aa6d0e9 100644 --- a/typo3/sysext/install/Tests/Unit/Service/Typo3tempFileServiceTest.php +++ b/typo3/sysext/install/Tests/Unit/Service/Typo3tempFileServiceTest.php @@ -17,6 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Install\Tests\Unit\Service; +use Prophecy\PhpUnit\ProphecyTrait; use TYPO3\CMS\Core\Resource\ProcessedFileRepository; use TYPO3\CMS\Core\Resource\StorageRepository; use TYPO3\CMS\Install\Service\Typo3tempFileService; @@ -27,11 +28,12 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; */ class Typo3tempFileServiceTest extends UnitTestCase { - use \Prophecy\PhpUnit\ProphecyTrait; + use ProphecyTrait; + /** * @test */ - public function clearAssetsFolderThrowsWithInvalidPath() + public function clearAssetsFolderThrowsWithInvalidPath(): void { $this->expectException(\RuntimeException::class); $this->expectExceptionCode(1501781453); @@ -44,7 +46,7 @@ class Typo3tempFileServiceTest extends UnitTestCase /** * @test */ - public function clearAssetsFolderThrowsIfPathDoesNotStartWithTypotempAssets() + public function clearAssetsFolderThrowsIfPathDoesNotStartWithTypotempAssets(): void { $this->expectException(\RuntimeException::class); $this->expectExceptionCode(1501781453); diff --git a/typo3/sysext/install/Tests/Unit/SystemEnvironment/ServerResponse/ContentSecurityPolicyHeaderTest.php b/typo3/sysext/install/Tests/Unit/SystemEnvironment/ServerResponse/ContentSecurityPolicyHeaderTest.php index 6140ad3e3df8..df9342be5853 100644 --- a/typo3/sysext/install/Tests/Unit/SystemEnvironment/ServerResponse/ContentSecurityPolicyHeaderTest.php +++ b/typo3/sysext/install/Tests/Unit/SystemEnvironment/ServerResponse/ContentSecurityPolicyHeaderTest.php @@ -79,7 +79,7 @@ class ContentSecurityPolicyHeaderTest extends TestCase * @test * @dataProvider mitigatesCrossSiteScriptingDataProvider */ - public function mitigatesCrossSiteScripting(string $header, bool $expectation) + public function mitigatesCrossSiteScripting(string $header, bool $expectation): void { $subject = new ContentSecurityPolicyHeader($header); self::assertSame($expectation, $subject->mitigatesCrossSiteScripting()); diff --git a/typo3/sysext/install/Tests/Unit/Updates/RowUpdater/L18nDiffsourceToJsonMigrationTest.php b/typo3/sysext/install/Tests/Unit/Updates/RowUpdater/L18nDiffsourceToJsonMigrationTest.php index 2e19a44f8183..90836b1d59c8 100644 --- a/typo3/sysext/install/Tests/Unit/Updates/RowUpdater/L18nDiffsourceToJsonMigrationTest.php +++ b/typo3/sysext/install/Tests/Unit/Updates/RowUpdater/L18nDiffsourceToJsonMigrationTest.php @@ -25,7 +25,7 @@ class L18nDiffsourceToJsonMigrationTest extends UnitTestCase /** * @test */ - public function hasPotentialUpdateForTableReturnsFalseIfTableIsNotLocalizable() + public function hasPotentialUpdateForTableReturnsFalseIfTableIsNotLocalizable(): void { $GLOBALS['TCA']['testTable'] = []; self::assertFalse((new L18nDiffsourceToJsonMigration())->hasPotentialUpdateForTable('testTable')); @@ -34,7 +34,7 @@ class L18nDiffsourceToJsonMigrationTest extends UnitTestCase /** * @test */ - public function hasPotentialUpdateForTableReturnsTrueIfTableIsLocalizable() + public function hasPotentialUpdateForTableReturnsTrueIfTableIsLocalizable(): void { $GLOBALS['TCA']['testTable'] = [ 'ctrl' => [ @@ -49,7 +49,7 @@ class L18nDiffsourceToJsonMigrationTest extends UnitTestCase /** * @test */ - public function updateTableRowDoesNothingIfFieldIsNotSet() + public function updateTableRowDoesNothingIfFieldIsNotSet(): void { $GLOBALS['TCA']['testTable'] = [ 'ctrl' => [ @@ -60,7 +60,7 @@ class L18nDiffsourceToJsonMigrationTest extends UnitTestCase self::assertSame($row, (new L18nDiffsourceToJsonMigration())->updateTableRow('testTable', $row)); } - public function updateTableRowUpdatesFieldDataProvider() + public function updateTableRowUpdatesFieldDataProvider(): array { $object = new \stdClass(); $json = json_encode(['foo' => 'bar']); @@ -109,8 +109,11 @@ class L18nDiffsourceToJsonMigrationTest extends UnitTestCase /** * @test * @dataProvider updateTableRowUpdatesFieldDataProvider + * + * @param mixed $input + * @param mixed $expected */ - public function updateTableRowUpdatesField($input, $expected) + public function updateTableRowUpdatesField($input, $expected): void { $GLOBALS['TCA']['testTable'] = [ 'ctrl' => [ diff --git a/typo3/sysext/install/Tests/Unit/UpgradeAnalysis/DocumentationFileTest.php b/typo3/sysext/install/Tests/Unit/UpgradeAnalysis/DocumentationFileTest.php index 09a88391c1f3..8b76eabaf92f 100644 --- a/typo3/sysext/install/Tests/Unit/UpgradeAnalysis/DocumentationFileTest.php +++ b/typo3/sysext/install/Tests/Unit/UpgradeAnalysis/DocumentationFileTest.php @@ -20,6 +20,8 @@ namespace TYPO3\CMS\Install\Tests\Unit\UpgradeAnalysis; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamDirectory; use Prophecy\Argument; +use Prophecy\PhpUnit\ProphecyTrait; +use Prophecy\Prophecy\ObjectProphecy; use TYPO3\CMS\Core\Registry; use TYPO3\CMS\Core\Utility\VersionNumberUtility; use TYPO3\CMS\Install\UpgradeAnalysis\DocumentationFile; @@ -27,21 +29,15 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; class DocumentationFileTest extends UnitTestCase { - use \Prophecy\PhpUnit\ProphecyTrait; - /** - * @var DocumentationFile - */ - protected $documentationFileService; + use ProphecyTrait; - /** - * @var vfsStreamDirectory - */ - protected $docRoot; + protected DocumentationFile $documentationFileService; + protected vfsStreamDirectory $docRoot; /** - * @var Registry + * @var Registry|ObjectProphecy */ - protected $registry; + protected ObjectProphecy $registry; /** * set up test environment @@ -125,7 +121,7 @@ class DocumentationFileTest extends UnitTestCase * dataprovider with invalid dir path. They should raise an exception and don't process. * @return array */ - public function invalidDirProvider() + public function invalidDirProvider(): array { return [ [ @@ -144,7 +140,7 @@ class DocumentationFileTest extends UnitTestCase * @dataProvider invalidDirProvider * @test */ - public function findDocumentationFilesThrowsExceptionIfPathIsNotInGivenChangelogDir(string $path) + public function findDocumentationFilesThrowsExceptionIfPathIsNotInGivenChangelogDir(string $path): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionCode(1485425530); @@ -155,7 +151,7 @@ class DocumentationFileTest extends UnitTestCase /** * @test */ - public function findDocumentationFilesReturnsArrayOfFilesForTheLastThreeMajorVersions() + public function findDocumentationFilesReturnsArrayOfFilesForTheLastThreeMajorVersions(): void { $currentVersion = (int)explode('.', VersionNumberUtility::getNumericTypo3Version())[0]; $expected = [ @@ -172,7 +168,7 @@ class DocumentationFileTest extends UnitTestCase /** * @test */ - public function findDocumentsRespectsFilesWithSameIssueNumber() + public function findDocumentsRespectsFilesWithSameIssueNumber(): void { $result = $this->documentationFileService->findDocumentationFiles(vfsStream::url('root/Changelog/master')); self::assertCount(2, $result); @@ -181,7 +177,7 @@ class DocumentationFileTest extends UnitTestCase /** * @test */ - public function extractingTagsProvidesTagsAsDesired() + public function extractingTagsProvidesTagsAsDesired(): void { $expected = [ 'unittest', @@ -195,7 +191,7 @@ class DocumentationFileTest extends UnitTestCase /** * @test */ - public function filesAreFilteredByUsersChoice() + public function filesAreFilteredByUsersChoice(): void { $ignoredFiles = ['vfs://root/Changelog/1.2/Breaking-12345-Issue.rst']; $this->registry->get( @@ -224,7 +220,7 @@ class DocumentationFileTest extends UnitTestCase * @param string $path * @test */ - public function getListEntryThrowsExceptionForFilesNotBelongToChangelogDir(string $path) + public function getListEntryThrowsExceptionForFilesNotBelongToChangelogDir(string $path): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionCode(1485425531); -- GitLab