diff --git a/.code-quality/phpstan-baseline.neon b/.code-quality/phpstan-baseline.neon deleted file mode 100644 index c0f6696..0000000 --- a/.code-quality/phpstan-baseline.neon +++ /dev/null @@ -1,12 +0,0 @@ -parameters: - ignoreErrors: - - - message: "#^Method TYPO3\\\\CMS\\\\Extbase\\\\Persistence\\\\QueryInterface\\:\\:logicalAnd\\(\\) invoked with 2 parameters, 1 required\\.$#" - count: 1 - path: ../Classes/Domain/Repository/MappingRepository.php - - - - message: "#^Constant LF not found\\.$#" - count: 3 - path: ../Classes/Form/Element/AbstractFormSelectElement.php - diff --git a/.code-quality/rector-8_0.php b/.code-quality/rector-8_0.php deleted file mode 100644 index 623b419..0000000 --- a/.code-quality/rector-8_0.php +++ /dev/null @@ -1,30 +0,0 @@ -parameters(); - $parameters->set( - Option::PATHS, - [ - __DIR__ . '/../Classes', - __DIR__ . '/../Tests', - __DIR__ . '/rector.php', - __DIR__ . '/rector-8_0.php', - ] - ); - - $containerConfigurator->import(SetList::PHP_81); - - $parameters->set(Option::AUTO_IMPORT_NAMES, false); - $parameters->set(Option::AUTOLOAD_PATHS, [__DIR__ . '/../Classes']); - $parameters->set(Option::SKIP, []); - - $services = $containerConfigurator->services(); - $services->set(RemoveUnusedPrivatePropertyRector::class); -}; diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4159c0b..f295d0e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 @@ -38,9 +38,9 @@ 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 @@ -48,22 +48,22 @@ jobs: 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 @@ -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 @@ -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 }}" \ No newline at end of file diff --git a/.scrutinizer.yml b/.scrutinizer.yml index f3e5a14..ed51821 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,6 +1,9 @@ build: nodes: analysis: + image: default-bionic + environment: + php: 8.3.0 tests: override: - php-scrutinizer-run diff --git a/Classes/Command/AbstractCommand.php b/Classes/Command/AbstractCommand.php index 181580b..e0d04ea 100644 --- a/Classes/Command/AbstractCommand.php +++ b/Classes/Command/AbstractCommand.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * @@ -32,14 +32,12 @@ 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; } /** @@ -47,7 +45,7 @@ public function __construct(FeatureFlagService $featureFlagService) */ 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); diff --git a/Classes/Command/ActivateFeatureFlagCommand.php b/Classes/Command/ActivateFeatureFlagCommand.php index b6d8f6d..57be8d5 100644 --- a/Classes/Command/ActivateFeatureFlagCommand.php +++ b/Classes/Command/ActivateFeatureFlagCommand.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * diff --git a/Classes/Command/DeactivateFeatureFlagCommand.php b/Classes/Command/DeactivateFeatureFlagCommand.php index a1a3e5a..6e9e55e 100644 --- a/Classes/Command/DeactivateFeatureFlagCommand.php +++ b/Classes/Command/DeactivateFeatureFlagCommand.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * diff --git a/Classes/Command/ToggleRecordsCommand.php b/Classes/Command/ToggleRecordsCommand.php index 5aadefc..5df5d11 100644 --- a/Classes/Command/ToggleRecordsCommand.php +++ b/Classes/Command/ToggleRecordsCommand.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * diff --git a/Classes/Domain/Model/FeatureFlag.php b/Classes/Domain/Model/FeatureFlag.php index 076c6c3..9d4fcf3 100644 --- a/Classes/Domain/Model/FeatureFlag.php +++ b/Classes/Domain/Model/FeatureFlag.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * diff --git a/Classes/Domain/Model/Mapping.php b/Classes/Domain/Model/Mapping.php index bdac721..caf04f4 100644 --- a/Classes/Domain/Model/Mapping.php +++ b/Classes/Domain/Model/Mapping.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * diff --git a/Classes/Domain/Repository/FeatureFlagRepository.php b/Classes/Domain/Repository/FeatureFlagRepository.php index 3bfb3fd..ff86295 100644 --- a/Classes/Domain/Repository/FeatureFlagRepository.php +++ b/Classes/Domain/Repository/FeatureFlagRepository.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * @@ -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 diff --git a/Classes/Domain/Repository/MappingRepository.php b/Classes/Domain/Repository/MappingRepository.php index e7cd262..1008181 100644 --- a/Classes/Domain/Repository/MappingRepository.php +++ b/Classes/Domain/Repository/MappingRepository.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * diff --git a/Classes/Form/Element/AbstractFormSelectElement.php b/Classes/Form/Element/AbstractFormSelectElement.php index 403bcff..079fa08 100644 --- a/Classes/Form/Element/AbstractFormSelectElement.php +++ b/Classes/Form/Element/AbstractFormSelectElement.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * diff --git a/Classes/Form/Element/FeatureFlagBehaviourFormSelectElement.php b/Classes/Form/Element/FeatureFlagBehaviourFormSelectElement.php index 9daedd3..68dc1d4 100644 --- a/Classes/Form/Element/FeatureFlagBehaviourFormSelectElement.php +++ b/Classes/Form/Element/FeatureFlagBehaviourFormSelectElement.php @@ -8,7 +8,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * diff --git a/Classes/Form/Element/FeatureFlagFormSelectElement.php b/Classes/Form/Element/FeatureFlagFormSelectElement.php index 9b6a965..e1063e7 100644 --- a/Classes/Form/Element/FeatureFlagFormSelectElement.php +++ b/Classes/Form/Element/FeatureFlagFormSelectElement.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * diff --git a/Classes/Form/Element/InfoTextElement.php b/Classes/Form/Element/InfoTextElement.php index fc1f42a..f589b26 100644 --- a/Classes/Form/Element/InfoTextElement.php +++ b/Classes/Form/Element/InfoTextElement.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * diff --git a/Classes/Service/Exception/FeatureNotFoundException.php b/Classes/Service/Exception/FeatureNotFoundException.php index 8bd8443..b09b747 100644 --- a/Classes/Service/Exception/FeatureNotFoundException.php +++ b/Classes/Service/Exception/FeatureNotFoundException.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * diff --git a/Classes/Service/FeatureFlagService.php b/Classes/Service/FeatureFlagService.php index 95f2c54..331c2f1 100644 --- a/Classes/Service/FeatureFlagService.php +++ b/Classes/Service/FeatureFlagService.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * @@ -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 diff --git a/Classes/System/Db/FeatureFlagData.php b/Classes/System/Db/FeatureFlagData.php index 9399374..9865ebf 100644 --- a/Classes/System/Db/FeatureFlagData.php +++ b/Classes/System/Db/FeatureFlagData.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * @@ -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', @@ -88,7 +88,7 @@ public function getContentElements(string $table, int $behavior, int $enabled): ) ); - return $queryBuilder->execute() + return $queryBuilder->executeQuery() ->fetchAllAssociative(); } @@ -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 @@ -129,7 +129,7 @@ public function getContentElementsPIDs(string $table, int $uid): string ) ); - return $query->execute() + return $query->executeQuery() ->fetchOne(); } } diff --git a/Classes/System/Typo3/Configuration.php b/Classes/System/Typo3/Configuration.php index d0158a3..6449f8e 100644 --- a/Classes/System/Typo3/Configuration.php +++ b/Classes/System/Typo3/Configuration.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * @@ -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)); } /** diff --git a/Classes/System/Typo3/TCA.php b/Classes/System/Typo3/TCA.php index bdd0676..4f6ff28 100644 --- a/Classes/System/Typo3/TCA.php +++ b/Classes/System/Typo3/TCA.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * diff --git a/Classes/System/Typo3/TcaPostProcessor.php b/Classes/System/Typo3/TcaPostProcessor.php index 76f809b..eac2835 100644 --- a/Classes/System/Typo3/TcaPostProcessor.php +++ b/Classes/System/Typo3/TcaPostProcessor.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * @@ -87,7 +87,7 @@ private function getTcaTablesWithFeatureFlagSupport(): array $config = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('feature_flag'); if (isset($config['tables'])) { - return explode(',', $config['tables']); + return explode(',', (string) $config['tables']); } return []; diff --git a/Configuration/TCA/tx_featureflag_domain_model_featureflag.php b/Configuration/TCA/tx_featureflag_domain_model_featureflag.php index 75d528a..d2e31bb 100644 --- a/Configuration/TCA/tx_featureflag_domain_model_featureflag.php +++ b/Configuration/TCA/tx_featureflag_domain_model_featureflag.php @@ -21,7 +21,8 @@ 'config' => [ 'type' => 'input', 'size' => 30, - 'eval' => 'trim,required' + 'eval' => 'trim', + 'required' => true, ], ], 'flag' => [ @@ -30,7 +31,8 @@ 'config' => [ 'type' => 'input', 'size' => 30, - 'eval' => 'alphanum_x,trim,required,unique' + 'eval' => 'alphanum_x,trim,unique', + 'required' => true, ], ], 'enabled' => [ diff --git a/README.md b/README.md index 201b6ba..38c7b9f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Add ability to use feature flags for extensions and content elements ## Build information -[![Build Status](https://github.com/AOEpeople/TYPO3-Feature-Flag/workflows/CI/badge.svg?branch=main)](https://github.com/AOEpeople/TYPO3-Feature-Flag/actions) +[![Build Status](https://github.com/AOEpeople/TYPO3-Feature-Flag/actions/workflows/tests.yml/badge.svg)](https://github.com/AOEpeople/TYPO3-Feature-Flag/actions) [![Code Coverage](https://scrutinizer-ci.com/g/AOEpeople/TYPO3-Feature-Flag/badges/coverage.png?b=main)](https://scrutinizer-ci.com/g/AOEpeople/TYPO3-Feature-Flag/?branch=main) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/AOEpeople/TYPO3-Feature-Flag/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/AOEpeople/TYPO3-Feature-Flag/?branch=main) @@ -13,18 +13,19 @@ The documentation is available online at [docs.typo3.org][1]. You can download and install this extension from the [TER (TYPO3 Extension Repository)][1] or use composer. -```shell script +```sh composer require aoe/feature-flag ``` ## Versions and Support -| Release | TYPO3 | PHP | Fixes will contain -|----------|----------|---------|--------------------| -| 11.x.y | 11.5 | 7.4-8.1 | Features, Bugfixes, Security Updates -| 9.x.y | 9.5-10.4 | 7.2-7.4 | Security Updates -| 8.x.y | 8.7 | 7.2-7.4 | Security Updates -| 5.x.y | 7.6 | 5.5-5.6 | End of life +| Release | TYPO3 | PHP | Fixes will contain | +|---------|----------|---------|--------------------------------------| +| 12.x.y | 12.4 | 8.1-8.3 | Features, Bugfixes, Security Updates | +| 11.x.y | 11.5 | 7.4-8.1 | Security Updates | +| 9.x.y | 9.5-10.4 | 7.2-7.4 | End of life | +| 8.x.y | 8.7 | 7.2-7.4 | End of life | +| 5.x.y | 7.6 | 5.5-5.6 | End of life | ## Copyright / License diff --git a/Tests/Functional/Domain/Repository/FeatureFlagRepositoryTest.php b/Tests/Functional/Domain/Repository/FeatureFlagRepositoryTest.php index 4dffd5e..7510dea 100644 --- a/Tests/Functional/Domain/Repository/FeatureFlagRepositoryTest.php +++ b/Tests/Functional/Domain/Repository/FeatureFlagRepositoryTest.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * @@ -55,86 +55,72 @@ protected function setUp(): void public function testShouldGetFeatureFlagByFlagName(): void { - $this->importDataSet(__DIR__ . '/fixtures/FeatureFlagTest.shouldGetFeatureFlagByFlagName.xml'); + $this->importCSVDataSet(__DIR__ . '/fixtures/FeatureFlagTest.shouldGetFeatureFlagByFlagName.csv'); $flag = $this->featureFlagRepository->findByFlag('my_test_feature_flag'); $this->assertInstanceOf(FeatureFlag::class, $flag); } public function testShouldHideElementForBehaviorHideAndEnabledFeatureFlag(): void { - $this->importDataSet( + $this->importCSVDataSet( __DIR__ . - '/fixtures/FeatureFlagTest.shouldHideElementForBehaviorHideAndEnabledFeatureFlag.xml' + '/fixtures/FeatureFlagTest.shouldHideElementForBehaviorHideAndEnabledFeatureFlag.csv' ); - $featureFlag = new FeatureFlagData(); $instance = new FeatureFlagRepository($featureFlag); $instance->updateFeatureFlagStatusForTable('tt_content'); $contentElements = $this->getElementsData('tt_content', 4712); - $this->assertSame(1, $contentElements[0]['hidden']); } public function testShouldHideElementForBehaviorShowAndDisabledFeatureFlag(): void { - $this->importDataSet( + $this->importCSVDataSet( __DIR__ . - '/fixtures/FeatureFlagTest.shouldHideElementForBehaviorShowAndDisabledFeatureFlag.xml' + '/fixtures/FeatureFlagTest.shouldHideElementForBehaviorShowAndDisabledFeatureFlag.csv' ); - $featureFlag = new FeatureFlagData(); $instance = new FeatureFlagRepository($featureFlag); $instance->updateFeatureFlagStatusForTable('tt_content'); $contentElements = $this->getElementsData('tt_content', 4712); - $this->assertSame(1, $contentElements[0]['hidden']); } public function testShouldShowElementForBehaviorShowAndEnabledFeatureFlag(): void { - $this->importDataSet( + $this->importCSVDataSet( __DIR__ . - '/fixtures/FeatureFlagTest.shouldShowElementForBehaviorShowAndEnabledFeatureFlag.xml' + '/fixtures/FeatureFlagTest.shouldShowElementForBehaviorShowAndEnabledFeatureFlag.csv' ); - $featureFlag = new FeatureFlagData(); $instance = new FeatureFlagRepository($featureFlag); $instance->updateFeatureFlagStatusForTable('tt_content'); $contentElements = $this->getElementsData('tt_content', 4712); - $this->assertSame(0, $contentElements[0]['hidden']); } public function testShouldShowElementForBehaviorHideAndDisabledFeatureFlag(): void { - $this->importDataSet( + $this->importCSVDataSet( __DIR__ . - '/fixtures/FeatureFlagTest.shouldShowElementForBehaviorShowAndEnabledFeatureFlag.xml' + '/fixtures/FeatureFlagTest.shouldShowElementForBehaviorShowAndEnabledFeatureFlag.csv' ); - $featureFlag = new FeatureFlagData(); $instance = new FeatureFlagRepository($featureFlag); $instance->updateFeatureFlagStatusForTable('tt_content'); $contentElements = $this->getElementsData('tt_content', 4712); - $this->assertSame(0, $contentElements[0]['hidden']); } - /** - * Helper function for testing return - * - * @param integer $uid - * @return array - */ - public function getElementsData(string $table, $uid) + public function getElementsData(string $table, int $uid): array { /** @var QueryBuilder $queryBuilder */ $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) @@ -157,7 +143,7 @@ public function getElementsData(string $table, $uid) ) ); - return $query->execute() + return $query->executeQuery() ->fetchAllAssociative(); } } diff --git a/Tests/Functional/Domain/Repository/MappingRepositoryTest.php b/Tests/Functional/Domain/Repository/MappingRepositoryTest.php index 3be6021..5fd4ee3 100644 --- a/Tests/Functional/Domain/Repository/MappingRepositoryTest.php +++ b/Tests/Functional/Domain/Repository/MappingRepositoryTest.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * @@ -51,9 +51,9 @@ protected function setUp(): void public function testFindOneByForeignTableNameAndUid(): void { - $this->importDataSet( + $this->importCSVDataSet( __DIR__ . - '/fixtures/MappingTest.shouldHideElementForBehaviorHideAndEnabledFeatureFlag.xml' + '/fixtures/MappingTest.shouldHideElementForBehaviorHideAndEnabledFeatureFlag.csv' ); $mapping = $this->mappingRepository->findOneByForeignTableNameAndUid(4712, 'tt_content'); @@ -63,7 +63,7 @@ public function testFindOneByForeignTableNameAndUid(): void public function testFindAllByForeignTableNameAndUid(): void { - $this->importDataSet(__DIR__ . '/fixtures/MappingTest.findAllByForeignTableNameAndUid.xml'); + $this->importCSVDataSet(__DIR__ . '/fixtures/MappingTest.findAllByForeignTableNameAndUid.csv'); $mapping = $this->mappingRepository->findAllByForeignTableNameAndUid( 4711, @@ -75,7 +75,7 @@ public function testFindAllByForeignTableNameAndUid(): void public function testShouldGetHashedMappings(): void { - $this->importDataSet(__DIR__ . '/fixtures/MappingTest.shouldGetHashedMappings.xml'); + $this->importCSVDataSet(__DIR__ . '/fixtures/MappingTest.shouldGetHashedMappings.csv'); $hashedMappings = $this->mappingRepository->getHashedMappings(); diff --git a/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldGetFeatureFlagByFlagName.csv b/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldGetFeatureFlagByFlagName.csv new file mode 100644 index 0000000..337c747 --- /dev/null +++ b/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldGetFeatureFlagByFlagName.csv @@ -0,0 +1,3 @@ +tx_featureflag_domain_model_featureflag,,,, +,uid,description,flag,enabled +,4711,"lorem ipsum",my_test_feature_flag,0 diff --git a/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldGetFeatureFlagByFlagName.xml b/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldGetFeatureFlagByFlagName.xml deleted file mode 100644 index 0e28e36..0000000 --- a/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldGetFeatureFlagByFlagName.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - 4711 - lorem ipsum - my_test_feature_flag - 0 - - \ No newline at end of file diff --git a/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldHideElementForBehaviorHideAndEnabledFeatureFlag.csv b/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldHideElementForBehaviorHideAndEnabledFeatureFlag.csv new file mode 100644 index 0000000..4ccdc40 --- /dev/null +++ b/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldHideElementForBehaviorHideAndEnabledFeatureFlag.csv @@ -0,0 +1,9 @@ +tx_featureflag_domain_model_featureflag,,,, +,uid,description,flag,enabled +,4711,"lorem ipsum",shouldHideElementForBehaviorHideAndEnabledFeatureFlag,1 +tt_content,,,, +,uid,bodytext,filelink_sorting,hidden +,4712,"lorem ipsum",,0 +tx_featureflag_domain_model_mapping,,,, +,feature_flag,foreign_table_uid,foreign_table_name,behavior +,4711,4712,tt_content,0 diff --git a/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldHideElementForBehaviorHideAndEnabledFeatureFlag.xml b/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldHideElementForBehaviorHideAndEnabledFeatureFlag.xml deleted file mode 100644 index f37dec6..0000000 --- a/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldHideElementForBehaviorHideAndEnabledFeatureFlag.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - 4711 - lorem ipsum - shouldHideElementForBehaviorHideAndEnabledFeatureFlag - 1 - - - - 4712 - lorem ipsum - - 0 - - - - 4711 - 4712 - tt_content - 0 - - \ No newline at end of file diff --git a/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldHideElementForBehaviorShowAndDisabledFeatureFlag.csv b/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldHideElementForBehaviorShowAndDisabledFeatureFlag.csv new file mode 100644 index 0000000..fa3ab91 --- /dev/null +++ b/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldHideElementForBehaviorShowAndDisabledFeatureFlag.csv @@ -0,0 +1,9 @@ +tx_featureflag_domain_model_featureflag,,,, +,uid,description,flag,enabled +,4711,"lorem ipsum",shouldHideElementForBehaviorHideAndEnabledFeatureFlag,0 +tt_content,,,, +,uid,bodytext,filelink_sorting,hidden +,4712,"lorem ipsum",,0 +tx_featureflag_domain_model_mapping,,,, +,feature_flag,foreign_table_uid,foreign_table_name,behavior +,4711,4712,tt_content,1 diff --git a/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldHideElementForBehaviorShowAndDisabledFeatureFlag.xml b/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldHideElementForBehaviorShowAndDisabledFeatureFlag.xml deleted file mode 100644 index 7f1ab90..0000000 --- a/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldHideElementForBehaviorShowAndDisabledFeatureFlag.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - 4711 - lorem ipsum - shouldHideElementForBehaviorHideAndEnabledFeatureFlag - 0 - - - - 4712 - lorem ipsum - - 0 - - - - 4711 - 4712 - tt_content - 1 - - \ No newline at end of file diff --git a/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldShowElementForBehaviorHideAndDisabledFeatureFlag.csv b/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldShowElementForBehaviorHideAndDisabledFeatureFlag.csv new file mode 100644 index 0000000..a9b16cf --- /dev/null +++ b/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldShowElementForBehaviorHideAndDisabledFeatureFlag.csv @@ -0,0 +1,9 @@ +tx_featureflag_domain_model_featureflag,,,, +,uid,description,flag,enabled +,4711,"lorem ipsum",shouldHideElementForBehaviorHideAndEnabledFeatureFlag,0 +tt_content,,,, +,uid,bodytext,filelink_sorting,hidden +,4712,"lorem ipsum",,1 +tx_featureflag_domain_model_mapping,,,, +,feature_flag,foreign_table_uid,foreign_table_name,behavior +,4711,4712,tt_content,0 diff --git a/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldShowElementForBehaviorHideAndDisabledFeatureFlag.xml b/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldShowElementForBehaviorHideAndDisabledFeatureFlag.xml deleted file mode 100644 index bbe584b..0000000 --- a/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldShowElementForBehaviorHideAndDisabledFeatureFlag.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - 4711 - lorem ipsum - shouldHideElementForBehaviorHideAndEnabledFeatureFlag - 0 - - - - 4712 - lorem ipsum - - 1 - - - - 4711 - 4712 - tt_content - 0 - - \ No newline at end of file diff --git a/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldShowElementForBehaviorShowAndEnabledFeatureFlag.csv b/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldShowElementForBehaviorShowAndEnabledFeatureFlag.csv new file mode 100644 index 0000000..7c5415c --- /dev/null +++ b/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldShowElementForBehaviorShowAndEnabledFeatureFlag.csv @@ -0,0 +1,9 @@ +tx_featureflag_domain_model_featureflag,,,, +,uid,description,flag,enabled +,4711,"lorem ipsum",shouldHideElementForBehaviorHideAndEnabledFeatureFlag,1 +tt_content,,,, +,uid,bodytext,filelink_sorting,hidden +,4712,"lorem ipsum",,0 +tx_featureflag_domain_model_mapping,,,, +,feature_flag,foreign_table_uid,foreign_table_name,behavior +,4711,4712,tt_content,1 diff --git a/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldShowElementForBehaviorShowAndEnabledFeatureFlag.xml b/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldShowElementForBehaviorShowAndEnabledFeatureFlag.xml deleted file mode 100644 index dd8db23..0000000 --- a/Tests/Functional/Domain/Repository/fixtures/FeatureFlagTest.shouldShowElementForBehaviorShowAndEnabledFeatureFlag.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - 4711 - lorem ipsum - shouldHideElementForBehaviorHideAndEnabledFeatureFlag - 1 - - - - 4712 - lorem ipsum - - 0 - - - - 4711 - 4712 - tt_content - 1 - - \ No newline at end of file diff --git a/Tests/Functional/Domain/Repository/fixtures/MappingTest.findAllByForeignTableNameAndUid.csv b/Tests/Functional/Domain/Repository/fixtures/MappingTest.findAllByForeignTableNameAndUid.csv new file mode 100644 index 0000000..783c201 --- /dev/null +++ b/Tests/Functional/Domain/Repository/fixtures/MappingTest.findAllByForeignTableNameAndUid.csv @@ -0,0 +1,4 @@ +tx_featureflag_domain_model_mapping,,,, +,feature_flag,foreign_table_uid,foreign_table_name,behavior +,4711,4711,tt_content,0 +,4712,4711,tt_content,0 diff --git a/Tests/Functional/Domain/Repository/fixtures/MappingTest.findAllByForeignTableNameAndUid.xml b/Tests/Functional/Domain/Repository/fixtures/MappingTest.findAllByForeignTableNameAndUid.xml deleted file mode 100644 index 9504292..0000000 --- a/Tests/Functional/Domain/Repository/fixtures/MappingTest.findAllByForeignTableNameAndUid.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - 4711 - 4711 - tt_content - 0 - - - - 4712 - 4711 - tt_content - 0 - - \ No newline at end of file diff --git a/Tests/Functional/Domain/Repository/fixtures/MappingTest.shouldGetHashedMappings.csv b/Tests/Functional/Domain/Repository/fixtures/MappingTest.shouldGetHashedMappings.csv new file mode 100644 index 0000000..ff18a72 --- /dev/null +++ b/Tests/Functional/Domain/Repository/fixtures/MappingTest.shouldGetHashedMappings.csv @@ -0,0 +1,4 @@ +tx_featureflag_domain_model_mapping,,,, +,feature_flag,foreign_table_uid,foreign_table_name,behavior +,4711,4711,tt_content,0 +,4712,4712,tt_content,0 diff --git a/Tests/Functional/Domain/Repository/fixtures/MappingTest.shouldGetHashedMappings.xml b/Tests/Functional/Domain/Repository/fixtures/MappingTest.shouldGetHashedMappings.xml deleted file mode 100644 index 2bfe41e..0000000 --- a/Tests/Functional/Domain/Repository/fixtures/MappingTest.shouldGetHashedMappings.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - 4711 - 4711 - tt_content - 0 - - - - 4712 - 4712 - tt_content - 0 - - \ No newline at end of file diff --git a/Tests/Functional/Domain/Repository/fixtures/MappingTest.shouldHideElementForBehaviorHideAndEnabledFeatureFlag.csv b/Tests/Functional/Domain/Repository/fixtures/MappingTest.shouldHideElementForBehaviorHideAndEnabledFeatureFlag.csv new file mode 100644 index 0000000..4ccdc40 --- /dev/null +++ b/Tests/Functional/Domain/Repository/fixtures/MappingTest.shouldHideElementForBehaviorHideAndEnabledFeatureFlag.csv @@ -0,0 +1,9 @@ +tx_featureflag_domain_model_featureflag,,,, +,uid,description,flag,enabled +,4711,"lorem ipsum",shouldHideElementForBehaviorHideAndEnabledFeatureFlag,1 +tt_content,,,, +,uid,bodytext,filelink_sorting,hidden +,4712,"lorem ipsum",,0 +tx_featureflag_domain_model_mapping,,,, +,feature_flag,foreign_table_uid,foreign_table_name,behavior +,4711,4712,tt_content,0 diff --git a/Tests/Functional/Domain/Repository/fixtures/MappingTest.shouldHideElementForBehaviorHideAndEnabledFeatureFlag.xml b/Tests/Functional/Domain/Repository/fixtures/MappingTest.shouldHideElementForBehaviorHideAndEnabledFeatureFlag.xml deleted file mode 100644 index f37dec6..0000000 --- a/Tests/Functional/Domain/Repository/fixtures/MappingTest.shouldHideElementForBehaviorHideAndEnabledFeatureFlag.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - 4711 - lorem ipsum - shouldHideElementForBehaviorHideAndEnabledFeatureFlag - 1 - - - - 4712 - lorem ipsum - - 0 - - - - 4711 - 4712 - tt_content - 0 - - \ No newline at end of file diff --git a/Tests/Functional/System/Db/FeatureFlagDataTest.php b/Tests/Functional/System/Db/FeatureFlagDataTest.php index e41afa5..1effd9b 100644 --- a/Tests/Functional/System/Db/FeatureFlagDataTest.php +++ b/Tests/Functional/System/Db/FeatureFlagDataTest.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * @@ -39,9 +39,9 @@ class FeatureFlagDataTest extends FunctionalTestCase public function testShouldGetContentElements(): void { - $this->importDataSet( + $this->importCSVDataSet( __DIR__ . - '/fixtures/FeatureFlagDataTest.xml' + '/fixtures/FeatureFlagDataTest.csv' ); $instance = new FeatureFlagData(); @@ -55,9 +55,9 @@ public function testShouldGetContentElements(): void public function testUpdateContentElements(): void { - $this->importDataSet( + $this->importCSVDataSet( __DIR__ . - '/fixtures/FeatureFlagDataTest.xml' + '/fixtures/FeatureFlagDataTest.csv' ); $instance = new FeatureFlagData(); @@ -71,9 +71,9 @@ public function testUpdateContentElements(): void public function testGetContentElementsPIDs(): void { - $this->importDataSet( + $this->importCSVDataSet( __DIR__ . - '/fixtures/FeatureFlagDataTest.xml' + '/fixtures/FeatureFlagDataTest.csv' ); $instance = new FeatureFlagData(); @@ -82,10 +82,7 @@ public function testGetContentElementsPIDs(): void $this->assertSame('1001', $returnedPID); } - /** - * @return array - */ - public function getElementsData(string $table, $uid) + public function getElementsData(string $table, int $uid): array { /** @var QueryBuilder $queryBuilder */ $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) @@ -108,7 +105,7 @@ public function getElementsData(string $table, $uid) ) ); - return $query->execute() + return $query->executeQuery() ->fetchAllAssociative(); } } diff --git a/Tests/Functional/System/Db/fixtures/FeatureFlagDataTest.csv b/Tests/Functional/System/Db/fixtures/FeatureFlagDataTest.csv new file mode 100644 index 0000000..e1ccd29 --- /dev/null +++ b/Tests/Functional/System/Db/fixtures/FeatureFlagDataTest.csv @@ -0,0 +1,9 @@ +tx_featureflag_domain_model_featureflag,,,,, +,uid,pid,description,flag,enabled +,4711,1001,"lorem ipsum",shouldHideElementForBehaviorHideAndEnabledFeatureFlag,1 +tt_content,,,, +,uid,bodytext,filelink_sorting,hidden +,4712,"lorem ipsum",,0 +tx_featureflag_domain_model_mapping,,,, +,feature_flag,foreign_table_uid,foreign_table_name,behavior +,4711,4712,tt_content,0 diff --git a/Tests/Functional/System/Db/fixtures/FeatureFlagDataTest.xml b/Tests/Functional/System/Db/fixtures/FeatureFlagDataTest.xml deleted file mode 100644 index a20ed90..0000000 --- a/Tests/Functional/System/Db/fixtures/FeatureFlagDataTest.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - 4711 - 1001 - lorem ipsum - shouldHideElementForBehaviorHideAndEnabledFeatureFlag - 1 - - - - 4712 - lorem ipsum - - 0 - - - - 4711 - 4712 - tt_content - 0 - - \ No newline at end of file diff --git a/Tests/Functional/System/Typo3/ConfigurationTest.php b/Tests/Functional/System/Typo3/ConfigurationTest.php index 311f27a..cd49588 100644 --- a/Tests/Functional/System/Typo3/ConfigurationTest.php +++ b/Tests/Functional/System/Typo3/ConfigurationTest.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * diff --git a/Tests/Functional/System/Typo3/TCATest.php b/Tests/Functional/System/Typo3/TCATest.php index cecf9c6..895e79e 100644 --- a/Tests/Functional/System/Typo3/TCATest.php +++ b/Tests/Functional/System/Typo3/TCATest.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * @@ -38,10 +38,7 @@ class TCATest extends FunctionalTestCase { - /** - * @var TCA|MockObject - */ - protected $tca; + protected MockObject $tca; /** * (non-PHPdoc) diff --git a/Tests/FunctionalTests.xml b/Tests/FunctionalTests.xml index 671e02a..1c9a035 100644 --- a/Tests/FunctionalTests.xml +++ b/Tests/FunctionalTests.xml @@ -12,23 +12,15 @@ stopOnSkipped="false" cacheDirectory=".phpunit.cache" backupStaticProperties="false" - requireCoverageMetadata="false"> + requireCoverageMetadata="false" + displayDetailsOnTestsThatTriggerDeprecations="true" + displayDetailsOnTestsThatTriggerErrors="true" + displayDetailsOnTestsThatTriggerNotices="true" + displayDetailsOnTestsThatTriggerWarnings="true" +> ../Classes - - - - - - - - diff --git a/Tests/Unit/BaseTestCase.php b/Tests/Unit/BaseTestCase.php index f371617..a86f96e 100644 --- a/Tests/Unit/BaseTestCase.php +++ b/Tests/Unit/BaseTestCase.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * diff --git a/Tests/Unit/Command/AbstractCommandTestCase.php b/Tests/Unit/Command/AbstractCommandTestCase.php index aff23c4..18aca88 100644 --- a/Tests/Unit/Command/AbstractCommandTestCase.php +++ b/Tests/Unit/Command/AbstractCommandTestCase.php @@ -4,13 +4,14 @@ use Aoe\FeatureFlag\Service\FeatureFlagService; use Aoe\FeatureFlag\Tests\Unit\BaseTestCase; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Output\ConsoleOutput; /*************************************************************** * Copyright notice * - * (c) 2022 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * @@ -85,7 +86,7 @@ protected function assertThatFeaturesAreNotActivated() protected function assertThatFeaturesAreDeactivated(array $expectedFeatures) { - $this->assertEquals($expectedFeatures, $this->deactivatedFeatures); + $this->assertSame($expectedFeatures, $this->deactivatedFeatures); } /** @@ -98,7 +99,7 @@ protected function assertThatFeaturesAreNotDeactivated() protected function assertThatInfosAreShown(array $expectedInfos) { - $this->assertEquals($expectedInfos, $this->shownInfos); + $this->assertSame($expectedInfos, $this->shownInfos); } protected function runCommand(string $commandClass, string $commaSeparatedListOfFeatures = '') @@ -126,6 +127,7 @@ protected function runCommand(string $commandClass, string $commaSeparatedListOf $this->callbackOnUpdateFeature($feature, $enabled); }); + /** @var Command $command */ $command = $this ->getMockBuilder($commandClass) ->setConstructorArgs([$featureFlagService]) diff --git a/Tests/Unit/Command/ActivateFeatureFlagCommandTest.php b/Tests/Unit/Command/ActivateFeatureFlagCommandTest.php index 67fcb0e..ade4abc 100644 --- a/Tests/Unit/Command/ActivateFeatureFlagCommandTest.php +++ b/Tests/Unit/Command/ActivateFeatureFlagCommandTest.php @@ -7,7 +7,7 @@ /*************************************************************** * Copyright notice * - * (c) 2022 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * diff --git a/Tests/Unit/Command/DeactivateFeatureFlagCommandTest.php b/Tests/Unit/Command/DeactivateFeatureFlagCommandTest.php index 096fca8..d599a5e 100644 --- a/Tests/Unit/Command/DeactivateFeatureFlagCommandTest.php +++ b/Tests/Unit/Command/DeactivateFeatureFlagCommandTest.php @@ -7,7 +7,7 @@ /*************************************************************** * Copyright notice * - * (c) 2022 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * diff --git a/Tests/Unit/Command/ToggleRecordsCommandTest.php b/Tests/Unit/Command/ToggleRecordsCommandTest.php index 5850d21..c482e57 100644 --- a/Tests/Unit/Command/ToggleRecordsCommandTest.php +++ b/Tests/Unit/Command/ToggleRecordsCommandTest.php @@ -7,7 +7,7 @@ /*************************************************************** * Copyright notice * - * (c) 2022 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * diff --git a/Tests/Unit/Domain/Model/FeatureFlagTest.php b/Tests/Unit/Domain/Model/FeatureFlagTest.php index 7e5f441..28ae636 100644 --- a/Tests/Unit/Domain/Model/FeatureFlagTest.php +++ b/Tests/Unit/Domain/Model/FeatureFlagTest.php @@ -8,7 +8,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * @@ -39,6 +39,7 @@ class FeatureFlagTest extends BaseTestCase */ protected function setUp(): void { + parent::setUp(); $this->featureFlag = new FeatureFlag(); } @@ -58,7 +59,7 @@ public function testCheckProperties(): void $this->featureFlag->setEnabled(true); $this->featureFlag->setFlag('my_new_feature_flag'); $this->assertTrue($this->featureFlag->isEnabled()); - $this->assertEquals($this->featureFlag->getDescription(), 'This is a test description'); - $this->assertEquals($this->featureFlag->getFlag(), 'my_new_feature_flag'); + $this->assertSame('This is a test description', $this->featureFlag->getDescription()); + $this->assertSame('my_new_feature_flag', $this->featureFlag->getFlag()); } } diff --git a/Tests/Unit/Domain/Model/MappingTest.php b/Tests/Unit/Domain/Model/MappingTest.php index 88ea65a..1591f19 100644 --- a/Tests/Unit/Domain/Model/MappingTest.php +++ b/Tests/Unit/Domain/Model/MappingTest.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * @@ -32,7 +32,7 @@ class MappingTest extends BaseTestCase { - private ?\Aoe\FeatureFlag\Domain\Model\Mapping $mapping = null; + private ?Mapping $mapping = null; /** * (non-PHPdoc) @@ -40,6 +40,7 @@ class MappingTest extends BaseTestCase */ protected function setUp(): void { + parent::setUp(); $this->mapping = new Mapping(); } @@ -56,13 +57,13 @@ protected function tearDown(): void public function testTstamp(): void { $this->mapping->setTstamp(2183466346); - $this->assertEquals($this->mapping->getTstamp(), 2183466346); + $this->assertSame('2183466346', $this->mapping->getTstamp()); } public function testCrdate(): void { $this->mapping->setCrdate(2183466347); - $this->assertEquals($this->mapping->getCrdate(), 2183466347); + $this->assertSame('2183466347', $this->mapping->getCrdate()); } public function testFeatureFlag(): void @@ -71,25 +72,25 @@ public function testFeatureFlag(): void $featureFlag->method('getFlag') ->willReturn('my_awesome_feature_flag'); $this->mapping->setFeatureFlag($featureFlag); - $this->assertEquals($this->mapping->getFeatureFlag()->getFlag(), 'my_awesome_feature_flag'); + $this->assertSame('my_awesome_feature_flag', $this->mapping->getFeatureFlag()->getFlag()); } public function testForeignTableColumn(): void { $this->mapping->setForeignTableColumn('my_foreign_column'); - $this->assertEquals($this->mapping->getForeignTableColumn(), 'my_foreign_column'); + $this->assertSame('my_foreign_column', $this->mapping->getForeignTableColumn()); } public function testForeignTableName(): void { $this->mapping->setForeignTableName('my_foreign_table'); - $this->assertEquals($this->mapping->getForeignTableName(), 'my_foreign_table'); + $this->assertSame('my_foreign_table', $this->mapping->getForeignTableName()); } public function testForeignTableUid(): void { $this->mapping->setForeignTableUid(4711); - $this->assertEquals($this->mapping->getForeignTableUid(), 4711); + $this->assertSame(4711, $this->mapping->getForeignTableUid()); } public function testBehavior(): void diff --git a/Tests/Unit/Form/Element/FeatureFlagBehaviourFormSelectElementTest.php b/Tests/Unit/Form/Element/FeatureFlagBehaviourFormSelectElementTest.php index feb6895..cb3c282 100644 --- a/Tests/Unit/Form/Element/FeatureFlagBehaviourFormSelectElementTest.php +++ b/Tests/Unit/Form/Element/FeatureFlagBehaviourFormSelectElementTest.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * diff --git a/Tests/Unit/Form/Element/FeatureFlagFormSelectElementTest.php b/Tests/Unit/Form/Element/FeatureFlagFormSelectElementTest.php index 057fad4..117bad7 100644 --- a/Tests/Unit/Form/Element/FeatureFlagFormSelectElementTest.php +++ b/Tests/Unit/Form/Element/FeatureFlagFormSelectElementTest.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * diff --git a/Tests/Unit/Service/FeatureFlagServiceTest.php b/Tests/Unit/Service/FeatureFlagServiceTest.php index f4e400d..20a5d2e 100644 --- a/Tests/Unit/Service/FeatureFlagServiceTest.php +++ b/Tests/Unit/Service/FeatureFlagServiceTest.php @@ -5,7 +5,7 @@ /*************************************************************** * Copyright notice * - * (c) 2021 AOE GmbH + * (c) 2024 AOE GmbH * * All rights reserved * @@ -115,10 +115,7 @@ protected function setService(FeatureFlagRepository $mockRepository) ); } - /** - * @return MockObject - */ - private function getMockModel($isEnabled) + private function getMockModel($isEnabled): MockObject { $mockModel = $this->getMockBuilder(FeatureFlag::class) ->disableOriginalConstructor() @@ -137,7 +134,7 @@ private function getMockModel($isEnabled) /** * @param boolean $isEnabled */ - private function getMockRepository($isEnabled) + private function getMockRepository($isEnabled): MockObject { $mockModel = $this->getMockModel($isEnabled); $mockRepository = $this->getMockBuilder(FeatureFlagRepository::class) @@ -148,10 +145,7 @@ private function getMockRepository($isEnabled) return $mockRepository; } - /** - * @return MockObject - */ - private function getMockConfiguration() + private function getMockConfiguration(): MockObject { $mockConfiguration = $this->getMockBuilder(Configuration::class) ->disableOriginalConstructor() diff --git a/Tests/UnitTests.xml b/Tests/UnitTests.xml index 7aee5da..0d2562b 100644 --- a/Tests/UnitTests.xml +++ b/Tests/UnitTests.xml @@ -12,7 +12,12 @@ stopOnSkipped="false" cacheDirectory=".phpunit.cache" backupStaticProperties="false" - requireCoverageMetadata="false"> + requireCoverageMetadata="false" + displayDetailsOnTestsThatTriggerDeprecations="true" + displayDetailsOnTestsThatTriggerErrors="true" + displayDetailsOnTestsThatTriggerNotices="true" + displayDetailsOnTestsThatTriggerWarnings="true" +> ../Classes diff --git a/.code-quality/configure-checkstyle.sh b/code-quality/configure-checkstyle.sh similarity index 100% rename from .code-quality/configure-checkstyle.sh rename to code-quality/configure-checkstyle.sh diff --git a/.code-quality/ecs.php b/code-quality/ecs.php similarity index 100% rename from .code-quality/ecs.php rename to code-quality/ecs.php diff --git a/code-quality/phpstan-baseline.neon b/code-quality/phpstan-baseline.neon new file mode 100644 index 0000000..6741957 --- /dev/null +++ b/code-quality/phpstan-baseline.neon @@ -0,0 +1,7 @@ +parameters: + ignoreErrors: + - + message: "#^Constant LF not found\\.$#" + count: 3 + path: ../Classes/Form/Element/AbstractFormSelectElement.php + diff --git a/.code-quality/phpstan.neon b/code-quality/phpstan.neon similarity index 84% rename from .code-quality/phpstan.neon rename to code-quality/phpstan.neon index 22d8534..b6b5bd0 100644 --- a/.code-quality/phpstan.neon +++ b/code-quality/phpstan.neon @@ -8,9 +8,11 @@ parameters: paths: - "../Classes/" + ignoreErrors: + - identifier: missingType.iterableValue + - identifier: missingType.generics + inferPrivatePropertyTypeFromConstructor: true - checkMissingIterableValueType: false - checkGenericClassInNonGenericObjectType: false services: - diff --git a/.code-quality/rector.php b/code-quality/rector.php similarity index 83% rename from .code-quality/rector.php rename to code-quality/rector.php index 6776034..52d1d17 100644 --- a/.code-quality/rector.php +++ b/code-quality/rector.php @@ -5,10 +5,9 @@ use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector; use Rector\Config\RectorConfig; use Rector\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector; -use Rector\EarlyReturn\Rector\If_\ChangeAndIfToEarlyReturnRector; use Rector\Set\ValueObject\SetList; use Rector\PHPUnit\Set\PHPUnitSetList; -use Rector\Privatization\Rector\Class_\FinalizeClassesWithoutChildrenRector; + use Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictSetUpRector; @@ -33,8 +32,6 @@ PHPUnitSetList::PHPUNIT_CODE_QUALITY ]) ->withSkip([ - FinalizeClassesWithoutChildrenRector::class, - ChangeAndIfToEarlyReturnRector::class, TypedPropertyFromStrictSetUpRector::class, AddMethodCallBasedStrictParamTypeRector::class, FlipTypeControlToUseExclusiveTypeRector::class, diff --git a/composer.json b/composer.json index df41098..7c4ea0b 100644 --- a/composer.json +++ b/composer.json @@ -17,21 +17,21 @@ } ], "require": { - "php": "^7.4 || ^8.0", + "php": "^8.1", "ext-json": "*", - "typo3/cms-core": "^11.5", + "typo3/cms-core": "^12.4", "typo3/cms-extbase": "*", "typo3/cms-scheduler": "*" }, "require-dev": { - "typo3/testing-framework": "^7.0.4", + "typo3/testing-framework": "^8.0.9", + "phpunit/phpcov": "^9.0.0", "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpcov": "*", "phpcompatibility/php-compatibility": "^9.3", "phpstan/phpstan": "^1.10", "rector/rector": "^1.0", - "symplify/easy-coding-standard": "12.1.14", - "symplify/phpstan-rules": "12.4.8" + "symplify/easy-coding-standard": "^12.1", + "symplify/phpstan-rules": "^13.0.0" }, "autoload": { "psr-4": { @@ -47,6 +47,7 @@ "config": { "vendor-dir": ".Build/vendor", "bin-dir": ".Build/bin", + "process-timeout": 0, "allow-plugins": { "typo3/cms-composer-installers": true, "typo3/class-alias-loader": true @@ -67,25 +68,19 @@ ], "code-style": [ "[ -e ./.Build/bin/rector ] || composer install", - "./.Build/bin/ecs check --config .code-quality/ecs.php", - "./.Build/bin/rector process --dry-run --config .code-quality/rector.php" - ], - "code-style-upgrade": [ - "[ -e ./.Build/bin/rector ] || composer install", - "./.Build/bin/rector process --dry-run --config .code-quality/rector-8_0.php" + "./.Build/bin/ecs check --config code-quality/ecs.php", + "./.Build/bin/rector process --dry-run --config code-quality/rector.php" ], "code-analysis": [ - "./.Build/bin/phpstan analyse -c .code-quality/phpstan.neon --memory-limit=1G" + "./.Build/bin/phpstan analyse -c code-quality/phpstan.neon --memory-limit=1G" ], "code-analysis--baseline": [ - "./.Build/bin/phpstan analyse -c .code-quality/phpstan.neon --memory-limit=1G --generate-baseline" + "./.Build/bin/phpstan analyse -c code-quality/phpstan.neon --memory-limit=1G --generate-baseline" ], "code-compatibility": [ - "[ -e ./.Build/vendor/symplify/easy-coding-standard/vendor/squizlabs/php_codesniffer/bin/phpcs ] || composer install", + "[ -e ./.Build/vendor/symplify/easy-coding-standard/vendor/squizlabs/php_codesniffer/bin/phpcs ] || composer update", "[ -d ./reports/php_checkstyle ] || mkdir -p reports/php_checkstyle/", - "./.code-quality/configure-checkstyle.sh", - "./.Build/vendor/symplify/easy-coding-standard/vendor/squizlabs/php_codesniffer/bin/phpcs -d memory_limit=1G --standard=PHPCompatibility --colors --ignore=*/.Build/*,*.min.js -p . --runtime-set testVersion 7.4", - "./.Build/vendor/symplify/easy-coding-standard/vendor/squizlabs/php_codesniffer/bin/phpcs -d memory_limit=1G --standard=PHPCompatibility --colors --ignore=*/.Build/*,*.min.js -p . --runtime-set testVersion 8.0", + "./code-quality/configure-checkstyle.sh", "./.Build/vendor/symplify/easy-coding-standard/vendor/squizlabs/php_codesniffer/bin/phpcs -d memory_limit=1G --standard=PHPCompatibility --colors --ignore=*/.Build/*,*.min.js -p . --runtime-set testVersion 8.1", "./.Build/vendor/symplify/easy-coding-standard/vendor/squizlabs/php_codesniffer/bin/phpcs -d memory_limit=1G --standard=PHPCompatibility --colors --ignore=*/.Build/*,*.min.js -p . --runtime-set testVersion 8.2", "./.Build/vendor/symplify/easy-coding-standard/vendor/squizlabs/php_codesniffer/bin/phpcs -d memory_limit=1G --standard=PHPCompatibility --colors --ignore=*/.Build/*,*.min.js -p . --runtime-set testVersion 8.3" @@ -96,11 +91,8 @@ "@composer code-compatibility" ], "extension-release": [ - "rm -rf .Build", - "rm -rf .code-quality", - "rm -rf Tests/", - "rm .gitignore", - "rm .scrutinizer.yml" + "@composer install --no-dev", + "rm -rf .github .Build code-quality Tests .gitignore scrutinizer.yml" ] }, "scripts-descriptions": { @@ -109,7 +101,7 @@ }, "extra": { "branch-alias": { - "dev-main": "11.1.x-dev" + "dev-main": "12.0.x-dev" }, "typo3/cms": { "cms-package-dir": "{$vendor-dir}/typo3/cms", diff --git a/ext_emconf.php b/ext_emconf.php index 7b4ad5e..2f68c7c 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -4,17 +4,17 @@ 'title' => 'Feature Flags for TYPO3', 'description' => 'Add ability to use feature flags for extensions and content elements', 'category' => 'sys', - 'author' => 'Matthias Gutjahr, Kevin Schu', + 'author' => 'AOE GmbH', 'author_email' => 'dev@aoe.com', 'author_company' => 'AOE GmbH', 'state' => 'stable', 'uploadfolder' => 0, 'createDirs' => '', 'clearCacheOnLoad' => 0, - 'version' => '11.3.1', + 'version' => '12.0.0', 'constraints' => [ 'depends' => [ - 'typo3' => '11.5.0-11.5.99' + 'typo3' => '12.4.0-12-4.99' ], 'conflicts' => [], 'suggests' => [],