Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: TYPO3 v12 compatibility #15

Merged
merged 28 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
74a53b5
chore: v12
aoekrz Jun 19, 2024
9a85a7e
chore: v12
aoekrz Jun 19, 2024
eb7a2a1
refactor: code quality config
aoekrz Jun 19, 2024
8f40dc8
chore: typo3 testing framework
aoekrz Jun 19, 2024
85444f8
chore: PHP 8.1 required
aoekrz Jun 19, 2024
5294a39
test: parent setup
aoekrz Jun 19, 2024
19520be
test: go to csv
aoekrz Jun 19, 2024
5b40fdf
test: update testing framework and github workflows
aoekrz Jun 20, 2024
eb93fd1
refactor: code style
aoekrz Jun 20, 2024
7330066
refactor: code style
aoekrz Jun 20, 2024
09b2118
fix: scrutinizer config
aoekrz Jun 20, 2024
fdbeb67
fix: use existing exact php version
aoekrz Jun 20, 2024
8b4f80a
fix: use existing exact php version
aoekrz Jun 20, 2024
c772501
fix: probably scrutinizer
aoekrz Jun 20, 2024
e7ac1d1
chore: update dependencies
aoekrz Jun 20, 2024
e164436
docs: versions and support
aoekrz Jun 20, 2024
8974881
test: process timeout
aoekrz Jun 21, 2024
4ef09b6
Revert "test: process timeout"
aoekrz Jun 21, 2024
bfecd21
test: back to no process timeout
aoekrz Jun 21, 2024
3726ef7
test: checks for PHP 8.4
aoekrz Jun 21, 2024
4a5e251
Revert "test: checks for PHP 8.4"
aoekrz Jun 21, 2024
2478b51
docs: author
aoekrz Jul 5, 2024
0574ab5
test: show deprecations
aoekrz Jul 5, 2024
a99381d
chore: code style
aoekrz Jul 8, 2024
8a7cc23
chore: PHP 8.4 experimental
aoekrz Jul 8, 2024
72707a6
Revert "chore: PHP 8.4 experimental"
aoekrz Jul 8, 2024
be74270
fix: test config
aoekrz Jul 19, 2024
3b176be
chore: Fixed minor code-styles. Prepare for first v12 release
sourcesoldier Aug 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .code-quality/phpstan-baseline.neon

This file was deleted.

30 changes: 0 additions & 30 deletions .code-quality/rector-8_0.php

This file was deleted.

24 changes: 12 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
strategy:
fail-fast: false
matrix:
typo3: [ ^11.5 ]
php: [ '7.4', '8.0', '8.1', '8.2', '8.3' ]
typo3: [ ^12.4 ]
php: [ '8.1', '8.2', '8.3' ]
steps:

- name: Checkout
Expand All @@ -38,32 +38,32 @@ jobs:
- name: Validate composer.json and composer.lock
run: composer validate

- name: Install dependencies with nimut/typo3-complete:${{ matrix.typo3 }}
- name: Install dependencies with typo3/testing-framework
run: |
composer require --dev nimut/typo3-complete:${{ matrix.typo3 }} --no-progress
composer require --dev typo3/testing-framework --no-progress
git checkout composer.json
ln -nfs .Build/vendor/typo3/cms/typo3 typo3

- name: Lint PHP
run: find . -name \*.php ! -path "./.Build/*" ! -path "./scripts/*" ! -path "./typo3_src/*" | parallel --gnu php -d display_errors=stderr -l {} > /dev/null \;

- name: Unit Tests without coverage
if: matrix.typo3 != '^11.5' || matrix.php != '8.3'
if: matrix.typo3 == '^12.4' || matrix.php != '8.3'
run: |
export "UNIT_XML"=.Build/vendor/typo3/testing-framework/Resources/Core/Build/UnitTests.xml
.Build/bin/phpunit --colors -c $UNIT_XML Tests/Unit

- name: Unit Tests with coverage
if: matrix.typo3 == '^11.5' && matrix.php == '8.3'
if: matrix.typo3 == '^12.4' && matrix.php == '8.3'
run: |
export "UNIT_XML"=.Build/vendor/typo3/testing-framework/Resources/Core/Build/UnitTests-v10.xml
export "UNIT_XML"=.Build/vendor/typo3/testing-framework/Resources/Core/Build/UnitTests.xml
.Build/bin/phpunit --coverage-filter Classes --coverage-clover=unittest-coverage.clover --colors -c $UNIT_XML Tests/Unit/

- name: Functional Tests without coverage
run: |
export "FUNCTIONAL_XML"=.Build/vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTests.xml
.Build/bin/phpunit --colors -c $FUNCTIONAL_XML Tests/Functional
if: matrix.typo3 != '^11.5' || matrix.php != '8.3'
if: matrix.typo3 == '^12.4' || matrix.php != '8.3'
env:
typo3DatabaseHost: 127.0.0.1
typo3DatabaseName: typo3
Expand All @@ -72,9 +72,9 @@ jobs:

