Skip to content

Commit

Permalink
Merge branch 'release/2.1.3' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
waldhacker1 committed Aug 17, 2023
2 parents 0668e14 + abfd187 commit 7ec64d6
Show file tree
Hide file tree
Showing 12 changed files with 142 additions and 35 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/ci.yml
Expand Up @@ -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
Expand Down Expand Up @@ -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'
31 changes: 30 additions & 1 deletion 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
Expand Down
28 changes: 27 additions & 1 deletion Documentation/Changelog.rst
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Documentation/Settings.cfg
Expand Up @@ -25,7 +25,7 @@ project = hCaptcha
# ... (recommended) version, displayed next to title (desktop) and in <meta name="book-version"
# .................................................................................

release = 2.1.2
release = 2.1.3

# .................................................................................
# ... (recommended) displayed in footer
Expand Down
4 changes: 4 additions & 0 deletions Tests/Functional/Fixtures/Frontend/be_users.csv
@@ -0,0 +1,4 @@
"be_users"
,"uid","pid","tstamp","username","password","admin","disable","starttime","endtime","options","crdate","workspace_perms","deleted","TSconfig","lastlogin","workspace_id"
# The password is "password"
,1,0,1366642540,"admin","$1$tCrlLajZ$C0sikFQQ3SWaFAZ1Me0Z/1",1,0,0,0,0,1366642540,1,0,,1371033743,0
9 changes: 7 additions & 2 deletions Tests/Functional/Form/DataPusher.php
Expand Up @@ -19,7 +19,6 @@
namespace Waldhacker\Hcaptcha\Tests\Functional\Form;

use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;

class DataPusher
Expand Down Expand Up @@ -104,7 +103,7 @@ private function getPostStructure(): array
parse_str(sprintf('%s=%s', $elementData['name'], $elementData['value'] ?? ''), $nameStruct);
$postStructure = array_replace_recursive($postStructure, $nameStruct);

if (StringUtility::endsWith($elementData['name'], '[__state]')) {
if ($this->strEndsWith($elementData['name'], '[__state]')) {
$prefix = key(ArrayUtility::flatten($nameStruct));
$prefixItems = explode('.', $prefix);
array_pop($prefixItems);
Expand All @@ -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;
}
}
5 changes: 4 additions & 1 deletion Tests/Functional/FunctionalTestCase.php
Expand Up @@ -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()
);
Expand Down
41 changes: 33 additions & 8 deletions Tests/Functional/SiteHandling/SiteBasedTestTrait.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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;
}
}
16 changes: 15 additions & 1 deletion 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
2 changes: 1 addition & 1 deletion build/psalm-baseline.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.6.0@e784128902dfe01d489c4123d69918a9f3c1eac5">
<files psalm-version="5.14.1@b9d355e0829c397b9b3b47d0c0ed042a8a70284d">
<file src="Classes/Service/ConfigurationService.php">
<InternalClass>
<code>ConfigurationManager::CONFIGURATION_TYPE_SETTINGS</code>
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Expand Up @@ -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",
Expand Down
10 changes: 5 additions & 5 deletions ext_emconf.php
Expand Up @@ -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',
],
],
];

0 comments on commit 7ec64d6

Please sign in to comment.