From c96c199c07850a49ac9ba7b4bb9d30839bbcd151 Mon Sep 17 00:00:00 2001 From: Georg Ringer Date: Sat, 15 Nov 2025 21:20:13 +0100 Subject: [PATCH 1/7] [TASK] Enable tests for v14 --- .github/workflows/core14.yml | 50 ++++++++++++++++ Build/Scripts/runTests.sh | 24 ++++++-- .../AddressControllerPaginationTest.php | 8 +-- .../Unit/Controller/AddressControllerTest.php | 10 ++-- .../FieldControl/LocationMapWizardTest.php | 57 ------------------- composer.json | 2 +- 6 files changed, 79 insertions(+), 72 deletions(-) create mode 100644 .github/workflows/core14.yml delete mode 100755 Tests/UnitDeprecated/FormEngine/FieldControl/LocationMapWizardTest.php diff --git a/.github/workflows/core14.yml b/.github/workflows/core14.yml new file mode 100644 index 000000000..53a5d07aa --- /dev/null +++ b/.github/workflows/core14.yml @@ -0,0 +1,50 @@ +name: core 13 + +on: [ push, pull_request ] + +jobs: + tests: + name: v13 + runs-on: ubuntu-22.04 + strategy: + # This prevents cancellation of matrix job runs, if one/two already failed and let the + # rest matrix jobs be executed anyway. + fail-fast: true + matrix: + php: [ '8.2', '8.3', '8.4' ] + composerInstall: [ 'composerInstallLowest', 'composerInstallHighest' ] + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install testing system + run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -s ${{ matrix.composerInstall }} + + - name: Lint PHP + run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -s lint + + - if: matrix.php == '8.3' + name: Validate code against CGL + run: PHP_CS_FIXER_IGNORE_ENV=1 Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -s cgl -n + + - name: Unit Tests + run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -s unit + +# - name: Functional Tests with mariadb and mysqli +# run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d mariadb -a mysqli -s functional +# +# - name: Functional Tests with mariadb and pdo_mysql +# run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d mariadb -a pdo_mysql -s functional +# +# - name: Functional Tests with mysql and mysqli +# run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d mysql -a mysqli -s functional +# +# - name: Functional Tests with mysql and pdo_mysql +# run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d mysql -a pdo_mysql -s functional +# +# - name: Functional Tests with postgres +# run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d postgres -s functional + + # @todo disabled, due cross dbmns issues in code. Should be fixed first + # - name: Functional Tests with sqlite + # run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d sqlite -s functional diff --git a/Build/Scripts/runTests.sh b/Build/Scripts/runTests.sh index 070273c08..7025b9a91 100755 --- a/Build/Scripts/runTests.sh +++ b/Build/Scripts/runTests.sh @@ -222,13 +222,14 @@ Options: - 15 maintained until 2027-11-11 - 16 maintained until 2028-11-09 - -t <12|13> + -t <12|13|14> Only with -s composerInstall|composerInstallMin|composerInstallMax Specifies the TYPO3 CORE Version to be used - 12: use TYPO3 v12 (default) - 13: use TYPO3 v13 + - 14: use TYPO3 v14 - -p <8.0|8.1|8.2|8.3|8.4> + -p <8.2|8.3|8.4> Specifies the PHP minor version to be used - 8.0: use PHP 8.0 (default) - 8.1: use PHP 8.1 @@ -307,7 +308,7 @@ ROOT_DIR="${PWD}" # Option defaults TEST_SUITE="" -TYPO3_VERSION="12" +TYPO3_VERSION="13" DBMS="mysql" DBMS_VERSION="" PHP_VERSION="8.2" @@ -366,7 +367,7 @@ while getopts "a:b:s:d:i:p:e:t:xy:nhu" OPT; do ;; t) TYPO3_VERSION=${OPTARG} - if ! [[ ${TYPO3_VERSION} =~ ^(12|13)$ ]]; then + if ! [[ ${TYPO3_VERSION} =~ ^(12|13|14)$ ]]; then INVALID_OPTIONS+=("-t ${OPTARG}") fi ;; @@ -512,6 +513,15 @@ case ${TEST_SUITE} in composer require --no-ansi --no-interaction --no-progress --no-install \ typo3/cms-core:^13.4 || exit 1 fi + if [ ${TYPO3_VERSION} -eq 14 ]; then + composer config minimum-stability dev + composer require --no-ansi --no-interaction --no-progress --no-install \ + typo3/cms-core:dev-main \ + typo3/cms-install:dev-main \ + typo3/testing-framework:dev-main \ + phpunit/phpunit:^11 \ + || exit 1 + fi composer update --no-progress --no-interaction || exit 1 composer show || exit 1 " @@ -528,7 +538,11 @@ case ${TEST_SUITE} in fi if [ ${TYPO3_VERSION} -eq 13 ]; then composer require --no-ansi --no-interaction --no-progress --no-install \ - typo3/cms-core:^13.4 || exit 1 + typo3/cms-core:^13.4.17 || exit 1 + fi + if [ ${TYPO3_VERSION} -eq 14 ]; then + composer require --no-ansi --no-interaction --no-progress --no-install \ + typo3/cms-core:dev-main || exit 1 fi composer update --no-ansi --no-interaction --no-progress --with-dependencies --prefer-lowest || exit 1 composer show || exit 1 diff --git a/Tests/Unit/Controller/AddressControllerPaginationTest.php b/Tests/Unit/Controller/AddressControllerPaginationTest.php index d697d8ae9..6c76c9837 100644 --- a/Tests/Unit/Controller/AddressControllerPaginationTest.php +++ b/Tests/Unit/Controller/AddressControllerPaginationTest.php @@ -13,19 +13,17 @@ use FriendsOfTYPO3\TtAddress\Domain\Model\Dto\Demand; use FriendsOfTYPO3\TtAddress\Domain\Model\Dto\Settings; use FriendsOfTYPO3\TtAddress\Domain\Repository\AddressRepository; +use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Pagination\PaginatorInterface; use TYPO3\CMS\Core\Pagination\SimplePagination; use TYPO3\CMS\Extbase\Mvc\Request; +use TYPO3\CMS\Fluid\View\FluidViewAdapter; use TYPO3\CMS\Fluid\View\TemplateView; use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; use TYPO3\TestingFramework\Core\BaseTestCase; class AddressControllerPaginationTest extends BaseTestCase { - protected function setUp(): void - { - $GLOBALS['TSFE'] = $this->getAccessibleMock(TypoScriptFrontendController::class, ['addCacheTags'], [], '', false); - } /** * @test @@ -67,7 +65,7 @@ public function listActionUsesNewPaginationWithArrayRecords() $mockedRequest->expects(self::once())->method('getArgument')->with('currentPage')->willReturn(2); $mockedRequest->expects(self::any())->method('getAttribute')->willReturn([]); - $mockedView = $this->getAccessibleMock(TemplateView::class, ['assignMultiple', 'assign'], [], '', false); + $mockedView = $this->getAccessibleMock((new Typo3Version())->getMajorVersion() >= 14 ? FluidViewAdapter::class : TemplateView::class, ['assignMultiple', 'assign'], [], '', false); $mockedView->expects(self::once())->method('assignMultiple')->with($assignments); $subject = $this->getAccessibleMock(AddressController::class, ['createDemandFromSettings', 'htmlResponse'], [], '', false); diff --git a/Tests/Unit/Controller/AddressControllerTest.php b/Tests/Unit/Controller/AddressControllerTest.php index c5ad78984..9459b77a4 100644 --- a/Tests/Unit/Controller/AddressControllerTest.php +++ b/Tests/Unit/Controller/AddressControllerTest.php @@ -19,10 +19,12 @@ use TYPO3\CMS\Core\Cache\CacheDataCollectorInterface; use TYPO3\CMS\Core\Domain\Repository\PageRepository; use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Extbase\Configuration\ConfigurationManager; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; use TYPO3\CMS\Extbase\Mvc\ExtbaseRequestParameters; use TYPO3\CMS\Extbase\Mvc\Request; +use TYPO3\CMS\Fluid\View\FluidViewAdapter; use TYPO3\CMS\Fluid\View\TemplateView; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; use TYPO3\TestingFramework\Core\BaseTestCase; @@ -202,7 +204,7 @@ public function showActionFillsView() 'address' => $address, 'contentObjectData' => [], ]; - $mockedView = $this->getAccessibleMock(TemplateView::class, ['assignMultiple'], [], '', false); + $mockedView = $this->getAccessibleMock((new Typo3Version())->getMajorVersion() >= 14 ? FluidViewAdapter::class : TemplateView::class, ['assignMultiple'], [], '', false); $mockedView->expects(self::once())->method('assignMultiple')->with($assigned); $subject = $this->getAccessibleMock(AddressController::class, ['redirectToUri', 'htmlResponse'], [], '', false); @@ -235,7 +237,7 @@ public function listActionFillsViewForSingleRecords() 'contentObjectData' => [], ]; - $mockedView = $this->getAccessibleMock(TemplateView::class, ['assignMultiple', 'assign'], [], '', false); + $mockedView = $this->getAccessibleMock((new Typo3Version())->getMajorVersion() >= 14 ? FluidViewAdapter::class : TemplateView::class, ['assignMultiple', 'assign'], [], '', false); $mockedView->expects(self::once())->method('assignMultiple')->with($assignments); $mockedRequest = $this->getAccessibleMock(Request::class, ['hasArgument', 'getArgument', 'getAttribute'], [], '', false); $mockedRequest->expects(self::any())->method('getAttribute')->willReturn([]); @@ -275,7 +277,7 @@ public function listActionFillsViewForDemand() $mockedRequest = $this->getAccessibleMock(Request::class, ['hasArgument', 'getArgument', 'getAttribute'], [], '', false); $mockedRequest->expects(self::any())->method('getAttribute')->willReturn([]); - $mockedView = $this->getAccessibleMock(TemplateView::class, ['assignMultiple', 'assign'], [], '', false); + $mockedView = $this->getAccessibleMock((new Typo3Version())->getMajorVersion() >= 14 ? FluidViewAdapter::class : TemplateView::class, ['assignMultiple', 'assign'], [], '', false); $mockedView->expects(self::once())->method('assignMultiple')->with($assignments); $subject = $this->getAccessibleMock(AddressController::class, ['createDemandFromSettings', 'htmlResponse'], [], '', false); @@ -298,7 +300,7 @@ public function overrideDemandMethodIsCalledIfEnabled() $mockedRequest = $this->getAccessibleMock(Request::class, ['hasArgument', 'getArgument', 'getAttribute'], [], '', false); $mockedRepository = $this->getAccessibleMock(AddressRepository::class, ['getAddressesByCustomSorting', 'findByDemand'], [], '', false); $mockedRepository->expects(self::any())->method('findByDemand')->willReturn([]); - $mockedView = $this->getAccessibleMock(TemplateView::class, ['assignMultiple', 'assign'], [], '', false); + $mockedView = $this->getAccessibleMock((new Typo3Version())->getMajorVersion() >= 14 ? FluidViewAdapter::class : TemplateView::class, ['assignMultiple', 'assign'], [], '', false); $mockedView->expects(self::once())->method('assignMultiple'); $mockContentObject = $this->createMock(ContentObjectRenderer::class); $mockConfigurationManager = $this->createMock(ConfigurationManager::class); diff --git a/Tests/UnitDeprecated/FormEngine/FieldControl/LocationMapWizardTest.php b/Tests/UnitDeprecated/FormEngine/FieldControl/LocationMapWizardTest.php deleted file mode 100755 index 478b341aa..000000000 --- a/Tests/UnitDeprecated/FormEngine/FieldControl/LocationMapWizardTest.php +++ /dev/null @@ -1,57 +0,0 @@ -getAccessibleMock(LanguageService::class, null, [], '', false, false); - $GLOBALS['LANG'] = $languageService; - - $subject = $this->getAccessibleMock(LocationMapWizard::class, null, [], '', false); - self::assertEquals($languageService, $subject->_call('getLanguageService')); - } - - /** - * @test - */ - public function properResultArrayIsReturned() - { - $languageService = $this->getAccessibleMock(LanguageService::class, ['sL'], [], '', false); - $languageService->expects(self::any())->method('sL')->willReturn('label'); - - $subject = $this->getAccessibleMock(LocationMapWizard::class, ['getLanguageService'], [], '', false); - $subject->expects(self::any())->method('getLanguageService')->willReturn($languageService); - - $data = [ - 'databaseRow' => [ - 'latitude' => '12.1212', - 'longitude' => '45.1212', - ], - 'parameterArray' => [ - 'itemFormElName' => 'elName', - ], - ]; - $subject->_set('data', $data); - - $result = $subject->render(); - self::assertEquals('location-map-wizard', $result['iconIdentifier']); - } -} diff --git a/composer.json b/composer.json index 5bd47c3b3..4ea62210b 100755 --- a/composer.json +++ b/composer.json @@ -22,6 +22,7 @@ "license": "GPL-2.0-or-later", "require": { "typo3/cms-core": "^13.4.20 || ^14.0", + "typo3/cms-install": "^13.4.20 || ^14.0", "php": ">=8.2", "symfony/console": "^6.0 || ^7.0" }, @@ -43,7 +44,6 @@ } }, "require-dev": { - "typo3/cms-install": "^13.4.20 || ^14.0", "typo3/testing-framework": "^8.0.9", "phpunit/phpunit": "^10.5.45", "typo3/coding-standards": "^0.5.3", From c4e75f284bbbb45f692a088c61b63cd1cd963c0e Mon Sep 17 00:00:00 2001 From: Georg Ringer Date: Sat, 15 Nov 2025 21:23:22 +0100 Subject: [PATCH 2/7] [TASK] Rename gh action --- .github/workflows/core14.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/core14.yml b/.github/workflows/core14.yml index 53a5d07aa..81d5f49b2 100644 --- a/.github/workflows/core14.yml +++ b/.github/workflows/core14.yml @@ -1,10 +1,10 @@ -name: core 13 +name: core 14 on: [ push, pull_request ] jobs: tests: - name: v13 + name: v14 runs-on: ubuntu-22.04 strategy: # This prevents cancellation of matrix job runs, if one/two already failed and let the From bfcf8fb89670abe12ee8c98d3b332e26301412ce Mon Sep 17 00:00:00 2001 From: Georg Ringer Date: Sat, 15 Nov 2025 21:25:03 +0100 Subject: [PATCH 3/7] [TASK] Raise composer lowest for v14 --- Build/Scripts/runTests.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Build/Scripts/runTests.sh b/Build/Scripts/runTests.sh index 7025b9a91..5e7cf811f 100755 --- a/Build/Scripts/runTests.sh +++ b/Build/Scripts/runTests.sh @@ -541,8 +541,13 @@ case ${TEST_SUITE} in typo3/cms-core:^13.4.17 || exit 1 fi if [ ${TYPO3_VERSION} -eq 14 ]; then + composer config minimum-stability dev composer require --no-ansi --no-interaction --no-progress --no-install \ - typo3/cms-core:dev-main || exit 1 + typo3/cms-core:dev-main \ + typo3/cms-install:dev-main \ + typo3/testing-framework:dev-main \ + phpunit/phpunit:^11 \ + || exit 1 fi composer update --no-ansi --no-interaction --no-progress --with-dependencies --prefer-lowest || exit 1 composer show || exit 1 From cd74c74285d022e173c44459841b21677186e265 Mon Sep 17 00:00:00 2001 From: Georg Ringer Date: Sat, 15 Nov 2025 21:33:43 +0100 Subject: [PATCH 4/7] [TASK] Update test attributes --- Build/php-cs-fixer/php-cs-fixer.php | 1 + .../Repository/AddressRepositoryTest.php | 40 +--- .../Service/CategoryServiceTest.php | 8 +- .../Functional/Service/GeocodeServiceTest.php | 12 +- Tests/Unit/Command/GeocodeCommandTest.php | 12 +- .../AddressControllerPaginationTest.php | 11 +- .../Unit/Controller/AddressControllerTest.php | 48 ++--- Tests/Unit/Domain/Model/AddressTest.php | 178 +++++------------- Tests/Unit/Domain/Model/Dto/DemandTest.php | 32 +--- Tests/Unit/Domain/Model/Dto/SettingsTest.php | 8 +- .../Evaluation/LatitudeEvaluationTest.php | 16 +- .../Evaluation/LongitudeEvaluationTest.php | 16 +- .../Evaluation/TelephoneEvaluationTest.php | 16 +- .../Hooks/Tca/AddFieldsToSelectorTest.php | 8 +- Tests/Unit/Seo/AddressTitleProviderTest.php | 4 +- Tests/Unit/Service/GeocodeServiceTest.php | 12 +- Tests/Unit/Utility/CacheUtilityTest.php | 8 +- .../Utility/EvalcoordinatesUtilityTest.php | 12 +- Tests/Unit/Utility/TypoScriptTest.php | 4 +- .../StaticGoogleMapsViewHelperTest.php | 6 +- 20 files changed, 123 insertions(+), 329 deletions(-) diff --git a/Build/php-cs-fixer/php-cs-fixer.php b/Build/php-cs-fixer/php-cs-fixer.php index 02bdfd13d..881bd9c85 100644 --- a/Build/php-cs-fixer/php-cs-fixer.php +++ b/Build/php-cs-fixer/php-cs-fixer.php @@ -134,6 +134,7 @@ 'spaces_inside_parentheses' => true, 'type_declaration_spaces' => true, 'types_spaces' => true, + 'php_unit_attributes' => true, \PhpCsFixerCustomFixers\Fixer\NoDuplicatedArrayKeyFixer::name() => true, \PhpCsFixerCustomFixers\Fixer\NoDuplicatedImportsFixer::name() => true, \PhpCsFixerCustomFixers\Fixer\NoPhpStormGeneratedCommentFixer::name() => true, diff --git a/Tests/Functional/Repository/AddressRepositoryTest.php b/Tests/Functional/Repository/AddressRepositoryTest.php index 42ebea55c..af9cc90d7 100644 --- a/Tests/Functional/Repository/AddressRepositoryTest.php +++ b/Tests/Functional/Repository/AddressRepositoryTest.php @@ -33,9 +33,7 @@ public function setUp(): void $this->importCSVDataSet(__DIR__ . '/../Fixtures/tt_address.csv'); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function rawQueryReturnsCorrectQuery() { $demand = new Demand(); @@ -48,18 +46,14 @@ public function rawQueryReturnsCorrectQuery() self::assertEquals($sql, $result); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function findRecordsByUid() { $address = $this->addressRepository->findByIdentifier(1); self::assertEquals('John', $address->getFirstName()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function findRecordsByCustomSorting() { $demand = new Demand(); @@ -70,9 +64,7 @@ public function findRecordsByCustomSorting() self::assertEquals([3, 6, 2], $this->getListOfIds($addresses)); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function findRecordsByCustomSortingDesc() { $demand = new Demand(); @@ -85,9 +77,7 @@ public function findRecordsByCustomSortingDesc() self::assertEquals([2, 6, 3], $this->getListOfIds($addresses)); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function findRecordsByCustomSortingAndSortFieldDesc() { $demand = new Demand(); @@ -99,9 +89,7 @@ public function findRecordsByCustomSortingAndSortFieldDesc() self::assertEquals([3, 2, 6], $this->getListOfIds($addresses)); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function findRecordsByPageAndCustomSortingDesc() { $demand = new Demand(); @@ -112,9 +100,7 @@ public function findRecordsByPageAndCustomSortingDesc() self::assertEquals([7, 5, 6], $this->getListOfIds($addresses)); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function findRecordsByPageAndCustomSortingAsc() { $demand = new Demand(); @@ -124,9 +110,7 @@ public function findRecordsByPageAndCustomSortingAsc() self::assertEquals([6, 5, 7], $this->getListOfIds($addresses)); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function findRecordsByCategory() { $demand = new Demand(); @@ -145,9 +129,7 @@ public function findRecordsByCategory() self::assertEquals([2, 5, 6, 7], $this->getListOfIds($addresses)); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function findRecordsByCategoryWithSubCheck() { $demand = new Demand(); @@ -163,9 +145,7 @@ public function findRecordsByCategoryWithSubCheck() self::assertEquals([1, 6, 8], $this->getListOfIds($addresses)); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function findRecordsByCoordinates() { $demand = new Demand(); diff --git a/Tests/Functional/Service/CategoryServiceTest.php b/Tests/Functional/Service/CategoryServiceTest.php index 2f787b0a1..c04e1c6ec 100644 --- a/Tests/Functional/Service/CategoryServiceTest.php +++ b/Tests/Functional/Service/CategoryServiceTest.php @@ -31,9 +31,7 @@ public function setUp(): void $this->importCSVDataSet(__DIR__ . '/../Fixtures/sys_categories.csv'); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function findChildCategories() { $categories = $this->subject->getChildrenCategories('2,4'); @@ -43,9 +41,7 @@ public function findChildCategories() self::assertEquals('4,5,8', $categories); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function loggerInvokedWithTooManyCategories() { $mockedTimeTracker = $this->getAccessibleMock(TimeTracker::class, ['setTSlogMessage'], [], '', false); diff --git a/Tests/Functional/Service/GeocodeServiceTest.php b/Tests/Functional/Service/GeocodeServiceTest.php index 9e8d8ee7d..17fc5dbb7 100644 --- a/Tests/Functional/Service/GeocodeServiceTest.php +++ b/Tests/Functional/Service/GeocodeServiceTest.php @@ -28,9 +28,7 @@ public function setUp(): void $this->importCSVDataSet(__DIR__ . '/../Fixtures/tt_address.csv'); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function properRecordsAreFound() { $subject = $this->getAccessibleMock(GeocodeService::class, ['getCoordinatesForAddress'], ['123']); @@ -52,9 +50,7 @@ public function properRecordsAreFound() self::assertEquals(['latitude' => 10.000000000000, 'longitude' => 12.000000000000], ['latitude' => $row['latitude'], 'longitude' => $row['longitude']]); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function urlforAddressesIsBuiltCorrectly() { $result1 = ['results' => [0 => ['geometry' => ['location' => ['lat' => 11, 'lng' => '13']]]]]; @@ -72,9 +68,7 @@ public function urlforAddressesIsBuiltCorrectly() self::assertEquals([], $response4); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function findRecordsByUid() { self::assertTrue(true); diff --git a/Tests/Unit/Command/GeocodeCommandTest.php b/Tests/Unit/Command/GeocodeCommandTest.php index b8e7e5fdc..360e611b8 100644 --- a/Tests/Unit/Command/GeocodeCommandTest.php +++ b/Tests/Unit/Command/GeocodeCommandTest.php @@ -18,9 +18,7 @@ class GeocodeCommandTest extends BaseTestCase { - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function configurationIsProperlyConfigured() { $subject = $this->getAccessibleMock(GeocodeCommand::class, ['addArgument'], [], '', false); @@ -28,9 +26,7 @@ public function configurationIsProperlyConfigured() self::assertEquals('Geocode tt_address records', $subject->getDescription()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function geocodeServiceIsReturned() { $subject = $this->getAccessibleMock(GeocodeCommand::class, null, [], '', false); @@ -38,9 +34,7 @@ public function geocodeServiceIsReturned() self::assertInstanceOf(GeocodeService::class, $service); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function geocodingIsCalled() { $geocodeService = $this->getAccessibleMock(GeocodeService::class, ['calculateCoordinatesForAllRecordsInTable'], [], '', false); diff --git a/Tests/Unit/Controller/AddressControllerPaginationTest.php b/Tests/Unit/Controller/AddressControllerPaginationTest.php index 6c76c9837..63715e4df 100644 --- a/Tests/Unit/Controller/AddressControllerPaginationTest.php +++ b/Tests/Unit/Controller/AddressControllerPaginationTest.php @@ -13,21 +13,18 @@ use FriendsOfTYPO3\TtAddress\Domain\Model\Dto\Demand; use FriendsOfTYPO3\TtAddress\Domain\Model\Dto\Settings; use FriendsOfTYPO3\TtAddress\Domain\Repository\AddressRepository; +use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Pagination\PaginatorInterface; use TYPO3\CMS\Core\Pagination\SimplePagination; use TYPO3\CMS\Extbase\Mvc\Request; use TYPO3\CMS\Fluid\View\FluidViewAdapter; use TYPO3\CMS\Fluid\View\TemplateView; -use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; use TYPO3\TestingFramework\Core\BaseTestCase; class AddressControllerPaginationTest extends BaseTestCase { - - /** - * @test - */ + #[Test] public function listActionUsesNewPaginationWithArrayRecords() { if (!class_exists(SimplePagination::class)) { @@ -80,9 +77,7 @@ public function listActionUsesNewPaginationWithArrayRecords() $subject->listAction(); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function paginationIsCorrectlyTriggered() { if (!class_exists(SimplePagination::class)) { diff --git a/Tests/Unit/Controller/AddressControllerTest.php b/Tests/Unit/Controller/AddressControllerTest.php index 9459b77a4..3b6873cda 100644 --- a/Tests/Unit/Controller/AddressControllerTest.php +++ b/Tests/Unit/Controller/AddressControllerTest.php @@ -42,10 +42,8 @@ protected function setUp(): void $GLOBALS['TYPO3_REQUEST'] = $serverRequest; } - /** - * @test - * @dataProvider dotIsRemovedFromEndDataProvider - */ + #[\PHPUnit\Framework\Attributes\Test] + #[\PHPUnit\Framework\Attributes\DataProvider('dotIsRemovedFromEndDataProvider')] public function dotIsRemovedFromEnd($given, $expected) { $subject = $this->getAccessibleMock(AddressController::class, null, [], '', false); @@ -60,9 +58,7 @@ public static function dotIsRemovedFromEndDataProvider(): array ]; } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function dotsAreRemovedFromArray() { $subject = $this->getAccessibleMock(AddressController::class, null, [], '', false); @@ -87,9 +83,7 @@ public function dotsAreRemovedFromArray() self::assertEquals($expected, $subject->_call('removeDots', $given)); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function injectAddressRepositoryWorks() { $mockedRepository = $this->getAccessibleMock(AddressRepository::class, null, [], '', false); @@ -100,9 +94,7 @@ public function injectAddressRepositoryWorks() self::assertEquals($mockedRepository, $subject->_get('addressRepository')); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function pidListIsReturned() { $mockedPageRepsitory = $this->getAccessibleMock(PageRepository::class, ['getPageIdsRecursive'], [], '', false); @@ -121,9 +113,7 @@ public function pidListIsReturned() self::assertEquals([123, 456, 789], $subject->_call('getPidList')); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function settingsAreProperlyInjected() { self::markTestSkipped('Skipped until fixed'); @@ -167,9 +157,7 @@ public function settingsAreProperlyInjected() self::assertEquals($expectedSettings, $subject->_get('settings')); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function demandIsCreated() { $demand = new Demand(); @@ -193,9 +181,7 @@ public function demandIsCreated() self::assertEquals($expected, $subject->_call('createDemandFromSettings')); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function showActionFillsView() { $address = new Address(); @@ -216,9 +202,7 @@ public function showActionFillsView() $subject->showAction($address); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function listActionFillsViewForSingleRecords() { $settings = [ @@ -254,9 +238,7 @@ public function listActionFillsViewForSingleRecords() $subject->listAction(); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function listActionFillsViewForDemand() { $settings = [ @@ -292,9 +274,7 @@ public function listActionFillsViewForDemand() $subject->listAction(); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function overrideDemandMethodIsCalledIfEnabled() { $mockedRequest = $this->getAccessibleMock(Request::class, ['hasArgument', 'getArgument', 'getAttribute'], [], '', false); @@ -335,10 +315,8 @@ public function overrideDemandMethodIsCalledIfEnabled() $subject->listAction(['not', 'empty']); } - /** - * @test - * @dataProvider overrideDemandWorksDataProvider - */ + #[\PHPUnit\Framework\Attributes\Test] + #[\PHPUnit\Framework\Attributes\DataProvider('overrideDemandWorksDataProvider')] public function overrideDemandWorks(Demand $demandIn, Demand $demandOut, array $override) { $subject = $this->getAccessibleMock(AddressController::class, null, [], '', false); diff --git a/Tests/Unit/Domain/Model/AddressTest.php b/Tests/Unit/Domain/Model/AddressTest.php index 28a9818c6..afb335fcf 100644 --- a/Tests/Unit/Domain/Model/AddressTest.php +++ b/Tests/Unit/Domain/Model/AddressTest.php @@ -27,9 +27,7 @@ public function setup(): void $this->subject = new Address(); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function genderCanBeSet() { $value = 'm'; @@ -37,9 +35,7 @@ public function genderCanBeSet() self::assertEquals($value, $this->subject->getGender()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function nameCanBeSet() { $value = 'Max Mustermann'; @@ -47,9 +43,7 @@ public function nameCanBeSet() self::assertEquals($value, $this->subject->getName()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function firstNameCanBeSet() { $value = 'Max'; @@ -57,9 +51,7 @@ public function firstNameCanBeSet() self::assertEquals($value, $this->subject->getFirstName()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function middleNameCanBeSet() { $value = 'J.'; @@ -67,9 +59,7 @@ public function middleNameCanBeSet() self::assertEquals($value, $this->subject->getMiddleName()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function lastNameCanBeSet() { $value = 'Mustermann'; @@ -77,9 +67,7 @@ public function lastNameCanBeSet() self::assertEquals($value, $this->subject->getLastName()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function birthdayCanBeSet() { $value = new \DateTime(); @@ -87,9 +75,7 @@ public function birthdayCanBeSet() self::assertEquals($value, $this->subject->getBirthday()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function titleCanBeSet() { $value = 'dr.'; @@ -97,9 +83,7 @@ public function titleCanBeSet() self::assertEquals($value, $this->subject->getTitle()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function addressCanBeSet() { $value = 'Dummystreet 134'; @@ -107,9 +91,7 @@ public function addressCanBeSet() self::assertEquals($value, $this->subject->getAddress()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function latitudeCanBeSet() { $value = 123.121221; @@ -117,9 +99,7 @@ public function latitudeCanBeSet() self::assertEquals($value, $this->subject->getLatitude()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function longitudeCanBeSet() { $value = 10.1291; @@ -127,9 +107,7 @@ public function longitudeCanBeSet() self::assertEquals($value, $this->subject->getLongitude()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function buildingCanBeSet() { $value = 'building 1'; @@ -137,9 +115,7 @@ public function buildingCanBeSet() self::assertEquals($value, $this->subject->getBuilding()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function roomCanBeSet() { $value = 'room 1'; @@ -163,9 +139,7 @@ public static function telephoneFormatDataProvider() ]; } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function phoneCanBeSet() { $value = '+43129'; @@ -173,10 +147,8 @@ public function phoneCanBeSet() self::assertEquals($value, $this->subject->getPhone()); } - /** - * @test - * @dataProvider telephoneFormatDataProvider - */ + #[\PHPUnit\Framework\Attributes\Test] + #[\PHPUnit\Framework\Attributes\DataProvider('telephoneFormatDataProvider')] public function phoneWithCleanedChars($number, $expectedNumber) { $this->subject->setPhone($number); @@ -187,9 +159,7 @@ public function phoneWithCleanedChars($number, $expectedNumber) ); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function faxCanBeSet() { $value = '+431294'; @@ -197,10 +167,8 @@ public function faxCanBeSet() self::assertEquals($value, $this->subject->getFax()); } - /** - * @test - * @dataProvider telephoneFormatDataProvider - */ + #[\PHPUnit\Framework\Attributes\Test] + #[\PHPUnit\Framework\Attributes\DataProvider('telephoneFormatDataProvider')] public function faxWithCleanedChars($number, $expectedNumber) { $this->subject->setFax($number); @@ -211,9 +179,7 @@ public function faxWithCleanedChars($number, $expectedNumber) ); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function mobileCanBeSet() { $value = '+431294111'; @@ -221,10 +187,8 @@ public function mobileCanBeSet() self::assertEquals($value, $this->subject->getMobile()); } - /** - * @test - * @dataProvider telephoneFormatDataProvider - */ + #[\PHPUnit\Framework\Attributes\Test] + #[\PHPUnit\Framework\Attributes\DataProvider('telephoneFormatDataProvider')] public function mobileWithCleanedChars($number, $expectedNumber) { $this->subject->setMobile($number); @@ -235,9 +199,7 @@ public function mobileWithCleanedChars($number, $expectedNumber) ); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function wwwCanBeSet() { $value = 'www.typo3.org'; @@ -245,10 +207,8 @@ public function wwwCanBeSet() self::assertEquals($value, $this->subject->getWww()); } - /** - * @test - * @dataProvider simplifiedWwwIsReturnedDataProvider - */ + #[\PHPUnit\Framework\Attributes\Test] + #[\PHPUnit\Framework\Attributes\DataProvider('simplifiedWwwIsReturnedDataProvider')] public function simplifiedWwwIsReturned(string $given, string $expected) { $this->subject->setWww($given); @@ -266,9 +226,7 @@ public static function simplifiedWwwIsReturnedDataProvider() ]; } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function slugCanBeSet() { $value = '/testaddress/'; @@ -276,9 +234,7 @@ public function slugCanBeSet() self::assertEquals($value, $this->subject->getSlug()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function skypeCanBeSet() { $value = 'fo.com'; @@ -286,9 +242,7 @@ public function skypeCanBeSet() self::assertEquals($value, $this->subject->getSkype()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function twitterCanBeSet() { $value = '@georg_ringer'; @@ -296,9 +250,7 @@ public function twitterCanBeSet() self::assertEquals($value, $this->subject->getTwitter()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function wrongTwitterHandleThrowsErrorCanBeSet() { $this->expectException(\InvalidArgumentException::class); @@ -308,9 +260,7 @@ public function wrongTwitterHandleThrowsErrorCanBeSet() self::assertEquals($value, $this->subject->getTwitter()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function facebookCanBeSet() { $value = '/fo'; @@ -318,9 +268,7 @@ public function facebookCanBeSet() self::assertEquals($value, $this->subject->getFacebook()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function wrongFacebookHandleThrowsErrorCanBeSet() { $this->expectException(\InvalidArgumentException::class); @@ -330,9 +278,7 @@ public function wrongFacebookHandleThrowsErrorCanBeSet() self::assertEquals($value, $this->subject->getFacebook()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function linkedinCanBeSet() { $value = 'www.linkedin.com/bar'; @@ -340,9 +286,7 @@ public function linkedinCanBeSet() self::assertEquals($value, $this->subject->getLinkedin()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function emailCanBeSet() { $value = 'some@example.org'; @@ -350,9 +294,7 @@ public function emailCanBeSet() self::assertEquals($value, $this->subject->getEmail()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function companyCanBeSet() { $value = 'ACME'; @@ -360,9 +302,7 @@ public function companyCanBeSet() self::assertEquals($value, $this->subject->getCompany()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function positionCanBeSet() { $value = 'Boss'; @@ -370,9 +310,7 @@ public function positionCanBeSet() self::assertEquals($value, $this->subject->getPosition()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function cityCanBeSet() { $value = 'Linz'; @@ -380,9 +318,7 @@ public function cityCanBeSet() self::assertEquals($value, $this->subject->getCity()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function zipCanBeSet() { $value = '30210'; @@ -390,9 +326,7 @@ public function zipCanBeSet() self::assertEquals($value, $this->subject->getZip()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function regionCanBeSet() { $value = 'OOE'; @@ -400,9 +334,7 @@ public function regionCanBeSet() self::assertEquals($value, $this->subject->getRegion()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function countryCanBeSet() { $value = 'AT'; @@ -410,9 +342,7 @@ public function countryCanBeSet() self::assertEquals($value, $this->subject->getCountry()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function descriptionCanBeSet() { $value = 'lorem ipsum'; @@ -420,9 +350,7 @@ public function descriptionCanBeSet() self::assertEquals($value, $this->subject->getDescription()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function imagesCanBeSet() { $value = new ObjectStorage(); @@ -434,9 +362,7 @@ public function imagesCanBeSet() self::assertEquals($value, $this->subject->getImage()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function imagesCanBeAttached() { $value = new ObjectStorage(); @@ -453,9 +379,7 @@ public function imagesCanBeAttached() self::assertEquals(2, $this->subject->getImage()->count()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function firstImageCanBeRetrieved() { $value = new ObjectStorage(); @@ -471,9 +395,7 @@ public function firstImageCanBeRetrieved() self::assertEquals($item, $this->subject->getFirstImage()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function firstImageIsNullIfNoImages() { $value = new ObjectStorage(); @@ -482,9 +404,7 @@ public function firstImageIsNullIfNoImages() self::assertNull($this->subject->getFirstImage()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function imagesCanBeRemoved() { $value = new ObjectStorage(); @@ -502,9 +422,7 @@ public function imagesCanBeRemoved() self::assertEquals(1, $this->subject->getImage()->count()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function categoriesCanBeSet() { $value = new ObjectStorage(); @@ -516,10 +434,8 @@ public function categoriesCanBeSet() self::assertEquals($value, $this->subject->getCategories()); } - /** - * @test - * @dataProvider fullNameDataProvider - */ + #[\PHPUnit\Framework\Attributes\Test] + #[\PHPUnit\Framework\Attributes\DataProvider('fullNameDataProvider')] public function fullNameIsReturned(string $expected, array $nameParts): void { $this->subject->setTitle($nameParts[0]); diff --git a/Tests/Unit/Domain/Model/Dto/DemandTest.php b/Tests/Unit/Domain/Model/Dto/DemandTest.php index 3d74ff7b3..252dd6a8a 100644 --- a/Tests/Unit/Domain/Model/Dto/DemandTest.php +++ b/Tests/Unit/Domain/Model/Dto/DemandTest.php @@ -23,9 +23,7 @@ public function setup(): void $this->subject = new Demand(); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function pagesCanBeSet() { $value = ['123', '456']; @@ -33,9 +31,7 @@ public function pagesCanBeSet() self::assertEquals($value, $this->subject->getPages()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function sortByCanBeSet() { $value = 'title'; @@ -43,9 +39,7 @@ public function sortByCanBeSet() self::assertEquals($value, $this->subject->getSortBy()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function sortOrderCanBeSet() { $value = 'desc'; @@ -53,9 +47,7 @@ public function sortOrderCanBeSet() self::assertEquals($value, $this->subject->getSortOrder()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function categoriesCanBeSet() { $value = '12,34,5'; @@ -63,9 +55,7 @@ public function categoriesCanBeSet() self::assertEquals($value, $this->subject->getCategories()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function categoryCombinationCanBeSet() { $value = 'AND'; @@ -73,9 +63,7 @@ public function categoryCombinationCanBeSet() self::assertEquals($value, $this->subject->getCategoryCombination()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function singleRecordsCanBeSet() { $value = '7,6,1'; @@ -83,9 +71,7 @@ public function singleRecordsCanBeSet() self::assertEquals($value, $this->subject->getSingleRecords()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function includeSubCategoriesCanBeSet() { $value = true; @@ -93,9 +79,7 @@ public function includeSubCategoriesCanBeSet() self::assertEquals($value, $this->subject->getIncludeSubCategories()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function ignoreWithoutCoordinatesCanBeSet() { $value = true; diff --git a/Tests/Unit/Domain/Model/Dto/SettingsTest.php b/Tests/Unit/Domain/Model/Dto/SettingsTest.php index c58f5ba03..82a2fe1de 100644 --- a/Tests/Unit/Domain/Model/Dto/SettingsTest.php +++ b/Tests/Unit/Domain/Model/Dto/SettingsTest.php @@ -24,9 +24,7 @@ public function setUp(): void GeneralUtility::setSingletonInstance(PackageManager::class, $mockedPackageManager); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function defaultSettingsAreAvailable(): void { $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['tt_address'] = []; @@ -36,9 +34,7 @@ public function defaultSettingsAreAvailable(): void self::assertEquals('/[^\d\+\s\-]/g', $subject->getTelephoneValidationPatternForJs()); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function settingsAreSet(): void { $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['tt_address'] = [ diff --git a/Tests/Unit/Evaluation/LatitudeEvaluationTest.php b/Tests/Unit/Evaluation/LatitudeEvaluationTest.php index 21f64d4c8..9af4f90b3 100644 --- a/Tests/Unit/Evaluation/LatitudeEvaluationTest.php +++ b/Tests/Unit/Evaluation/LatitudeEvaluationTest.php @@ -22,28 +22,22 @@ public function setUp(): void $this->subject = new LatitudeEvaluation(); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function jsEvaluationIsCalled() { self::markTestSkipped('Skipped as PageRenderer is called which leads into issues'); self::assertNotEmpty($this->subject->returnFieldJS()); } - /** - * @test - * @dataProvider latIsProperlyEvaluatedDataProvider - */ + #[\PHPUnit\Framework\Attributes\Test] + #[\PHPUnit\Framework\Attributes\DataProvider('latIsProperlyEvaluatedDataProvider')] public function latitudeIsProperlyEvaluated($given, $expected) { self::assertEquals($expected, $this->subject->evaluateFieldValue($given)); } - /** - * @test - * @dataProvider latIsProperlyEvaluatedDataProvider - */ + #[\PHPUnit\Framework\Attributes\Test] + #[\PHPUnit\Framework\Attributes\DataProvider('latIsProperlyEvaluatedDataProvider')] public function latIsProperlyDeEvaluated($given, $expected) { $params = ['value' => $given]; diff --git a/Tests/Unit/Evaluation/LongitudeEvaluationTest.php b/Tests/Unit/Evaluation/LongitudeEvaluationTest.php index bde5d6093..140e8b336 100644 --- a/Tests/Unit/Evaluation/LongitudeEvaluationTest.php +++ b/Tests/Unit/Evaluation/LongitudeEvaluationTest.php @@ -22,28 +22,22 @@ public function setUp(): void $this->subject = new LongitudeEvaluation(); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function jsEvaluationIsCalled() { self::markTestSkipped('Skipped as PageRenderer is called which leads into issues'); self::assertNotEmpty($this->subject->returnFieldJS()); } - /** - * @test - * @dataProvider lngIsProperlyEvaluatedDataProvider - */ + #[\PHPUnit\Framework\Attributes\Test] + #[\PHPUnit\Framework\Attributes\DataProvider('lngIsProperlyEvaluatedDataProvider')] public function longIsProperlyEvaluated($given, $expected) { self::assertEquals($expected, $this->subject->evaluateFieldValue($given)); } - /** - * @test - * @dataProvider lngIsProperlyEvaluatedDataProvider - */ + #[\PHPUnit\Framework\Attributes\Test] + #[\PHPUnit\Framework\Attributes\DataProvider('lngIsProperlyEvaluatedDataProvider')] public function lngIsProperlyDeEvaluated($given, $expected) { $params = ['value' => $given]; diff --git a/Tests/Unit/Evaluation/TelephoneEvaluationTest.php b/Tests/Unit/Evaluation/TelephoneEvaluationTest.php index 843c7479e..bcc548abf 100644 --- a/Tests/Unit/Evaluation/TelephoneEvaluationTest.php +++ b/Tests/Unit/Evaluation/TelephoneEvaluationTest.php @@ -33,9 +33,7 @@ public function setUp(): void GeneralUtility::setSingletonInstance(PackageManager::class, $packageManager); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function constructorIsCalled() { $subject = $this->getAccessibleMock(TelephoneEvaluation::class, null, [], '', true); @@ -44,19 +42,15 @@ public function constructorIsCalled() self::assertEquals($settings, $subject->_get('extensionSettings')); } - /** - * @test - * @dataProvider telephoneIsProperlyEvaluatedDataProvider - */ + #[\PHPUnit\Framework\Attributes\Test] + #[\PHPUnit\Framework\Attributes\DataProvider('telephoneIsProperlyEvaluatedDataProvider')] public function telephoneIsProperlyEvaluated($given, $expected) { self::assertEquals($expected, $this->subject->evaluateFieldValue($given)); } - /** - * @test - * @dataProvider telephoneIsProperlyEvaluatedDataProvider - */ + #[\PHPUnit\Framework\Attributes\Test] + #[\PHPUnit\Framework\Attributes\DataProvider('telephoneIsProperlyEvaluatedDataProvider')] public function telephoneIsProperlyDeEvaluated($given, $expected): void { $params = ['value' => $given]; diff --git a/Tests/Unit/Hooks/Tca/AddFieldsToSelectorTest.php b/Tests/Unit/Hooks/Tca/AddFieldsToSelectorTest.php index 763497993..059e39d5a 100755 --- a/Tests/Unit/Hooks/Tca/AddFieldsToSelectorTest.php +++ b/Tests/Unit/Hooks/Tca/AddFieldsToSelectorTest.php @@ -16,9 +16,7 @@ class AddFieldsToSelectorTest extends BaseTestCase { - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function constructorIsCalled() { $languageService = $this->getAccessibleMock(LanguageService::class, null, [], '', false, false); @@ -28,9 +26,7 @@ public function constructorIsCalled() self::assertEquals($languageService, $subject->_get('languageService')); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function optionsAreFilled() { foreach (AddFieldsToSelector::sortFields as $sortField) { diff --git a/Tests/Unit/Seo/AddressTitleProviderTest.php b/Tests/Unit/Seo/AddressTitleProviderTest.php index 82e60cb5f..aa3a2abc2 100755 --- a/Tests/Unit/Seo/AddressTitleProviderTest.php +++ b/Tests/Unit/Seo/AddressTitleProviderTest.php @@ -17,10 +17,10 @@ class AddressTitleProviderTest extends BaseTestCase { /** - * @test - * @dataProvider addressTitleProvider * @param string[] $addressFields */ + #[\PHPUnit\Framework\Attributes\Test] + #[\PHPUnit\Framework\Attributes\DataProvider('addressTitleProvider')] public function correctTitleIsGenerated(string $expected, array $addressFields, array $configuration): void { $address = new Address(); diff --git a/Tests/Unit/Service/GeocodeServiceTest.php b/Tests/Unit/Service/GeocodeServiceTest.php index d39a2585a..501f600de 100644 --- a/Tests/Unit/Service/GeocodeServiceTest.php +++ b/Tests/Unit/Service/GeocodeServiceTest.php @@ -14,9 +14,7 @@ class GeocodeServiceTest extends BaseTestCase { - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function validAPiResultIsReturned() { self::markTestSkipped('Migrate prophesizy away'); @@ -35,9 +33,7 @@ public function validAPiResultIsReturned() self::assertEquals($content, $apiResponse); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function invalidAPiResultReturnsEmptyArray() { self::markTestSkipped('Migrate prophesizy away'); @@ -56,9 +52,7 @@ public function invalidAPiResultReturnsEmptyArray() self::assertEquals([], $apiResponse); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function wrongCacheThrowsException() { $this->expectException(\RuntimeException::class); diff --git a/Tests/Unit/Utility/CacheUtilityTest.php b/Tests/Unit/Utility/CacheUtilityTest.php index 1ecea3298..895ce0cff 100644 --- a/Tests/Unit/Utility/CacheUtilityTest.php +++ b/Tests/Unit/Utility/CacheUtilityTest.php @@ -19,9 +19,7 @@ class CacheUtilityTest extends BaseTestCase { - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function nonArrayRecordInstancesAreSkippedForCacheTags() { $addressRecords = ['dummy string']; @@ -40,9 +38,7 @@ public function nonArrayRecordInstancesAreSkippedForCacheTags() CacheUtility::addCacheTagsByAddressRecords($addressRecords); } - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function addressRecordWithLocalizedIdAddsCacheTags() { $addressRecord = new Address(); diff --git a/Tests/Unit/Utility/EvalcoordinatesUtilityTest.php b/Tests/Unit/Utility/EvalcoordinatesUtilityTest.php index 21e0f5712..17858e6ee 100644 --- a/Tests/Unit/Utility/EvalcoordinatesUtilityTest.php +++ b/Tests/Unit/Utility/EvalcoordinatesUtilityTest.php @@ -15,10 +15,8 @@ class EvalcoordinatesUtilityTest extends BaseTestCase { - /** - * @test - * @dataProvider longIsProperlyEvaluatedDataProvider - */ + #[\PHPUnit\Framework\Attributes\Test] + #[\PHPUnit\Framework\Attributes\DataProvider('longIsProperlyEvaluatedDataProvider')] public function longIsProperlyEvaluated($given, $expected) { self::assertEquals($expected, EvalcoordinatesUtility::formatLongitude($given)); @@ -36,10 +34,8 @@ public static function longIsProperlyEvaluatedDataProvider(): array ]; } - /** - * @test - * @dataProvider latIsProperlyEvaluatedDataProvider - */ + #[\PHPUnit\Framework\Attributes\Test] + #[\PHPUnit\Framework\Attributes\DataProvider('latIsProperlyEvaluatedDataProvider')] public function latIsProperlyEvaluated($given, $expected) { self::assertEquals($expected, EvalcoordinatesUtility::formatLatitude($given)); diff --git a/Tests/Unit/Utility/TypoScriptTest.php b/Tests/Unit/Utility/TypoScriptTest.php index a84770272..9d29c1170 100644 --- a/Tests/Unit/Utility/TypoScriptTest.php +++ b/Tests/Unit/Utility/TypoScriptTest.php @@ -15,9 +15,7 @@ class TypoScriptTest extends BaseTestCase { - /** - * @test - */ + #[\PHPUnit\Framework\Attributes\Test] public function tsIsOverloadedCorrectly() { $subject = new TypoScript(); diff --git a/Tests/Unit/ViewHelpers/StaticGoogleMapsViewHelperTest.php b/Tests/Unit/ViewHelpers/StaticGoogleMapsViewHelperTest.php index ec0815e63..6d0ce92fc 100644 --- a/Tests/Unit/ViewHelpers/StaticGoogleMapsViewHelperTest.php +++ b/Tests/Unit/ViewHelpers/StaticGoogleMapsViewHelperTest.php @@ -28,10 +28,8 @@ protected function setUp(): void $this->viewHelper->initializeArguments(); } - /** - * @test - * @dataProvider staticGoogleMapsViewHelpersIsCalledDataProvider - */ + #[\PHPUnit\Framework\Attributes\Test] + #[\PHPUnit\Framework\Attributes\DataProvider('staticGoogleMapsViewHelpersIsCalledDataProvider')] public function staticGoogleMapsViewHelpersIsCalled(array $parameters, $result) { self::markTestSkipped('turn into functional test'); From 526da3f6f2a9a71ef7a60270673c47a19184d0c9 Mon Sep 17 00:00:00 2001 From: Georg Ringer Date: Sat, 15 Nov 2025 21:36:52 +0100 Subject: [PATCH 5/7] [TASK] Raise cs-fixer minimum version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4ea62210b..284df1078 100755 --- a/composer.json +++ b/composer.json @@ -47,7 +47,7 @@ "typo3/testing-framework": "^8.0.9", "phpunit/phpunit": "^10.5.45", "typo3/coding-standards": "^0.5.3", - "friendsofphp/php-cs-fixer": "^3", + "friendsofphp/php-cs-fixer": "^v3.89.2", "kubawerlos/php-cs-fixer-custom-fixers": "^3.21", "webmozart/assert": "^1.11.0", "phpspec/prophecy": "^1.19 || ^2" From 7aa8a270328c498afb15b09c567bea0691feba37 Mon Sep 17 00:00:00 2001 From: Georg Ringer Date: Sat, 15 Nov 2025 21:43:47 +0100 Subject: [PATCH 6/7] [TASK] Raise phpunit min version for v14 --- Build/Scripts/runTests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Build/Scripts/runTests.sh b/Build/Scripts/runTests.sh index 5e7cf811f..04fa4fea8 100755 --- a/Build/Scripts/runTests.sh +++ b/Build/Scripts/runTests.sh @@ -519,7 +519,7 @@ case ${TEST_SUITE} in typo3/cms-core:dev-main \ typo3/cms-install:dev-main \ typo3/testing-framework:dev-main \ - phpunit/phpunit:^11 \ + phpunit/phpunit:^11.5.44 \ || exit 1 fi composer update --no-progress --no-interaction || exit 1 @@ -546,7 +546,7 @@ case ${TEST_SUITE} in typo3/cms-core:dev-main \ typo3/cms-install:dev-main \ typo3/testing-framework:dev-main \ - phpunit/phpunit:^11 \ + phpunit/phpunit:^11.5.44 \ || exit 1 fi composer update --no-ansi --no-interaction --no-progress --with-dependencies --prefer-lowest || exit 1 From 9550f2b28a3d359ed6d70b5fa3317a4c4aa3dfa6 Mon Sep 17 00:00:00 2001 From: Georg Ringer Date: Sat, 15 Nov 2025 21:59:08 +0100 Subject: [PATCH 7/7] [TASK] Raise minimum req for custom cs fixers --- Build/php-cs-fixer/php-cs-fixer.php | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Build/php-cs-fixer/php-cs-fixer.php b/Build/php-cs-fixer/php-cs-fixer.php index 881bd9c85..e0e99bf8e 100644 --- a/Build/php-cs-fixer/php-cs-fixer.php +++ b/Build/php-cs-fixer/php-cs-fixer.php @@ -78,7 +78,7 @@ 'class_attributes_separation' => ['elements' => ['method' => 'one']], 'class_definition' => true, 'single_class_element_per_statement' => true, - 'visibility_required' => true, + 'modifier_keywords' => ['elements' => ['const', 'method', 'property']], 'multiline_comment_opening_closing' => true, 'no_empty_comment' => true, 'single_line_comment_spacing' => true, diff --git a/composer.json b/composer.json index 284df1078..cff3ed1ca 100755 --- a/composer.json +++ b/composer.json @@ -48,7 +48,7 @@ "phpunit/phpunit": "^10.5.45", "typo3/coding-standards": "^0.5.3", "friendsofphp/php-cs-fixer": "^v3.89.2", - "kubawerlos/php-cs-fixer-custom-fixers": "^3.21", + "kubawerlos/php-cs-fixer-custom-fixers": "^3.35.1", "webmozart/assert": "^1.11.0", "phpspec/prophecy": "^1.19 || ^2" },