- name: Functional Tests with coverage
run: |
export "FUNCTIONAL_XML"=.Build/vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTests-v10.xml
export "FUNCTIONAL_XML"=.Build/vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTests.xml
find 'Tests/Functional' -wholename '*Test.php' | parallel --gnu 'echo; echo "Running functional test suite {}"; .Build/bin/phpunit --coverage-filter Classes --coverage-clover={}functionaltest-coverage.clover --colors -c $FUNCTIONAL_XML {}'
if: matrix.typo3 == '^11.5' && matrix.php == '8.3'
if: matrix.typo3 == '^12.4' && matrix.php == '8.3'
env:
typo3DatabaseHost: 127.0.0.1
typo3DatabaseName: typo3
Expand All @@ -83,6 +83,6 @@ jobs:

- name: Upload functional coverage results to Scrutinizer
uses: sudo-bot/action-scrutinizer@latest
if: matrix.typo3 == '^11.5' && matrix.php == '8.3'
if: matrix.typo3 == '^12.4' && matrix.php == '8.3'
with:
cli-args: "--format=php-clover functional-coverage.clover --revision=${{ github.event.pull_request.head.sha || github.sha }}"
cli-args: "--format=php-clover .Build/reports/php_all_tests/coverage_clover.xml --revision=${{ github.event.pull_request.head.sha || github.sha }}"
3 changes: 3 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
build:
nodes:
analysis:
image: default-bionic
environment:
php: 8.3.0
tests:
override:
- php-scrutinizer-run
Expand Down
12 changes: 5 additions & 7 deletions Classes/Command/AbstractCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/***************************************************************
* Copyright notice
*
* (c) 2021 AOE GmbH <[email protected]>
* (c) 2024 AOE GmbH <[email protected]>
*
* All rights reserved
*
Expand All @@ -32,22 +32,20 @@

abstract class AbstractCommand extends Command
{
protected FeatureFlagService $featureFlagService;

protected SymfonyStyle $inputOutput;

public function __construct(FeatureFlagService $featureFlagService)
{
public function __construct(
protected FeatureFlagService $featureFlagService
) {
parent::__construct();
$this->featureFlagService = $featureFlagService;
}

/**
* Enable or disable features. $features can be a comma-separated list of feature names
*/
protected function setFeatureStatus(string $features, bool $enabled): void
{
$features = array_map('trim', explode(',', $features));
$features = array_map(trim(...), explode(',', $features));
foreach ($features as $feature) {
$info = ($enabled) ? 'Activate' : 'Deactivate';
$this->showInfo($info . ' feature: ' . $feature);
Expand Down
2 changes: 1 addition & 1 deletion Classes/Command/ActivateFeatureFlagCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/***************************************************************
* Copyright notice
*
* (c) 2021 AOE GmbH <[email protected]>
* (c) 2024 AOE GmbH <[email protected]>
*
* All rights reserved
*
Expand Down
2 changes: 1 addition & 1 deletion Classes/Command/DeactivateFeatureFlagCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/***************************************************************
* Copyright notice
*
* (c) 2021 AOE GmbH <[email protected]>
* (c) 2024 AOE GmbH <[email protected]>
*
* All rights reserved
*
Expand Down
2 changes: 1 addition & 1 deletion Classes/Command/ToggleRecordsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/***************************************************************
* Copyright notice
*
* (c) 2021 AOE GmbH <[email protected]>
* (c) 2024 AOE GmbH <[email protected]>
*
* All rights reserved
*
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Model/FeatureFlag.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/***************************************************************
* Copyright notice
*
* (c) 2021 AOE GmbH <[email protected]>
* (c) 2024 AOE GmbH <[email protected]>
*
* All rights reserved
*
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Model/Mapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/***************************************************************
* Copyright notice
*
* (c) 2021 AOE GmbH <[email protected]>
* (c) 2024 AOE GmbH <[email protected]>
*
* All rights reserved
*
Expand Down
14 changes: 5 additions & 9 deletions Classes/Domain/Repository/FeatureFlagRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/***************************************************************
* Copyright notice
*
* (c) 2021 AOE GmbH <[email protected]>
* (c) 2024 AOE GmbH <[email protected]>
*
* All rights reserved
*
Expand All @@ -29,19 +29,15 @@
use Aoe\FeatureFlag\Service\FeatureFlagService;
use Aoe\FeatureFlag\System\Db\FeatureFlagData;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings;
use TYPO3\CMS\Extbase\Persistence\Repository;

class FeatureFlagRepository extends Repository
{
private FeatureFlagData $featureFlagData;

public function __construct(FeatureFlagData $featureFlagData)
{
$this->featureFlagData = $featureFlagData;
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
parent::__construct($objectManager);
public function __construct(
private readonly FeatureFlagData $featureFlagData
) {
parent::__construct();
}

public function initializeObject(): void
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Repository/MappingRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/***************************************************************
* Copyright notice
*
* (c) 2021 AOE GmbH <[email protected]>
* (c) 2024 AOE GmbH <[email protected]>
*
* All rights reserved
*
Expand Down
2 changes: 1 addition & 1 deletion Classes/Form/Element/AbstractFormSelectElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/***************************************************************
* Copyright notice
*
* (c) 2021 AOE GmbH <[email protected]>
* (c) 2024 AOE GmbH <[email protected]>
*
* All rights reserved
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/***************************************************************
* Copyright notice
*
* (c) 2021 AOE GmbH <[email protected]>
* (c) 2024 AOE GmbH <[email protected]>
*
* All rights reserved
*
Expand Down
2 changes: 1 addition & 1 deletion Classes/Form/Element/FeatureFlagFormSelectElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/***************************************************************
* Copyright notice
*
* (c) 2021 AOE GmbH <[email protected]>
* (c) 2024 AOE GmbH <[email protected]>
*
* All rights reserved
*
Expand Down
2 changes: 1 addition & 1 deletion Classes/Form/Element/InfoTextElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/***************************************************************
* Copyright notice
*
* (c) 2021 AOE GmbH <[email protected]>
* (c) 2024 AOE GmbH <[email protected]>
*
* All rights reserved
*
Expand Down
2 changes: 1 addition & 1 deletion Classes/Service/Exception/FeatureNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/***************************************************************
* Copyright notice
*
* (c) 2021 AOE GmbH <[email protected]>
* (c) 2024 AOE GmbH <[email protected]>
*
* All rights reserved
*
Expand Down
17 changes: 4 additions & 13 deletions Classes/Service/FeatureFlagService.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/***************************************************************
* Copyright notice
*
* (c) 2021 AOE GmbH <[email protected]>
* (c) 2024 AOE GmbH <[email protected]>
*
* All rights reserved
*
Expand Down Expand Up @@ -44,22 +44,13 @@ class FeatureFlagService
*/
public const BEHAVIOR_SHOW = 1;

private FeatureFlagRepository $featureFlagRepository;

private PersistenceManagerInterface $persistenceManager;

private Configuration $configuration;

private array $cachedFlags = [];

public function __construct(
FeatureFlagRepository $featureFlagRepository,
PersistenceManagerInterface $persistenceManager,
Configuration $configuration
private readonly FeatureFlagRepository $featureFlagRepository,
private readonly PersistenceManagerInterface $persistenceManager,
private readonly Configuration $configuration
) {
$this->featureFlagRepository = $featureFlagRepository;
$this->persistenceManager = $persistenceManager;
$this->configuration = $configuration;
}

public function isFeatureEnabled(string $flag): bool
Expand Down
10 changes: 5 additions & 5 deletions Classes/System/Db/FeatureFlagData.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/***************************************************************
* Copyright notice
*
* (c) 2021 AOE GmbH <[email protected]>
* (c) 2024 AOE GmbH <[email protected]>
*
* All rights reserved
*
Expand Down Expand Up @@ -59,7 +59,7 @@ public function getContentElements(string $table, int $behavior, int $enabled):
->from(self::TABLE_FLAGS)
->where(
$queryBuilder->expr()
->andX(
->and(
$queryBuilder->expr()
->eq(
self::TABLE_MAPPING . '.feature_flag',
Expand Down Expand Up @@ -88,7 +88,7 @@ public function getContentElements(string $table, int $behavior, int $enabled):
)
);

return $queryBuilder->execute()
return $queryBuilder->executeQuery()
->fetchAllAssociative();
}

Expand All @@ -106,7 +106,7 @@ public function updateContentElements(string $table, array $uids, bool $isVisibl
->set('hidden', $isVisible ? 0 : 1)
->add('where', $queryBuilder->expr()->in('uid', $uids));

$query->execute();
$query->executeStatement();
}

public function getContentElementsPIDs(string $table, int $uid): string
Expand All @@ -129,7 +129,7 @@ public function getContentElementsPIDs(string $table, int $uid): string
)
);

return $query->execute()
return $query->executeQuery()
->fetchOne();
}
}
4 changes: 2 additions & 2 deletions Classes/System/Typo3/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/***************************************************************
* Copyright notice
*
* (c) 2021 AOE GmbH <[email protected]>
* (c) 2024 AOE GmbH <[email protected]>
*
* All rights reserved
*
Expand Down Expand Up @@ -49,7 +49,7 @@ public function __construct(ExtensionConfiguration $extensionConfiguration)

public function getTables(): array
{
return explode(',', $this->get(self::CONF_TABLES));
return explode(',', (string) $this->get(self::CONF_TABLES));
}

/**
Expand Down
Loading