diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 064aaac..7dc31eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,19 +2,20 @@ name: ci on: [ push, pull_request ] jobs: ci: - name: Tests with PHP${{ matrix.php }} + name: Tests with TYPO3 ${{ matrix.typo3 }} PHP ${{ matrix.php }} runs-on: ubuntu-20.04 strategy: matrix: - typo3: [ '^11.5', '^12.1' ] - php: [ '8.0', '8.1' ] + typo3: [ '^11.5', '^12.4' ] + php: [ '8.0', '8.1', '8.2' ] exclude: - typo3: '^11.5' php: '8.1' - - typo3: '^12.1' - php: '7.4' - - typo3: '^12.1' + - typo3: '^11.5' + php: '8.2' + - typo3: '^12.4' php: '8.0' + steps: - name: Checkout repository uses: actions/checkout@v2 @@ -54,15 +55,15 @@ jobs: - name: Psalm run: composer run ci:psalm - if: matrix.typo3 == '^11.5' + if: matrix.typo3 == '^12.4' - name: PHPStan run: composer run ci:stan - if: matrix.typo3 == '^11.5' + if: matrix.typo3 == '^12.4' #- name: Unit tests # run: composer run ci:tests:unit:cover + # if: matrix.typo3 == '^12.4' - name: Functional tests run: composer run ci:tests:functional - if: matrix.typo3 == '^11.5' diff --git a/CHANGELOG.md b/CHANGELOG.md index 9878b70..fd77813 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,41 @@ # Changelog -## 2.1.2 (2023-08-14) +## 2.1.3 (2023-08-17) + +### Tasks + +* TYPO3 12 LTS Compatibility #21 (#23) [Ralf Zimmermann] + + * [TASK] TYPO3 12 LTS Compatibility #21 + + * [TASK] Fix ci + +### Other + +* Merge tag '2.1.2' into develop. [waldhacker1] + + 2.1.2 + + +## 2.1.2 (2023-08-16) + +### Tasks + +* Version 2.1.2. [waldhacker1] + +* Fix ci. [waldhacker1] + +* TYPO3 12 LTS Compatibility #21. [waldhacker1] ### Other +* Merge branch 'release/2.1.2' into main. [waldhacker1] + * [SECURITY] - Prohibit empty values in validator. [waldhacker1] +* [REVERT] TYPO3 12 LTS Compatibility #21. [waldhacker1] + * Merge tag '2.1.1' into develop. [waldhacker1] 2.1.1 diff --git a/Documentation/Changelog.rst b/Documentation/Changelog.rst index 7dbccbc..60c07b9 100644 --- a/Documentation/Changelog.rst +++ b/Documentation/Changelog.rst @@ -2,12 +2,38 @@ Changelog ========= -2.1.2 (2023-08-14) +2.1.3 (2023-08-17) ------------------ +Tasks +~~~~~ +- TYPO3 12 LTS Compatibility #21 (#23) [Ralf Zimmermann] + + * [TASK] TYPO3 12 LTS Compatibility #21 + + * [TASK] Fix ci + +Other +~~~~~ +- Merge tag '2.1.2' into develop. [waldhacker1] + + 2.1.2 + + +2.1.2 (2023-08-16) +------------------ + +Tasks +~~~~~ +- Version 2.1.2. [waldhacker1] +- Fix ci. [waldhacker1] +- TYPO3 12 LTS Compatibility #21. [waldhacker1] + Other ~~~~~ +- Merge branch 'release/2.1.2' into main. [waldhacker1] - [SECURITY] - Prohibit empty values in validator. [waldhacker1] +- [REVERT] TYPO3 12 LTS Compatibility #21. [waldhacker1] - Merge tag '2.1.1' into develop. [waldhacker1] 2.1.1 diff --git a/Documentation/Settings.cfg b/Documentation/Settings.cfg index 96b7066..9087754 100644 --- a/Documentation/Settings.cfg +++ b/Documentation/Settings.cfg @@ -25,7 +25,7 @@ project = hCaptcha # ... (recommended) version, displayed next to title (desktop) and in strEndsWith($elementData['name'], '[__state]')) { $prefix = key(ArrayUtility::flatten($nameStruct)); $prefixItems = explode('.', $prefix); array_pop($prefixItems); @@ -131,4 +130,10 @@ private function getPostStructure(): array return $postStructure; } + + private function strEndsWith(string $haystack, string $needle): bool + { + $needleLength = strlen($needle); + return $needleLength === 0 || substr_compare($haystack, $needle, - $needleLength) === 0; + } } diff --git a/Tests/Functional/FunctionalTestCase.php b/Tests/Functional/FunctionalTestCase.php index b539f58..eb0af33 100644 --- a/Tests/Functional/FunctionalTestCase.php +++ b/Tests/Functional/FunctionalTestCase.php @@ -123,12 +123,15 @@ protected function tearDown(): void protected function setUpDatabase(): void { - $backendUser = $this->setUpBackendUserFromFixture(1); + $this->importCSVDataSet(__DIR__ . '/Fixtures/Frontend/be_users.csv'); + $backendUser = $this->setUpBackendUser(1); + Bootstrap::initializeLanguageObject(); $factory = DataHandlerFactory::fromYamlFile($this->databaseScenarioFile); $writer = DataHandlerWriter::withBackendUser($backendUser); $writer->invokeFactory($factory); + static::failIfArrayIsNotEmpty( $writer->getErrors() ); diff --git a/Tests/Functional/SiteHandling/SiteBasedTestTrait.php b/Tests/Functional/SiteHandling/SiteBasedTestTrait.php index 1d220ac..7e2e528 100644 --- a/Tests/Functional/SiteHandling/SiteBasedTestTrait.php +++ b/Tests/Functional/SiteHandling/SiteBasedTestTrait.php @@ -17,8 +17,10 @@ namespace Waldhacker\Hcaptcha\Tests\Functional\SiteHandling; +use Psr\EventDispatcher\EventDispatcherInterface; use TYPO3\CMS\Core\Configuration\SiteConfiguration; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Core\Utility\VersionNumberUtility; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\Internal\AbstractInstruction; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\Internal\ArrayValueInstruction; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\Internal\TypoScriptInstruction; @@ -67,10 +69,19 @@ protected function writeSiteConfiguration( if (!empty($errorHandling)) { $configuration['errorHandling'] = $errorHandling; } - $siteConfiguration = new SiteConfiguration( - $this->instancePath . '/typo3conf/sites/', - $this->getContainer()->get('cache.core') - ); + + if ($this->isV11Branch()) { + $siteConfiguration = new SiteConfiguration( + $this->instancePath . '/typo3conf/sites/', + $this->getContainer()->get('cache.core') + ); + } else { + $siteConfiguration = new SiteConfiguration( + $this->instancePath . '/typo3conf/sites/', + GeneralUtility::makeInstance(EventDispatcherInterface::class), + $this->getContainer()->get('cache.core') + ); + } try { // ensure no previous site configuration influences the test @@ -89,10 +100,19 @@ protected function mergeSiteConfiguration( string $identifier, array $overrides ): void { - $siteConfiguration = new SiteConfiguration( - $this->instancePath . '/typo3conf/sites/', - $this->getContainer()->get('cache.core') - ); + if ($this->isV11Branch()) { + $siteConfiguration = new SiteConfiguration( + $this->instancePath . '/typo3conf/sites/', + $this->getContainer()->get('cache.core') + ); + } else { + $siteConfiguration = new SiteConfiguration( + $this->instancePath . '/typo3conf/sites/', + GeneralUtility::makeInstance(EventDispatcherInterface::class), + $this->getContainer()->get('cache.core') + ); + } + $configuration = $siteConfiguration->load($identifier); $configuration = array_merge($configuration, $overrides); try { @@ -307,4 +327,9 @@ protected function mergeInstruction(AbstractInstruction $current, AbstractInstru return $current; } + + private function isV11Branch(): bool + { + return (int)VersionNumberUtility::convertVersionStringToArray(VersionNumberUtility::getCurrentTypo3Version())['version_main'] === 11; + } } diff --git a/build/phpstan.baseline.neon b/build/phpstan.baseline.neon index aab4991..430613a 100644 --- a/build/phpstan.baseline.neon +++ b/build/phpstan.baseline.neon @@ -1,2 +1,16 @@ parameters: - ignoreErrors: [] + ignoreErrors: + - + message: "#^Method Waldhacker\\\\Hcaptcha\\\\Validation\\\\HcaptchaValidator\\:\\:translateErrorMessage\\(\\) has parameter \\$arguments with no type specified\\.$#" + count: 1 + path: ../Classes/Validation/HcaptchaValidator.php + + - + message: "#^Method Waldhacker\\\\Hcaptcha\\\\Validation\\\\HcaptchaValidator\\:\\:translateErrorMessage\\(\\) has parameter \\$extensionName with no type specified\\.$#" + count: 1 + path: ../Classes/Validation/HcaptchaValidator.php + + - + message: "#^Method Waldhacker\\\\Hcaptcha\\\\Validation\\\\HcaptchaValidator\\:\\:translateErrorMessage\\(\\) has parameter \\$translateKey with no type specified\\.$#" + count: 1 + path: ../Classes/Validation/HcaptchaValidator.php diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml index a2a4495..7357dc7 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -1,5 +1,5 @@ - + ConfigurationManager::CONFIGURATION_TYPE_SETTINGS diff --git a/composer.json b/composer.json index 61ca450..aad649e 100644 --- a/composer.json +++ b/composer.json @@ -18,12 +18,12 @@ "prefer-stable": true, "minimum-stability": "dev", "require": { - "php": "^7.2 | ^8.0 | ^8.1", + "php": "^7.2 | ^8.0 | ^8.1 | ^8.2", "ext-json": "*", - "typo3/cms-core": "^10.4@dev || ^11.5@dev || ^12.1@dev", - "typo3/cms-extbase": "^10.4@dev || ^11.5@dev || ^12.1@dev", - "typo3/cms-fluid": "^10.4@dev || ^11.5@dev || ^12.1@dev", - "typo3/cms-form": "^10.4@dev || ^11.5@dev || ^12.1@dev" + "typo3/cms-core": "^10.4@dev || ^11.5@dev || ^12.4@dev", + "typo3/cms-extbase": "^10.4@dev || ^11.5@dev || ^12.4@dev", + "typo3/cms-fluid": "^10.4@dev || ^11.5@dev || ^12.4@dev", + "typo3/cms-form": "^10.4@dev || ^11.5@dev || ^12.4@dev" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.16 | ^3.13", diff --git a/ext_emconf.php b/ext_emconf.php index dfaad2a..1b0db5d 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -10,13 +10,13 @@ 'state' => 'stable', 'uploadfolder' => '0', 'clearCacheOnLoad' => 1, - 'version' => '2.1.2', + 'version' => '2.1.3', 'constraints' => [ 'depends' => [ - 'extbase' => '10.4.0-12.1.99', - 'fluid' => '10.4.0-12.1.99', - 'form' => '10.4.0-12.1.99', - 'typo3' => '10.4.0-12.1.99', + 'extbase' => '10.4.0-12.4.99', + 'fluid' => '10.4.0-12.4.99', + 'form' => '10.4.0-12.4.99', + 'typo3' => '10.4.0-12.4.99', ], ], ];