From e4f6eba0c2cd9436ea0394787bb8b45516bf263f Mon Sep 17 00:00:00 2001 From: Daniel Gohlke Date: Fri, 30 Jan 2026 15:19:59 +0100 Subject: [PATCH 01/13] [TASK] Make extension compatible to TYPO3 v14.1 --- .github/workflows/ci.yaml | 6 ++-- Build/phpunit.xml.dist | 2 +- Classes/Controller/EventController.php | 15 +++++----- Classes/Controller/EventDateController.php | 4 +-- .../Domain/Repository/EventDateRepository.php | 9 +++++- .../EventListener/Order/Stock/FlushCache.php | 6 ++-- Classes/Hooks/DataHandler.php | 5 ++-- .../ExtcodeCartEventsCTypeMigration.php | 18 ++--------- Classes/Updates/SlugUpdater.php | 9 +++--- ...itchableControllerActionsPluginUpdater.php | 12 ++++---- Classes/ViewHelpers/Link/EventViewHelper.php | 12 ++++++-- .../TCA/tx_cartevents_domain_model_event.php | 2 +- .../tx_cartevents_domain_model_eventdate.php | 2 +- ..._cartevents_domain_model_pricecategory.php | 6 ++-- ...x_cartevents_domain_model_specialprice.php | 4 +-- Documentation/Changelog/7.0/Index.rst | 11 +++++++ Documentation/Changelog/Index.rst | 1 + .../Introduction/Sponsoring/Index.rst | 1 - Documentation/guides.xml | 4 +-- README.md | 8 ++--- composer.json | 30 ++++++++++++------- ext_emconf.php | 6 ++-- ext_localconf.php | 15 ++++------ rector.php | 5 ++-- shell.nix | 16 +++++----- 25 files changed, 114 insertions(+), 95 deletions(-) create mode 100644 Documentation/Changelog/7.0/Index.rst diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8c3c986f..6f2fd3ab 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -60,7 +60,7 @@ jobs: run: composer install --prefer-dist --no-progress --no-suggest - name: Coding Guideline - run: vendor/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php -v --dry-run --using-cache=no --path-mode=intersection ./ + run: .build/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php -v --dry-run --using-cache=no --path-mode=intersection ./ code-quality: runs-on: ubuntu-latest @@ -89,10 +89,10 @@ jobs: composer require --no-interaction --prefer-dist --no-progress "typo3/cms-core:${{ matrix.typo3-version }}" "typo3/cms-extbase:${{ matrix.typo3-version }}" "typo3/cms-frontend:${{ matrix.typo3-version }}" - name: Build codeception tester - run: vendor/bin/codecept build + run: .build/bin/codecept build - name: Code Quality (by PHPStan) - run: vendor/bin/phpstan analyse -c Build/phpstan.neon + run: .build/bin/phpstan analyse -c Build/phpstan.neon test-php: runs-on: ubuntu-latest diff --git a/Build/phpunit.xml.dist b/Build/phpunit.xml.dist index 36e947ad..635a118a 100644 --- a/Build/phpunit.xml.dist +++ b/Build/phpunit.xml.dist @@ -1,5 +1,5 @@ - + diff --git a/Classes/Controller/EventController.php b/Classes/Controller/EventController.php index 6ae6c536..127fa11c 100644 --- a/Classes/Controller/EventController.php +++ b/Classes/Controller/EventController.php @@ -10,7 +10,6 @@ * For the full copyright and license information, please read the * LICENSE file that was distributed with this source code. */ - use Exception; use Extcode\Cart\Domain\Model\Cart\Cart; use Extcode\Cart\Service\SessionHandler; @@ -25,11 +24,13 @@ use Extcode\CartEvents\Domain\Repository\EventRepository; use Extcode\CartEvents\Domain\Repository\PriceCategoryRepository; use Psr\Http\Message\ResponseInterface; +use TYPO3\CMS\Core\Cache\CacheTag; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Annotation\IgnoreValidation; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; use TYPO3\CMS\Extbase\Http\ForwardResponse; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; +use TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManagerInterface; final class EventController extends ActionController { @@ -56,7 +57,7 @@ protected function initializeAction(): void static $cacheTagsSet = false; if (!$cacheTagsSet) { - $GLOBALS['TSFE']->addCacheTags(['tx_cartevents']); + $this->request->getAttribute('frontend.cache.collector')->addCacheTags(new CacheTag('tx_cartevents', 3600)); $cacheTagsSet = true; } } @@ -102,8 +103,8 @@ public function teaserAction(): ResponseInterface public function showAction(?Event $event = null): ResponseInterface { - if ((int)$GLOBALS['TSFE']->page['doktype'] === 186) { - $eventUid = (int)$GLOBALS['TSFE']->page['cart_events_event']; + if ((int)$this->request->getAttribute('frontend.page.information')->getPageRecord()['doktype'] === 186) { + $eventUid = (int)$this->request->getAttribute('frontend.page.information')->getPageRecord()['cart_events_event']; $event = $this->eventRepository->findByUid($eventUid); } @@ -120,8 +121,8 @@ public function showAction(?Event $event = null): ResponseInterface #[IgnoreValidation(['value' => 'priceCategory'])] public function formAction(?EventDate $eventDate = null, ?PriceCategory $priceCategory = null): ResponseInterface { - if (class_exists(\TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManagerInterface::class) === false) { - throw new \BadFunctionCallException('This action requires the installation of typo3/cms-form.'); + if (class_exists(FormPersistenceManagerInterface::class) === false) { + throw new \BadFunctionCallException('This action requires the installation of typo3/cms-form.', 2153916883); } if (!$eventDate) { @@ -142,7 +143,7 @@ public function formAction(?EventDate $eventDate = null, ?PriceCategory $priceCa } $formDefinition = $event->getFormDefinition(); $formPersistenceManager = GeneralUtility::makeInstance( - \TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManagerInterface::class + FormPersistenceManagerInterface::class ); $form = $formPersistenceManager->load($formDefinition); diff --git a/Classes/Controller/EventDateController.php b/Classes/Controller/EventDateController.php index 65255055..123523a5 100644 --- a/Classes/Controller/EventDateController.php +++ b/Classes/Controller/EventDateController.php @@ -10,9 +10,9 @@ * For the full copyright and license information, please read the * LICENSE file that was distributed with this source code. */ - use Extcode\CartEvents\Domain\Repository\EventDateRepository; use Psr\Http\Message\ResponseInterface; +use TYPO3\CMS\Core\Cache\CacheTag; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; @@ -28,7 +28,7 @@ protected function initializeAction(): void static $cacheTagsSet = false; if (!$cacheTagsSet) { - $GLOBALS['TSFE']->addCacheTags(['tx_cartevents']); + $this->request->getAttribute('frontend.cache.collector')->addCacheTags(new CacheTag('tx_cartevents', 3600)); $cacheTagsSet = true; } } diff --git a/Classes/Domain/Repository/EventDateRepository.php b/Classes/Domain/Repository/EventDateRepository.php index 25bffc4b..0a258132 100644 --- a/Classes/Domain/Repository/EventDateRepository.php +++ b/Classes/Domain/Repository/EventDateRepository.php @@ -17,12 +17,19 @@ class EventDateRepository extends Repository { + /** + * Constructs a new Repository + */ + public function __construct(private readonly ConnectionPool $connectionPool) + { + parent::__construct(); + } public function findNext(int $limit, string $pidList): array { $table = 'tx_cartevents_domain_model_eventdate'; $joinTableEvent = 'tx_cartevents_domain_model_event'; - $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) + $queryBuilder = $this->connectionPool ->getQueryBuilderForTable($table); $queryBuilder diff --git a/Classes/EventListener/Order/Stock/FlushCache.php b/Classes/EventListener/Order/Stock/FlushCache.php index 46a5cb81..2483e6e1 100644 --- a/Classes/EventListener/Order/Stock/FlushCache.php +++ b/Classes/EventListener/Order/Stock/FlushCache.php @@ -17,12 +17,12 @@ use Extcode\CartEvents\Domain\Model\EventDate; use Extcode\CartEvents\Domain\Repository\EventDateRepository; use TYPO3\CMS\Core\Cache\CacheManager; -use TYPO3\CMS\Core\Utility\GeneralUtility; readonly class FlushCache { public function __construct( - private EventDateRepository $eventDateRepository + private EventDateRepository $eventDateRepository, + private readonly CacheManager $cacheManager ) {} public function __invoke(EventInterface $event): void @@ -40,7 +40,7 @@ public function __invoke(EventInterface $event): void throw new Exception('EventDate with uid ' . $cartProduct->getProductId() . ' has no event!', 1769617883); } $cacheTag = 'tx_cartevents_event_' . $event->getUid(); - $cacheManager = GeneralUtility::makeInstance(CacheManager::class); + $cacheManager = $this->cacheManager; $cacheManager->flushCachesInGroupByTag('pages', $cacheTag); } } diff --git a/Classes/Hooks/DataHandler.php b/Classes/Hooks/DataHandler.php index 88c1be9e..695a09fc 100644 --- a/Classes/Hooks/DataHandler.php +++ b/Classes/Hooks/DataHandler.php @@ -10,13 +10,14 @@ */ use TYPO3\CMS\Core\Cache\CacheManager; -use TYPO3\CMS\Core\Utility\GeneralUtility; /** * Hook into tcemain which is used to show preview of news item */ class DataHandler { + public function __construct() {} + /** * Flushes the cache if a news record was edited. * This happens on two levels: by UID and by PID. @@ -34,7 +35,7 @@ public function clearCachePostProc(array $params): void $cacheTagsToFlush[] = 'tx_cartevents_event_' . $params['uid_page']; } - $cacheManager = GeneralUtility::makeInstance(CacheManager::class); + $cacheManager = $this->cacheManager; foreach ($cacheTagsToFlush as $cacheTag) { $cacheManager->flushCachesInGroupByTag('pages', $cacheTag); } diff --git a/Classes/Updates/ExtcodeCartEventsCTypeMigration.php b/Classes/Updates/ExtcodeCartEventsCTypeMigration.php index 1f6f9c5f..0860aa51 100644 --- a/Classes/Updates/ExtcodeCartEventsCTypeMigration.php +++ b/Classes/Updates/ExtcodeCartEventsCTypeMigration.php @@ -4,8 +4,8 @@ namespace Extcode\CartEvents\Updates; -use TYPO3\CMS\Install\Attribute\UpgradeWizard; -use TYPO3\CMS\Install\Updates\AbstractListTypeToCTypeUpdate; +use TYPO3\CMS\Core\Attribute\UpgradeWizard; +use TYPO3\CMS\Core\Upgrades\AbstractListTypeToCTypeUpdate; #[UpgradeWizard('extcodeCartEventsCTypeMigration')] final class ExtcodeCartEventsCTypeMigration extends AbstractListTypeToCTypeUpdate @@ -20,22 +20,10 @@ public function getDescription(): string return 'The "Extcode CartEvents" plugins are now registered as content element. Update migrates existing records and backend user permissions.'; } - /** - * This must return an array containing the "list_type" to "CType" mapping - * - * Example: - * - * [ - * 'pi_plugin1' => 'pi_plugin1', - * 'pi_plugin2' => 'new_content_element', - * ] - * - * @return array - */ protected function getListTypeToCTypeMapping(): array { return [ - // TODO: Add this mapping yourself! + 'cartevents' => 'cartevents_listevents' ]; } } diff --git a/Classes/Updates/SlugUpdater.php b/Classes/Updates/SlugUpdater.php index 77b8d645..010dc041 100644 --- a/Classes/Updates/SlugUpdater.php +++ b/Classes/Updates/SlugUpdater.php @@ -14,9 +14,9 @@ use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\DataHandling\SlugHelper; +use TYPO3\CMS\Core\Upgrades\ChattyInterface; +use TYPO3\CMS\Core\Upgrades\UpgradeWizardInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Install\Updates\ChattyInterface; -use TYPO3\CMS\Install\Updates\UpgradeWizardInterface; /** * Generate slugs for empty path_segments @@ -30,6 +30,7 @@ class SlugUpdater implements UpgradeWizardInterface, ChattyInterface * @var OutputInterface */ protected $output; + public function __construct(private readonly ConnectionPool $connectionPool) {} /** * Return the identifier for this wizard @@ -55,7 +56,7 @@ public function getDescription(): string */ public function updateNecessary(): bool { - $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(self::TABLE_NAME); + $queryBuilder = $this->connectionPool->getQueryBuilderForTable(self::TABLE_NAME); $queryBuilder->getRestrictions()->removeAll(); $elementCount = $queryBuilder->count('uid') ->from(self::TABLE_NAME)->where($queryBuilder->expr()->or($queryBuilder->expr()->eq('path_segment', $queryBuilder->createNamedParameter('', Connection::PARAM_STR)), $queryBuilder->expr()->isNull('path_segment')))->executeQuery()->fetchOne(); @@ -75,7 +76,7 @@ public function executeUpdate(): bool $GLOBALS['TCA'][self::TABLE_NAME]['columns']['path_segment']['config'] ); - $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable(self::TABLE_NAME); + $connection = $this->connectionPool->getConnectionForTable(self::TABLE_NAME); $queryBuilder = $connection->createQueryBuilder(); $queryBuilder->getRestrictions()->removeAll(); $statement = $queryBuilder->select('uid', 'title') diff --git a/Classes/Updates/SwitchableControllerActionsPluginUpdater.php b/Classes/Updates/SwitchableControllerActionsPluginUpdater.php index f44f75e3..794c2935 100644 --- a/Classes/Updates/SwitchableControllerActionsPluginUpdater.php +++ b/Classes/Updates/SwitchableControllerActionsPluginUpdater.php @@ -11,14 +11,14 @@ namespace Extcode\CartEvents\Updates; +use TYPO3\CMS\Core\Attribute\UpgradeWizard; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction; use TYPO3\CMS\Core\Service\FlexFormService; +use TYPO3\CMS\Core\Upgrades\DatabaseUpdatedPrerequisite; +use TYPO3\CMS\Core\Upgrades\UpgradeWizardInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Install\Attribute\UpgradeWizard; -use TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite; -use TYPO3\CMS\Install\Updates\UpgradeWizardInterface; #[UpgradeWizard('switchableControllerActionsPluginUpdater')] class SwitchableControllerActionsPluginUpdater implements UpgradeWizardInterface @@ -38,7 +38,7 @@ class SwitchableControllerActionsPluginUpdater implements UpgradeWizardInterface protected FlexFormService $flexFormService; - public function __construct() + public function __construct(private readonly ConnectionPool $connectionPool) { $this->flexFormService = GeneralUtility::makeInstance(FlexFormService::class); } @@ -133,7 +133,7 @@ protected function getMigrationRecords(): array { $checkListTypes = array_unique(array_column(self::MIGRATION_SETTINGS, 'sourceListType')); - $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); + $connectionPool = $this->connectionPool; $queryBuilder = $connectionPool->getQueryBuilderForTable('tt_content'); $queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class)); @@ -193,7 +193,7 @@ protected function getAllowedSettingsFromFlexForm(string $listType): array */ protected function updateContentElement(int $uid, string $newListType, string $flexform): void { - $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tt_content'); + $queryBuilder = $this->connectionPool->getQueryBuilderForTable('tt_content'); $queryBuilder->update('tt_content') ->set('list_type', $newListType) ->set('pi_flexform', $flexform) diff --git a/Classes/ViewHelpers/Link/EventViewHelper.php b/Classes/ViewHelpers/Link/EventViewHelper.php index aba79d2e..b0ed0b74 100644 --- a/Classes/ViewHelpers/Link/EventViewHelper.php +++ b/Classes/ViewHelpers/Link/EventViewHelper.php @@ -11,7 +11,6 @@ use Extcode\CartEvents\Domain\Model\Event; use Psr\Http\Message\ServerRequestInterface; use TYPO3\CMS\Core\Database\ConnectionPool; -use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\MathUtility; use TYPO3\CMS\Extbase\Mvc\RequestInterface; use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder; @@ -25,6 +24,13 @@ class EventViewHelper extends AbstractTagBasedViewHelper */ protected $tagName = 'a'; + public function __construct( + private readonly UriBuilder $uriBuilder, + private readonly ConnectionPool $connectionPool + ) { + parent::__construct(); + } + public function initializeArguments(): void { parent::initializeArguments(); @@ -115,7 +121,7 @@ public function render(): string $parameters = $this->arguments['arguments']; - $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); + $uriBuilder = $this->uriBuilder; $uriBuilder ->reset() ->setRequest($request) @@ -150,7 +156,7 @@ public function render(): string */ protected function getEventPage(Event $event) { - $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages'); + $queryBuilder = $this->connectionPool->getQueryBuilderForTable('pages'); return $queryBuilder->select('*') ->from('pages') ->where( diff --git a/Configuration/TCA/tx_cartevents_domain_model_event.php b/Configuration/TCA/tx_cartevents_domain_model_event.php index 8c2b5e6a..0aa2da0a 100644 --- a/Configuration/TCA/tx_cartevents_domain_model_event.php +++ b/Configuration/TCA/tx_cartevents_domain_model_event.php @@ -65,7 +65,7 @@ 'showitem' => 'hidden;' . $_LLL_db . ':tx_cartevents_domain_model_event', ], 'access' => [ - 'showitem' => 'starttime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:starttime_formlabel, endtime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:endtime_formlabel', + 'showitem' => 'starttime;core.db.general:starttime, endtime;core.db.general:endtime', ], ], 'columns' => [ diff --git a/Configuration/TCA/tx_cartevents_domain_model_eventdate.php b/Configuration/TCA/tx_cartevents_domain_model_eventdate.php index 20e42d94..a48d5df1 100644 --- a/Configuration/TCA/tx_cartevents_domain_model_eventdate.php +++ b/Configuration/TCA/tx_cartevents_domain_model_eventdate.php @@ -60,7 +60,7 @@ 'showitem' => 'hidden;' . $_LLL_db . ':tx_cartevents_domain_model_eventdate', ], 'access' => [ - 'showitem' => 'starttime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:starttime_formlabel, endtime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:endtime_formlabel', + 'showitem' => 'starttime;core.db.general:starttime, endtime;core.db.general:endtime', ], ], 'columns' => [ diff --git a/Configuration/TCA/tx_cartevents_domain_model_pricecategory.php b/Configuration/TCA/tx_cartevents_domain_model_pricecategory.php index 42649248..1f81bb14 100644 --- a/Configuration/TCA/tx_cartevents_domain_model_pricecategory.php +++ b/Configuration/TCA/tx_cartevents_domain_model_pricecategory.php @@ -34,10 +34,10 @@ ], 'types' => [ '1' => [ - 'showitem' => 'sku,title,price,special_prices,seats_number,seats_taken,--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.access,--palette--;LLL:EXT:cart_events/Resources/Private/Language/locallang_tca.xlf:palettes.visibility;hiddenonly,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.access;access', + 'showitem' => 'sku,title,price,special_prices,seats_number,seats_taken,--div--;core.form.tabs:access,--palette--;LLL:EXT:cart_events/Resources/Private/Language/locallang_tca.xlf:palettes.visibility;hiddenonly,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.access;access', ], '2' => [ - 'showitem' => 'sku,title,price,seats_number,seats_taken,--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.access,--palette--;LLL:EXT:cart_events/Resources/Private/Language/locallang_tca.xlf:palettes.visibility;hiddenonly,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.access;access', + 'showitem' => 'sku,title,price,seats_number,seats_taken,--div--;core.form.tabs:access,--palette--;LLL:EXT:cart_events/Resources/Private/Language/locallang_tca.xlf:palettes.visibility;hiddenonly,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.access;access', ], ], 'palettes' => [ @@ -48,7 +48,7 @@ 'showitem' => 'hidden;' . $_LLL_db . ':tx_cartevents_domain_model_pricecategory', ], 'access' => [ - 'showitem' => 'starttime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:starttime_formlabel, endtime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:endtime_formlabel', + 'showitem' => 'starttime;core.db.general:starttime, endtime;core.db.general:endtime', ], ], 'columns' => [ diff --git a/Configuration/TCA/tx_cartevents_domain_model_specialprice.php b/Configuration/TCA/tx_cartevents_domain_model_specialprice.php index 64caac88..b05c234c 100644 --- a/Configuration/TCA/tx_cartevents_domain_model_specialprice.php +++ b/Configuration/TCA/tx_cartevents_domain_model_specialprice.php @@ -34,7 +34,7 @@ ], 'types' => [ '1' => [ - 'showitem' => 'frontend_user_group,title,price,--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.access,--palette--;LLL:EXT:cart_events/Resources/Private/Language/locallang_tca.xlf:palettes.visibility;hiddenonly,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.access;access', + 'showitem' => 'frontend_user_group,title,price,--div--;core.form.tabs:access,--palette--;LLL:EXT:cart_events/Resources/Private/Language/locallang_tca.xlf:palettes.visibility;hiddenonly,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.access;access', ], ], 'palettes' => [ @@ -45,7 +45,7 @@ 'showitem' => 'hidden;' . $_LLL_db . ':tx_cartevents_domain_model_specialprice', ], 'access' => [ - 'showitem' => 'starttime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:starttime_formlabel, endtime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:endtime_formlabel', + 'showitem' => 'starttime;core.db.general:starttime, endtime;core.db.general:endtime', ], ], 'columns' => [ diff --git a/Documentation/Changelog/7.0/Index.rst b/Documentation/Changelog/7.0/Index.rst new file mode 100644 index 00000000..4698d33b --- /dev/null +++ b/Documentation/Changelog/7.0/Index.rst @@ -0,0 +1,11 @@ +.. include:: ../../Includes.rst.txt + +=========== +7.0 Changes +=========== + +**Table of contents** + +.. contents:: + :local: + :depth: 1 diff --git a/Documentation/Changelog/Index.rst b/Documentation/Changelog/Index.rst index 5856e100..66ea289a 100644 --- a/Documentation/Changelog/Index.rst +++ b/Documentation/Changelog/Index.rst @@ -10,6 +10,7 @@ ChangeLog :maxdepth: 5 :titlesonly: + 7.0/Index 6.0/Index 5.0/Index 4.0/Index diff --git a/Documentation/Introduction/Sponsoring/Index.rst b/Documentation/Introduction/Sponsoring/Index.rst index 5f4ecdbf..9e3b1f51 100644 --- a/Documentation/Introduction/Sponsoring/Index.rst +++ b/Documentation/Introduction/Sponsoring/Index.rst @@ -9,6 +9,5 @@ If there is a feature that has not yet been implemented in Cart or Cart Events, There is also the possibility to support the further development independently of new functions. * Ask for an invoice. -* `GitHub Sponsors `_ * `PayPal.Me `_ diff --git a/Documentation/guides.xml b/Documentation/guides.xml index 36ccd264..c3b06fb7 100644 --- a/Documentation/guides.xml +++ b/Documentation/guides.xml @@ -11,8 +11,8 @@ interlink-shortcode="extcode/cart_events" /> diff --git a/README.md b/README.md index fe97bac1..470955ee 100644 --- a/README.md +++ b/README.md @@ -42,9 +42,10 @@ Sometimes minor versions also result in minor adjustments to own templates or co | Cart Events | TYPO3 | PHP | Support/Development | |-------------|------------|-----------|--------------------------------------| -| 6.x.x | 13.4 | 8.2 - 8.4 | Features, Bugfixes, Security Updates | -| 5.x.x | 12.4 | 8.1 - 8.4 | Bugfixes, Security Updates | -| 4.x.x | 10.4, 11.5 | 7.2+ | Security Updates | +| 7.x.x | 14.1 | 8.2 - 8.4 | Features, Bugfixes, Security Updates | +| 6.x.x | 13.4 | 8.2 - 8.4 | Bugfixes, Security Updates | +| 5.x.x | 12.4 | 8.1 - 8.4 | Security Updates | +| 4.x.x | 10.4, 11.5 | 7.2+ | | | 3.x.x | 10.4 | 7.2 - 7.4 | | | 2.x.x | 9.5 | 7.2 - 7.4 | | | 1.x.x | 8.7 | 7.0 - 7.4 | | @@ -66,7 +67,6 @@ News uses **semantic versioning** which basically means for you, that ## 4. Sponsoring * Ask for an invoice. -* [GitHub Sponsors](https://github.com/sponsors/extcode) * [PayPal.Me](https://paypal.me/extcart) [1]: https://docs.typo3.org/typo3cms/extensions/cart_events/ diff --git a/composer.json b/composer.json index c30fe088..071bde4e 100644 --- a/composer.json +++ b/composer.json @@ -33,6 +33,8 @@ } }, "config": { + "bin-dir": ".build/bin", + "vendor-dir": ".build/vendor", "allow-plugins": { "typo3/cms-composer-installers": true, "typo3/class-alias-loader": true, @@ -40,20 +42,28 @@ "phpstan/extension-installer": true } }, + "version": "7.0.0", "extra": { "typo3/cms": { "extension-key": "cart_events", - "web-dir": ".build/web" + "web-dir": ".build/public" + } + }, + "minimum-stability": "dev", + "repositories": { + "extcode/cart": { + "type": "path", + "url": "../cart" } }, "require": { "php": "~8.2.0 || ~8.3.0 || ~8.4.0", "ext-json": "*", "ext-pdo": "*", - "extcode/cart": "^11.3", - "typo3/cms-core": "^13.4", - "typo3/cms-extbase": "^13.4", - "typo3/cms-fluid": "^13.4" + "extcode/cart": "^12.0", + "typo3/cms-core": "^14.1", + "typo3/cms-extbase": "^14.1", + "typo3/cms-fluid": "^14.1" }, "require-dev": { "codappix/typo3-php-datasets": "^2.1", @@ -66,12 +76,12 @@ "phpstan/phpstan": "^2.1", "phpstan/phpstan-deprecation-rules": "^2.0", "phpstan/phpstan-phpunit": "^2.0", - "saschaegerer/phpstan-typo3": "^2.1", "spaze/phpstan-disallowed-calls": "^4.7", "staabm/phpstan-todo-by": "^0.3", - "typo3/cms-fluid-styled-content": "^13.4", - "typo3/cms-install": "^13.4", - "typo3/testing-framework": "^8.0" + "typo3/cms-fluid-styled-content": "^14.1", + "typo3/cms-install": "^14.1", + "typo3/testing-framework": "^9.0", + "ssch/typo3-rector": "^3.11" }, "scripts": { "test:cgl": [ @@ -115,6 +125,6 @@ ] }, "suggest": { - "typo3/cms-form": "^13.4" + "typo3/cms-form": "^14.1" } } diff --git a/ext_emconf.php b/ext_emconf.php index 0dc2f820..09434787 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -4,15 +4,15 @@ 'title' => 'Cart - Events', 'description' => 'Shopping Cart(s) for TYPO3 - Event Extension', 'category' => 'plugin', - 'version' => '6.0.0', + 'version' => '7.0.0', 'state' => 'stable', 'author' => 'Daniel Gohlke', 'author_email' => 'ext@extco.de', 'author_company' => 'extco.de UG (haftungsbeschränkt)', 'constraints' => [ 'depends' => [ - 'typo3' => '13.4.0-13.4.99', - 'cart' => '11.3.0', + 'typo3' => '14.1.0-14.4.99', + 'cart' => '12.0.0', ], 'conflicts' => [], 'suggests' => [], diff --git a/ext_localconf.php b/ext_localconf.php index 3429c531..390dcc03 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -22,8 +22,7 @@ ], [ EventController::class => 'form', - ], - ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT + ] ); ExtensionUtility::configurePlugin( @@ -34,8 +33,7 @@ ], [ EventController::class => 'form', - ], - ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT + ] ); ExtensionUtility::configurePlugin( @@ -46,8 +44,7 @@ ], [ EventController::class => '', - ], - ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT + ] ); ExtensionUtility::configurePlugin( @@ -58,8 +55,7 @@ ], [ EventController::class => 'form', - ], - ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT + ] ); ExtensionUtility::configurePlugin( @@ -70,8 +66,7 @@ ], [ EventDateController::class => '', - ], - ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT + ] ); // Cart Hooks diff --git a/rector.php b/rector.php index be817ae0..d40bc110 100644 --- a/rector.php +++ b/rector.php @@ -6,7 +6,6 @@ use Rector\PostRector\Rector\NameImportingPostRector; use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector; use Rector\ValueObject\PhpVersion; -use Ssch\TYPO3Rector\CodeQuality\General\ConvertImplicitVariablesToExplicitGlobalsRector; use Ssch\TYPO3Rector\CodeQuality\General\ExtEmConfRector; use Ssch\TYPO3Rector\Configuration\Typo3Option; use Ssch\TYPO3Rector\Set\Typo3LevelSetList; @@ -27,7 +26,7 @@ ->withSets([ Typo3SetList::CODE_QUALITY, Typo3SetList::GENERAL, - Typo3LevelSetList::UP_TO_TYPO3_13, + Typo3LevelSetList::UP_TO_TYPO3_14, ]) // To have a better analysis from PHPStan, we teach it here some more things ->withPHPStanConfigs([ @@ -35,7 +34,6 @@ ]) ->withRules([ AddVoidReturnTypeWhereNoReturnRector::class, - ConvertImplicitVariablesToExplicitGlobalsRector::class, ]) ->withConfiguredRule(ExtEmConfRector::class, [ ExtEmConfRector::PHP_VERSION_CONSTRAINT => '8.2.0-8.4.99', @@ -46,6 +44,7 @@ ->withSkip([ // @see https://github.com/sabbelasichon/typo3-rector/issues/2536 __DIR__ . '/**/Configuration/ExtensionBuilder/*', + __DIR__ . '/vendor/*', NameImportingPostRector::class => [ 'ClassAliasMap.php', ], diff --git a/shell.nix b/shell.nix index 81275220..868fe00a 100644 --- a/shell.nix +++ b/shell.nix @@ -28,7 +28,7 @@ let composer ]; text = '' - rm -rf .Build/ vendor/ composer.lock + rm -rf .build/ composer.lock composer update --prefer-dist --no-progress --working-dir="$PROJECT_ROOT" ''; }; @@ -41,7 +41,7 @@ let ]; text = '' - ./vendor/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php -v --dry-run --diff + .build/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php -v --dry-run --diff ''; }; @@ -53,7 +53,7 @@ let ]; text = '' - ./vendor/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php + .build/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php ''; }; @@ -77,7 +77,7 @@ let ]; text = '' - ./vendor/bin/phpstan analyse -c Build/phpstan.neon --memory-limit 256M + .build/bin/phpstan analyse -c Build/phpstan.neon --memory-limit 256M ''; }; @@ -89,7 +89,7 @@ let ]; text = '' project-install - ./vendor/bin/phpunit -c Build/phpunit.xml.dist --testsuite unit --display-warnings --display-deprecations --display-errors + .build/bin/phpunit -c Build/phpunit.xml.dist --testsuite unit --display-warnings --display-deprecations --display-errors ''; }; @@ -101,7 +101,7 @@ let ]; text = '' project-install - ./vendor/bin/phpunit -c Build/phpunit.xml.dist --testsuite functional --display-warnings --display-deprecations --display-errors + .build/bin/phpunit -c Build/phpunit.xml.dist --testsuite functional --display-warnings --display-deprecations --display-errors ''; }; @@ -113,7 +113,7 @@ let ]; text = '' project-install - XDEBUG_MODE=coverage ./vendor/bin/phpunit -c Build/phpunit.xml.dist --coverage-html=coverage_result + XDEBUG_MODE=coverage .build/bin/phpunit -c Build/phpunit.xml.dist --coverage-html=coverage_result ''; }; @@ -137,7 +137,7 @@ let export INSTANCE_PATH="$PROJECT_ROOT/.build/web/typo3temp/var/tests/acceptance" - ./vendor/bin/codecept run + .build/bin/codecept run pgrep -f "php -S" | xargs -r kill pgrep -f "geckodriver" | xargs -r kill From a0d59138873248c384e75c6630fe653cfeb62a95 Mon Sep 17 00:00:00 2001 From: Daniel Gohlke Date: Sat, 11 Apr 2026 00:01:00 +0200 Subject: [PATCH 02/13] [FIX] Changes after updating dependencies --- .github/workflows/ci.yaml | 10 ++--- Build/.php-cs-fixer.dist.php | 5 +++ Build/phpstan.neon | 3 +- Classes/Domain/Model/Event.php | 6 +-- Classes/Domain/Model/EventDate.php | 10 ++--- Classes/Domain/Model/PriceCategory.php | 6 +-- Classes/Domain/Model/SpecialPrice.php | 4 +- .../CheckProductAvailability.php | 10 ++--- .../EventListener/Order/Stock/HandleStock.php | 4 +- Classes/Hooks/DataHandler.php | 5 +-- .../ExtcodeCartEventsCTypeMigration.php | 2 +- Configuration/TCA/Overrides/tt_content.php | 37 +++++++------------ ..._cartevents_domain_model_calendarentry.php | 3 +- .../TCA/tx_cartevents_domain_model_event.php | 1 - .../tx_cartevents_domain_model_eventdate.php | 1 - ..._cartevents_domain_model_pricecategory.php | 1 - ...x_cartevents_domain_model_specialprice.php | 1 - Tests/Acceptance/AddEventDateToCartCest.php | 18 ++++----- Tests/Acceptance/EventListCest.php | 16 ++++---- codeception.dist.yml | 6 +-- composer.json | 9 +---- ext_emconf.php | 20 ---------- shell.nix | 10 ++--- 23 files changed, 76 insertions(+), 112 deletions(-) delete mode 100644 ext_emconf.php diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6f2fd3ab..736dceb7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -70,11 +70,11 @@ jobs: matrix: include: - php-version: '8.2' - typo3-version: '^13.4' + typo3-version: '^14.1' - php-version: '8.3' - typo3-version: '^13.4' + typo3-version: '^14.1' - php-version: '8.4' - typo3-version: '^13.4' + typo3-version: '^14.1' steps: - uses: actions/checkout@v4 @@ -94,7 +94,7 @@ jobs: - name: Code Quality (by PHPStan) run: .build/bin/phpstan analyse -c Build/phpstan.neon - test-php: + test-unit-and-functional: runs-on: ubuntu-latest needs: - coding-guideline @@ -130,7 +130,7 @@ jobs: test-acceptance: runs-on: ubuntu-latest needs: - - test-php + - test-unit-and-functional steps: - uses: actions/checkout@v3 diff --git a/Build/.php-cs-fixer.dist.php b/Build/.php-cs-fixer.dist.php index 58818f6f..f33cf71a 100644 --- a/Build/.php-cs-fixer.dist.php +++ b/Build/.php-cs-fixer.dist.php @@ -11,6 +11,11 @@ (new PhpCsFixer\Finder()) ->ignoreVCSIgnored(true) ->in(__DIR__ . '/../') + ->exclude( + [ + 'var/', + ] + ) ) ->setRiskyAllowed(true) ->setRules([ diff --git a/Build/phpstan.neon b/Build/phpstan.neon index 1bf02736..513a8e03 100644 --- a/Build/phpstan.neon +++ b/Build/phpstan.neon @@ -8,10 +8,9 @@ parameters: - ../Classes - ../Configuration - ../Tests - - ../ext_emconf.php - ../ext_localconf.php excludePaths: - - '../Tests/Acceptance/Support/_generated/TesterActions.php' + - ../Tests/Acceptance/Support/_generated disallowedFunctionCalls: - diff --git a/Classes/Domain/Model/Event.php b/Classes/Domain/Model/Event.php index 53bc1e77..1c895801 100644 --- a/Classes/Domain/Model/Event.php +++ b/Classes/Domain/Model/Event.php @@ -29,10 +29,10 @@ class Event extends AbstractEntity protected ?string $formDefinition = null; - #[Validate(['validator' => 'NotEmpty'])] + #[Validate(validator: 'NotEmpty')] protected string $sku = ''; - #[Validate(['validator' => 'NotEmpty'])] + #[Validate(validator: 'NotEmpty')] protected string $title = ''; protected string $teaser = ''; @@ -54,7 +54,7 @@ class Event extends AbstractEntity /** * @var ObjectStorage */ - #[Cascade(['value' => 'remove'])] + #[Cascade(value: 'remove')] protected ObjectStorage $eventDates; /** diff --git a/Classes/Domain/Model/EventDate.php b/Classes/Domain/Model/EventDate.php index 5eef1843..b8b79798 100644 --- a/Classes/Domain/Model/EventDate.php +++ b/Classes/Domain/Model/EventDate.php @@ -22,10 +22,10 @@ class EventDate extends AbstractEventDate { protected Event $event; - #[Validate(['validator' => 'NotEmpty'])] + #[Validate(validator: 'NotEmpty')] protected string $sku = ''; - #[Validate(['validator' => 'NotEmpty'])] + #[Validate(validator: 'NotEmpty')] protected string $title = ''; protected string $location = ''; @@ -49,7 +49,7 @@ class EventDate extends AbstractEventDate /** * @var ObjectStorage */ - #[Cascade(['value' => 'remove'])] + #[Cascade(value: 'remove')] protected ObjectStorage $specialPrices; protected bool $priceCategorized = false; @@ -57,7 +57,7 @@ class EventDate extends AbstractEventDate /** * @var ObjectStorage */ - #[Cascade(['value' => 'remove'])] + #[Cascade(value: 'remove')] protected ObjectStorage $priceCategories; protected bool $handleSeats = false; @@ -71,7 +71,7 @@ class EventDate extends AbstractEventDate /** * @var ObjectStorage */ - #[Cascade(['value' => 'remove'])] + #[Cascade(value: 'remove')] protected ObjectStorage $calendarEntries; public function __construct() diff --git a/Classes/Domain/Model/PriceCategory.php b/Classes/Domain/Model/PriceCategory.php index 84080021..b39c3d90 100644 --- a/Classes/Domain/Model/PriceCategory.php +++ b/Classes/Domain/Model/PriceCategory.php @@ -22,10 +22,10 @@ class PriceCategory extends AbstractEntity { protected EventDate $eventDate; - #[Validate(['validator' => 'NotEmpty'])] + #[Validate(validator: 'NotEmpty')] protected string $sku = ''; - #[Validate(['validator' => 'NotEmpty'])] + #[Validate(validator: 'NotEmpty')] protected string $title = ''; protected float $price = 0.0; @@ -33,7 +33,7 @@ class PriceCategory extends AbstractEntity /** * @var ObjectStorage */ - #[Cascade(['value' => 'remove'])] + #[Cascade(value: 'remove')] protected ObjectStorage $specialPrices; protected int $seatsNumber = 0; diff --git a/Classes/Domain/Model/SpecialPrice.php b/Classes/Domain/Model/SpecialPrice.php index f967b4a1..3985ebc6 100644 --- a/Classes/Domain/Model/SpecialPrice.php +++ b/Classes/Domain/Model/SpecialPrice.php @@ -17,10 +17,10 @@ class SpecialPrice extends AbstractEntity { - #[Validate(['validator' => 'NotEmpty'])] + #[Validate(validator: 'NotEmpty')] protected string $title = ''; - #[Validate(['validator' => 'NotEmpty'])] + #[Validate(validator: 'NotEmpty')] protected float $price = 0.0; protected ?FrontendUserGroup $frontendUserGroup = null; diff --git a/Classes/EventListener/CheckProductAvailability.php b/Classes/EventListener/CheckProductAvailability.php index 00257765..83d8cca6 100644 --- a/Classes/EventListener/CheckProductAvailability.php +++ b/Classes/EventListener/CheckProductAvailability.php @@ -13,7 +13,7 @@ use Exception; use Extcode\Cart\Domain\Model\Cart\Cart; -use Extcode\Cart\Domain\Model\Cart\Product; +use Extcode\Cart\Domain\Model\Cart\ProductInterface; use Extcode\Cart\Event\CheckProductAvailabilityEvent; use Extcode\CartEvents\Domain\Model\EventDate; use Extcode\CartEvents\Domain\Model\PriceCategory; @@ -67,7 +67,7 @@ public function __invoke(CheckProductAvailabilityEvent $listenerEvent): void } } - protected function retrieveEventDateFromDatabase(Product $cartProduct): void + protected function retrieveEventDateFromDatabase(ProductInterface $cartProduct): void { $querySettings = $this->eventDateRepository->createQuery()->getQuerySettings(); $querySettings->setRespectStoragePage(false); @@ -80,7 +80,7 @@ protected function retrieveEventDateFromDatabase(Product $cartProduct): void $this->eventDate = $eventDate; } - protected function getQuantitiesFromRequest(Request $request, Product $cartProduct): mixed + protected function getQuantitiesFromRequest(Request $request, ProductInterface $cartProduct): mixed { if ($request->hasArgument('quantities')) { $quantities = $request->getArgument('quantities'); @@ -102,7 +102,7 @@ protected function getQuantitiesFromRequest(Request $request, Product $cartProdu } protected function hasEventDateEnoughSeats( - Product $cartProduct, + ProductInterface $cartProduct, Cart $cart, string $mode, int $quantity, @@ -129,7 +129,7 @@ protected function hasEventDateEnoughSeats( } protected function hasPriceCategoryEnoughSeats( - Product $cartProduct, + ProductInterface $cartProduct, Cart $cart, string $mode, string $beVariantId, diff --git a/Classes/EventListener/Order/Stock/HandleStock.php b/Classes/EventListener/Order/Stock/HandleStock.php index ac6532a9..5e91fd3d 100644 --- a/Classes/EventListener/Order/Stock/HandleStock.php +++ b/Classes/EventListener/Order/Stock/HandleStock.php @@ -12,7 +12,7 @@ */ use Exception; -use Extcode\Cart\Domain\Model\Cart\Product; +use Extcode\Cart\Domain\Model\Cart\ProductInterface; use Extcode\Cart\Event\Order\EventInterface; use Extcode\CartEvents\Domain\Model\EventDate; use Extcode\CartEvents\Domain\Model\PriceCategory; @@ -39,7 +39,7 @@ public function __invoke(EventInterface $event): void } } - protected function handleStockForEventDate(Product $cartProduct): void + protected function handleStockForEventDate(ProductInterface $cartProduct): void { $eventDate = $this->eventDateRepository->findByUid($cartProduct->getProductId()); diff --git a/Classes/Hooks/DataHandler.php b/Classes/Hooks/DataHandler.php index 695a09fc..0a28770a 100644 --- a/Classes/Hooks/DataHandler.php +++ b/Classes/Hooks/DataHandler.php @@ -11,12 +11,9 @@ use TYPO3\CMS\Core\Cache\CacheManager; -/** - * Hook into tcemain which is used to show preview of news item - */ class DataHandler { - public function __construct() {} + public function __construct(private readonly CacheManager $cacheManager) {} /** * Flushes the cache if a news record was edited. diff --git a/Classes/Updates/ExtcodeCartEventsCTypeMigration.php b/Classes/Updates/ExtcodeCartEventsCTypeMigration.php index 0860aa51..792e918e 100644 --- a/Classes/Updates/ExtcodeCartEventsCTypeMigration.php +++ b/Classes/Updates/ExtcodeCartEventsCTypeMigration.php @@ -23,7 +23,7 @@ public function getDescription(): string protected function getListTypeToCTypeMapping(): array { return [ - 'cartevents' => 'cartevents_listevents' + 'cartevents' => 'cartevents_listevents', ]; } } diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index 8abbb6f8..ddbfa801 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -2,7 +2,6 @@ defined('TYPO3') or die(); -use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Utility\ExtensionUtility; @@ -33,30 +32,22 @@ ], ]; - foreach ($pluginNames as $pluginName => $pluginConf) { - $pluginSignature = ExtensionUtility::registerPlugin( - 'cart_events', - $pluginName, - $pluginConf['translationKeyPrefix'] . '.title', - $pluginConf['pluginIcon'], - 'cart', - $pluginConf['translationKeyPrefix'] . '.description', - ); - + foreach ($pluginNames as $pluginName => $pluginConfig) { $flexFormPath = 'EXT:cart_events/Configuration/FlexForms/' . $pluginName . 'Plugin.xml'; if (file_exists(GeneralUtility::getFileAbsFileName($flexFormPath))) { - ExtensionManagementUtility::addToAllTCAtypes( - 'tt_content', - rtrim('--div--;Configuration,pi_flexform,' . ($pluginConf['additionalNewFields'] ?? ''), ','), - $pluginSignature, - 'after:subheader', - ); - - ExtensionManagementUtility::addPiFlexFormValue( - '*', - 'FILE:' . $flexFormPath, - $pluginSignature, - ); + $flexFormPath = 'FILE:' . $flexFormPath; + } else { + $flexFormPath = ''; } + + ExtensionUtility::registerPlugin( + 'CartEvents', + $pluginName, + $pluginConfig['translationKeyPrefix'] . '.title', + $pluginConfig['pluginIcon'], + 'cart', + $pluginConfig['translationKeyPrefix'] . '.description', + $flexFormPath + ); } }); diff --git a/Configuration/TCA/tx_cartevents_domain_model_calendarentry.php b/Configuration/TCA/tx_cartevents_domain_model_calendarentry.php index 9d24d3f9..0fac495b 100644 --- a/Configuration/TCA/tx_cartevents_domain_model_calendarentry.php +++ b/Configuration/TCA/tx_cartevents_domain_model_calendarentry.php @@ -15,6 +15,8 @@ 'tstamp' => 'tstamp', 'crdate' => 'crdate', + 'versioningWS' => true, + 'hideTable' => true, 'delete' => 'deleted', 'enablecolumns' => [ @@ -22,7 +24,6 @@ 'starttime' => 'starttime', 'endtime' => 'endtime', ], - 'searchFields' => 'title', 'iconfile' => 'EXT:cart_events/Resources/Public/Icons/tx_cartevents_domain_model_calendarentry.svg', ], 'types' => [ diff --git a/Configuration/TCA/tx_cartevents_domain_model_event.php b/Configuration/TCA/tx_cartevents_domain_model_event.php index 0aa2da0a..7ca65588 100644 --- a/Configuration/TCA/tx_cartevents_domain_model_event.php +++ b/Configuration/TCA/tx_cartevents_domain_model_event.php @@ -32,7 +32,6 @@ 'starttime' => 'starttime', 'endtime' => 'endtime', ], - 'searchFields' => 'sku,title,teaser,description,audience', 'iconfile' => 'EXT:cart_events/Resources/Public/Icons/tx_cartevents_domain_model_event.svg', ], 'types' => [ diff --git a/Configuration/TCA/tx_cartevents_domain_model_eventdate.php b/Configuration/TCA/tx_cartevents_domain_model_eventdate.php index a48d5df1..31b58ae5 100644 --- a/Configuration/TCA/tx_cartevents_domain_model_eventdate.php +++ b/Configuration/TCA/tx_cartevents_domain_model_eventdate.php @@ -32,7 +32,6 @@ 'starttime' => 'starttime', 'endtime' => 'endtime', ], - 'searchFields' => 'sku,title,', 'iconfile' => 'EXT:cart_events/Resources/Public/Icons/tx_cartevents_domain_model_eventdate.svg', ], 'types' => [ diff --git a/Configuration/TCA/tx_cartevents_domain_model_pricecategory.php b/Configuration/TCA/tx_cartevents_domain_model_pricecategory.php index 1f81bb14..eb6a89b7 100644 --- a/Configuration/TCA/tx_cartevents_domain_model_pricecategory.php +++ b/Configuration/TCA/tx_cartevents_domain_model_pricecategory.php @@ -29,7 +29,6 @@ 'endtime' => 'endtime', 'fe_group' => 'frontend_user_group', ], - 'searchFields' => 'price', 'iconfile' => 'EXT:cart_events/Resources/Public/Icons/tx_cartevents_domain_model_pricecategory.svg', ], 'types' => [ diff --git a/Configuration/TCA/tx_cartevents_domain_model_specialprice.php b/Configuration/TCA/tx_cartevents_domain_model_specialprice.php index b05c234c..52b1a69d 100644 --- a/Configuration/TCA/tx_cartevents_domain_model_specialprice.php +++ b/Configuration/TCA/tx_cartevents_domain_model_specialprice.php @@ -29,7 +29,6 @@ 'endtime' => 'endtime', 'fe_group' => 'frontend_user_group', ], - 'searchFields' => 'price', 'iconfile' => 'EXT:cart_events/Resources/Public/Icons/tx_cartevents_domain_model_specialprice.svg', ], 'types' => [ diff --git a/Tests/Acceptance/AddEventDateToCartCest.php b/Tests/Acceptance/AddEventDateToCartCest.php index 5989aa4b..c6e1fce5 100644 --- a/Tests/Acceptance/AddEventDateToCartCest.php +++ b/Tests/Acceptance/AddEventDateToCartCest.php @@ -26,7 +26,7 @@ public function addBookableEventToCart(Tester $I): void $I->amOnUrl('http://127.0.0.1:8080/events/'); - $I->seeLink('Event 2', 'http://127.0.0.1:8080/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=2&cHash=18eb8b460c56ca88173743ab54524f53'); + $I->seeLink('Event 2', 'http://127.0.0.1:8080/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=2&cHash=450745d03483c4859d3a1b473248805a9c203398d65a61de0b354060c9f931e8'); $I->click('Event 2'); $I->see('19,99 €'); @@ -68,7 +68,7 @@ public function addBookableEventDateWithoutSeatHandlingToCart(Tester $I): void $I->amOnUrl('http://127.0.0.1:8080/events/'); - $I->seeLink('Event 2', 'http://127.0.0.1:8080/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=2&cHash=18eb8b460c56ca88173743ab54524f53'); + $I->seeLink('Event 2', 'http://127.0.0.1:8080/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=2&cHash=450745d03483c4859d3a1b473248805a9c203398d65a61de0b354060c9f931e8'); $I->click('Event 2'); $I->see('19,99 €'); @@ -104,7 +104,7 @@ public function addBookableEventDateWithAvailableNumberOfSeatToCart(Tester $I): $I->amOnUrl('http://127.0.0.1:8080/events/'); - $I->seeLink('Event 3', 'http://127.0.0.1:8080/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=3&cHash=e30dcda6967105cf51f3d0ed454f4ba1'); + $I->seeLink('Event 3', 'http://127.0.0.1:8080/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=3&cHash=e3c7dc358f2d8bb5e208269ff77dc649401eb6a1112dd417284e1cd9eea79cf6'); $I->click('Event 3'); $I->dontSee('This event date can not be booked.'); @@ -149,7 +149,7 @@ public function addDifferentBookableEventDatesWithAvailableNumberOfSeatToCart(Te $I->amOnUrl('http://127.0.0.1:8080/events/'); - $I->seeLink('Event 3', 'http://127.0.0.1:8080/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=3&cHash=e30dcda6967105cf51f3d0ed454f4ba1'); + $I->seeLink('Event 3', 'http://127.0.0.1:8080/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=3&cHash=e3c7dc358f2d8bb5e208269ff77dc649401eb6a1112dd417284e1cd9eea79cf6'); $I->click('Event 3'); $I->dontSee('This event date can not be booked.'); @@ -203,7 +203,7 @@ public function addBookableEventDateWithAvailableNumberOfSeatButNotMoreToCart(Te $I->amOnUrl('http://127.0.0.1:8080/events/'); - $I->seeLink('Event 3', 'http://127.0.0.1:8080/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=3&cHash=e30dcda6967105cf51f3d0ed454f4ba1'); + $I->seeLink('Event 3', 'http://127.0.0.1:8080/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=3&cHash=e3c7dc358f2d8bb5e208269ff77dc649401eb6a1112dd417284e1cd9eea79cf6'); $I->click('Event 3'); $I->dontSee('This event date can not be booked.'); @@ -257,7 +257,7 @@ public function addDifferentBookableEventDateWithAvailableNumberOfSeatButNotMore $I->amOnUrl('http://127.0.0.1:8080/events/'); - $I->seeLink('Event 3', 'http://127.0.0.1:8080/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=3&cHash=e30dcda6967105cf51f3d0ed454f4ba1'); + $I->seeLink('Event 3', 'http://127.0.0.1:8080/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=3&cHash=e3c7dc358f2d8bb5e208269ff77dc649401eb6a1112dd417284e1cd9eea79cf6'); $I->click('Event 3'); $I->dontSee('This event date can not be booked.'); @@ -341,7 +341,7 @@ public function addBookableEventDateWithPriceCategoryAvailableNumberOfSeatToCart $I->amOnUrl('http://127.0.0.1:8080/events/'); - $I->seeLink('Event 5', '/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=5&cHash=18ff1dbf4acad08e4f2f23af33a5c222'); + $I->seeLink('Event 5', '/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=5&cHash=a29b848a49590cddc74a4254bf44ebd62d98aa86a0ca041d599aab508fcb7539'); $I->click('Event 5'); $I->selectOption("select[name='tx_cart_cart[priceCategory]']", 'Category C'); @@ -372,7 +372,7 @@ public function addBookableEventDateWithPriceCategoryAvailableNumberOfSeatButNot $I->amOnUrl('http://127.0.0.1:8080/events/'); - $I->seeLink('Event 5', '/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=5&cHash=18ff1dbf4acad08e4f2f23af33a5c222'); + $I->seeLink('Event 5', '/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=5&cHash=a29b848a49590cddc74a4254bf44ebd62d98aa86a0ca041d599aab508fcb7539'); $I->click('Event 5'); $I->selectOption("select[name='tx_cart_cart[priceCategory]']", 'Category B'); @@ -413,7 +413,7 @@ public function addDifferentBookableEventDateWithPriceCategoryAvailableNumberOfS $I->amOnUrl('http://127.0.0.1:8080/events/'); - $I->seeLink('Event 5', '/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=5&cHash=18ff1dbf4acad08e4f2f23af33a5c222'); + $I->seeLink('Event 5', '/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=5&cHash=a29b848a49590cddc74a4254bf44ebd62d98aa86a0ca041d599aab508fcb7539'); $I->click('Event 5'); $I->wantTo('Add the price group "Category B" with quantity of 37 to cart.'); diff --git a/Tests/Acceptance/EventListCest.php b/Tests/Acceptance/EventListCest.php index 1caab50b..f89ac2e0 100644 --- a/Tests/Acceptance/EventListCest.php +++ b/Tests/Acceptance/EventListCest.php @@ -23,11 +23,11 @@ public function listForEvents(Tester $I): void { $I->amOnUrl('http://127.0.0.1:8080/events/'); - $I->seeLink('Event 1', '/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=1&cHash=b94e793b120e29763527f801db80844c'); + $I->seeLink('Event 1', '/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=1&cHash=11fefb67eb75bf4d0bb8bd49b29bef7c17a1c7ebd487deb6da11de8476328d5e'); $I->see('Teaser 1'); - $I->seeLink('Event 2', '/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=2&cHash=18eb8b460c56ca88173743ab54524f53'); + $I->seeLink('Event 2', '/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=2&cHash=450745d03483c4859d3a1b473248805a9c203398d65a61de0b354060c9f931e8'); $I->see('Teaser 2'); - $I->seeLink('Event 3', '/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=3&cHash=e30dcda6967105cf51f3d0ed454f4ba1'); + $I->seeLink('Event 3', '/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=3&cHash=e3c7dc358f2d8bb5e208269ff77dc649401eb6a1112dd417284e1cd9eea79cf6'); $I->see('Teaser 3'); $I->dontSee('Event 4'); @@ -38,7 +38,7 @@ public function detailViewForNonBookableEvent(Tester $I): void { $I->amOnUrl('http://127.0.0.1:8080/events/'); - $I->seeLink('Event 1', '/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=1&cHash=b94e793b120e29763527f801db80844c'); + $I->seeLink('Event 1', '/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=1&cHash=11fefb67eb75bf4d0bb8bd49b29bef7c17a1c7ebd487deb6da11de8476328d5e'); $I->click('Event 1'); $I->see('Event 1', 'h1'); @@ -51,7 +51,7 @@ public function detailViewForBookableEventWithOneEventdateWithoutPriceCategories { $I->amOnUrl('http://127.0.0.1:8080/events/'); - $I->seeLink('Event 2', '/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=2&cHash=18eb8b460c56ca88173743ab54524f53'); + $I->seeLink('Event 2', '/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=2&cHash=450745d03483c4859d3a1b473248805a9c203398d65a61de0b354060c9f931e8'); $I->click('Event 2'); $I->see('Event 2', 'h1'); @@ -71,7 +71,7 @@ public function detailViewForBookableEventWithTwoOrMoreEventdatesWithoutPriceCat { $I->amOnUrl('http://127.0.0.1:8080/events/'); - $I->seeLink('Event 3', '/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=3&cHash=e30dcda6967105cf51f3d0ed454f4ba1'); + $I->seeLink('Event 3', '/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=3&cHash=e3c7dc358f2d8bb5e208269ff77dc649401eb6a1112dd417284e1cd9eea79cf6'); $I->click('Event 3'); $I->see('Event 3', 'h1'); @@ -101,7 +101,7 @@ public function detailViewForBookableEventWithPriceCategories(Tester $I): void $I->amOnUrl('http://127.0.0.1:8080/events/'); - $I->seeLink('Event 5', '/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=5&cHash=18ff1dbf4acad08e4f2f23af33a5c222'); + $I->seeLink('Event 5', '/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=5&cHash=a29b848a49590cddc74a4254bf44ebd62d98aa86a0ca041d599aab508fcb7539'); $I->click('Event 5'); $I->see('Event 5', 'h1'); @@ -152,7 +152,7 @@ public function selectOptionForBookableEventWithPriceCategoriesChangePrice(Teste $I->amOnUrl('http://127.0.0.1:8080/events/'); - $I->seeLink('Event 5', '/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=5&cHash=18ff1dbf4acad08e4f2f23af33a5c222'); + $I->seeLink('Event 5', '/events?tx_cartevents_listevents%5Baction%5D=show&tx_cartevents_listevents%5Bcontroller%5D=Event&tx_cartevents_listevents%5Bevent%5D=5&cHash=a29b848a49590cddc74a4254bf44ebd62d98aa86a0ca041d599aab508fcb7539'); $I->click('Event 5'); $I->see('15,00 €', '.event-event-date:nth-child(1) span.regular-price > span.price'); diff --git a/codeception.dist.yml b/codeception.dist.yml index 9808a21b..2e7c30cd 100644 --- a/codeception.dist.yml +++ b/codeception.dist.yml @@ -3,7 +3,7 @@ namespace: 'Extcode\CartEvents\Tests\Acceptance\Support' paths: tests: 'Tests/Acceptance' data: 'Tests/Acceptance/Data' - output: '.build/web/typo3temp/var/tests/acceptance-reports' + output: '.build/public/typo3temp/var/tests/acceptance-reports' support: 'Tests/Acceptance/Support' settings: @@ -13,8 +13,8 @@ extensions: enabled: - 'Codeception\Extension\RunProcess': - - 'geckodriver > .build/web/typo3temp/var/tests/acceptance-logs/geckodriver.log 2>&1' - - 'TYPO3_PATH_APP="$INSTANCE_PATH" TYPO3_PATH_ROOT="$INSTANCE_PATH" php -S 127.0.0.1:8080 -t "$INSTANCE_PATH" > .build/web/typo3temp/var/tests/acceptance-logs/php.log 2>&1' + - 'geckodriver > .build/public/typo3temp/var/tests/acceptance-logs/geckodriver.log 2>&1' + - 'TYPO3_PATH_APP="$INSTANCE_PATH" TYPO3_PATH_ROOT="$INSTANCE_PATH" php -S 127.0.0.1:8080 -t "$INSTANCE_PATH" > .build/public/typo3temp/var/tests/acceptance-logs/php.log 2>&1' - 'Codeception\Extension\Recorder' - diff --git a/composer.json b/composer.json index 071bde4e..72c3e7dd 100644 --- a/composer.json +++ b/composer.json @@ -50,17 +50,12 @@ } }, "minimum-stability": "dev", - "repositories": { - "extcode/cart": { - "type": "path", - "url": "../cart" - } - }, + "prefer-stable": true, "require": { "php": "~8.2.0 || ~8.3.0 || ~8.4.0", "ext-json": "*", "ext-pdo": "*", - "extcode/cart": "^12.0", + "extcode/cart": "dev-12.x-dev as 12.0.0", "typo3/cms-core": "^14.1", "typo3/cms-extbase": "^14.1", "typo3/cms-fluid": "^14.1" diff --git a/ext_emconf.php b/ext_emconf.php deleted file mode 100644 index 09434787..00000000 --- a/ext_emconf.php +++ /dev/null @@ -1,20 +0,0 @@ - 'Cart - Events', - 'description' => 'Shopping Cart(s) for TYPO3 - Event Extension', - 'category' => 'plugin', - 'version' => '7.0.0', - 'state' => 'stable', - 'author' => 'Daniel Gohlke', - 'author_email' => 'ext@extco.de', - 'author_company' => 'extco.de UG (haftungsbeschränkt)', - 'constraints' => [ - 'depends' => [ - 'typo3' => '14.1.0-14.4.99', - 'cart' => '12.0.0', - ], - 'conflicts' => [], - 'suggests' => [], - ], -]; diff --git a/shell.nix b/shell.nix index 868fe00a..b6b8be8f 100644 --- a/shell.nix +++ b/shell.nix @@ -130,12 +130,12 @@ let text = '' project-install - mkdir -p "$PROJECT_ROOT/.build/web/typo3temp/var/tests/acceptance" - mkdir -p "$PROJECT_ROOT/.build/web/typo3temp/var/tests/acceptance-logs" - mkdir -p "$PROJECT_ROOT/.build/web/typo3temp/var/tests/acceptance-reports" - mkdir -p "$PROJECT_ROOT/.build/web/typo3temp/var/tests/acceptance-sqlite-dbs" + mkdir -p "$PROJECT_ROOT/.build/public/typo3temp/var/tests/acceptance" + mkdir -p "$PROJECT_ROOT/.build/public/typo3temp/var/tests/acceptance-logs" + mkdir -p "$PROJECT_ROOT/.build/public/typo3temp/var/tests/acceptance-reports" + mkdir -p "$PROJECT_ROOT/.build/public/typo3temp/var/tests/acceptance-sqlite-dbs" - export INSTANCE_PATH="$PROJECT_ROOT/.build/web/typo3temp/var/tests/acceptance" + export INSTANCE_PATH="$PROJECT_ROOT/.build/public/typo3temp/var/tests/acceptance" .build/bin/codecept run From eb682ad8eaaeb19fec5b63438a83dea78e593ed5 Mon Sep 17 00:00:00 2001 From: Daniel Gohlke Date: Sat, 11 Apr 2026 10:02:31 +0200 Subject: [PATCH 03/13] [TASK] Add support and tests for PHP 8.5 --- .github/workflows/ci.yaml | 19 ++++++++++++++++--- README.md | 2 +- composer.json | 16 ++++++++-------- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 736dceb7..32cbb3c7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -18,6 +18,7 @@ jobs: - 8.2 - 8.3 - 8.4 + - 8.5 steps: - name: Checkout uses: actions/checkout@v4 @@ -70,11 +71,13 @@ jobs: matrix: include: - php-version: '8.2' - typo3-version: '^14.1' + typo3-version: '^14.2' - php-version: '8.3' - typo3-version: '^14.1' + typo3-version: '^14.2' - php-version: '8.4' - typo3-version: '^14.1' + typo3-version: '^14.2' + - php-version: '8.5' + typo3-version: '^14.2' steps: - uses: actions/checkout@v4 @@ -118,6 +121,9 @@ jobs: - name: Run Unit Tests PHP8.4 run: nix-shell --arg phpVersion \"php84\" --pure --run project-test-unit + - name: Run Unit Tests PHP8.5 + run: nix-shell --arg phpVersion \"php85\" --pure --run project-test-unit + - name: Run Functional Tests PHP8.2 run: nix-shell --arg phpVersion \"php82\" --pure --run project-test-functional @@ -127,6 +133,9 @@ jobs: - name: Run Functional Tests PHP8.4 run: nix-shell --arg phpVersion \"php84\" --pure --run project-test-functional + - name: Run Functional Tests PHP8.5 + run: nix-shell --arg phpVersion \"php85\" --pure --run project-test-functional + test-acceptance: runs-on: ubuntu-latest needs: @@ -149,3 +158,7 @@ jobs: - name: Run Acceptance Tests PHP8.4 run: nix-shell --arg phpVersion \"php84\" --pure --run project-test-acceptance + + - name: Run Acceptance Tests PHP8.5 + run: nix-shell --arg phpVersion \"php85\" --pure --run project-test-acceptance + diff --git a/README.md b/README.md index 470955ee..d38bc6d7 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Sometimes minor versions also result in minor adjustments to own templates or co | Cart Events | TYPO3 | PHP | Support/Development | |-------------|------------|-----------|--------------------------------------| -| 7.x.x | 14.1 | 8.2 - 8.4 | Features, Bugfixes, Security Updates | +| 7.x.x | 14.2 | 8.2 - 8.5 | Features, Bugfixes, Security Updates | | 6.x.x | 13.4 | 8.2 - 8.4 | Bugfixes, Security Updates | | 5.x.x | 12.4 | 8.1 - 8.4 | Security Updates | | 4.x.x | 10.4, 11.5 | 7.2+ | | diff --git a/composer.json b/composer.json index 72c3e7dd..8c5a137b 100644 --- a/composer.json +++ b/composer.json @@ -52,13 +52,13 @@ "minimum-stability": "dev", "prefer-stable": true, "require": { - "php": "~8.2.0 || ~8.3.0 || ~8.4.0", + "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0", "ext-json": "*", "ext-pdo": "*", "extcode/cart": "dev-12.x-dev as 12.0.0", - "typo3/cms-core": "^14.1", - "typo3/cms-extbase": "^14.1", - "typo3/cms-fluid": "^14.1" + "typo3/cms-core": "^14.2", + "typo3/cms-extbase": "^14.2", + "typo3/cms-fluid": "^14.2" }, "require-dev": { "codappix/typo3-php-datasets": "^2.1", @@ -73,9 +73,9 @@ "phpstan/phpstan-phpunit": "^2.0", "spaze/phpstan-disallowed-calls": "^4.7", "staabm/phpstan-todo-by": "^0.3", - "typo3/cms-fluid-styled-content": "^14.1", - "typo3/cms-install": "^14.1", - "typo3/testing-framework": "^9.0", + "typo3/cms-fluid-styled-content": "^14.2", + "typo3/cms-install": "^14.2", + "typo3/testing-framework": "^9.3", "ssch/typo3-rector": "^3.11" }, "scripts": { @@ -120,6 +120,6 @@ ] }, "suggest": { - "typo3/cms-form": "^14.1" + "typo3/cms-form": "^14.2" } } From 701155dedd74730cdf4986c721b1b3a498ddb01e Mon Sep 17 00:00:00 2001 From: Daniel Gohlke Date: Fri, 24 Apr 2026 21:05:59 +0200 Subject: [PATCH 04/13] [TASK] Raise TYPO3 dependency to 14.3 --- .github/workflows/ci.yaml | 81 ++++++++++++++++----------------------- README.md | 2 +- composer.json | 40 ++++++++++--------- shell.nix | 32 +++++++++------- 4 files changed, 75 insertions(+), 80 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 32cbb3c7..89e8fb98 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -61,7 +61,7 @@ jobs: run: composer install --prefer-dist --no-progress --no-suggest - name: Coding Guideline - run: .build/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php -v --dry-run --using-cache=no --path-mode=intersection ./ + run: composer project:cgl code-quality: runs-on: ubuntu-latest @@ -69,15 +69,11 @@ jobs: - php-linting strategy: matrix: - include: - - php-version: '8.2' - typo3-version: '^14.2' - - php-version: '8.3' - typo3-version: '^14.2' - - php-version: '8.4' - typo3-version: '^14.2' - - php-version: '8.5' - typo3-version: '^14.2' + php-version: + - 8.2 + - 8.3 + - 8.4 + - 8.5 steps: - uses: actions/checkout@v4 @@ -89,66 +85,56 @@ jobs: - name: Install dependencies with expected TYPO3 version run: |- - composer require --no-interaction --prefer-dist --no-progress "typo3/cms-core:${{ matrix.typo3-version }}" "typo3/cms-extbase:${{ matrix.typo3-version }}" "typo3/cms-frontend:${{ matrix.typo3-version }}" + composer remove --dev ssch/typo3-rector \ + && composer require typo3/cms-install "*" \ + && composer install --no-progress --no-ansi --no-interaction - name: Build codeception tester run: .build/bin/codecept build - name: Code Quality (by PHPStan) - run: .build/bin/phpstan analyse -c Build/phpstan.neon + run: composer project:phpstan - test-unit-and-functional: + tests-unit-and-functional: runs-on: ubuntu-latest needs: - coding-guideline - code-quality + strategy: + matrix: + php-version: + - 8.2 + - 8.3 + - 8.4 + - 8.5 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v17 + - name: Install PHP + uses: shivammathur/setup-php@v2 with: - nix_path: nixpkgs=channel:nixos-unstable:phps=https://github.com/fossar/nix-phps/archive/master.tar.gz - extra_nix_config: | - trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= fossar.cachix.org-1:Zv6FuqIboeHPWQS7ysLCJ7UT7xExb4OE8c4LyGb5AsE= - substituters = https://cache.nixos.org/ https://fossar.cachix.org - - - name: Run Unit Tests PHP8.2 - run: nix-shell --arg phpVersion \"php82\" --pure --run project-test-unit - - - name: Run Unit Tests PHP8.3 - run: nix-shell --arg phpVersion \"php83\" --pure --run project-test-unit - - - name: Run Unit Tests PHP8.4 - run: nix-shell --arg phpVersion \"php84\" --pure --run project-test-unit - - - name: Run Unit Tests PHP8.5 - run: nix-shell --arg phpVersion \"php85\" --pure --run project-test-unit - - - name: Run Functional Tests PHP8.2 - run: nix-shell --arg phpVersion \"php82\" --pure --run project-test-functional + php-version: "${{ matrix.php-version }}" + tools: composer:v2 - - name: Run Functional Tests PHP8.3 - run: nix-shell --arg phpVersion \"php83\" --pure --run project-test-functional + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-suggest - - name: Run Functional Tests PHP8.4 - run: nix-shell --arg phpVersion \"php84\" --pure --run project-test-functional + - name: Run unit tests + run: composer project:test:unit - - name: Run Functional Tests PHP8.5 - run: nix-shell --arg phpVersion \"php85\" --pure --run project-test-functional + - name: Run functional tests + run: export typo3DatabaseDriver=pdo_sqlite && composer project:test:functional test-acceptance: runs-on: ubuntu-latest needs: - - test-unit-and-functional + - tests-unit-and-functional steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v5 - - uses: cachix/install-nix-action@v17 + - uses: cachix/install-nix-action@v31 with: - nix_path: nixpkgs=channel:nixos-unstable:phps=https://github.com/fossar/nix-phps/archive/master.tar.gz - extra_nix_config: | - trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= fossar.cachix.org-1:Zv6FuqIboeHPWQS7ysLCJ7UT7xExb4OE8c4LyGb5AsE= - substituters = https://cache.nixos.org/ https://fossar.cachix.org + nix_path: nixpkgs=channel:nixos-unstable - name: Run Acceptance Tests PHP8.2 run: nix-shell --arg phpVersion \"php82\" --pure --run project-test-acceptance @@ -161,4 +147,3 @@ jobs: - name: Run Acceptance Tests PHP8.5 run: nix-shell --arg phpVersion \"php85\" --pure --run project-test-acceptance - diff --git a/README.md b/README.md index d38bc6d7..1868755a 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Sometimes minor versions also result in minor adjustments to own templates or co | Cart Events | TYPO3 | PHP | Support/Development | |-------------|------------|-----------|--------------------------------------| -| 7.x.x | 14.2 | 8.2 - 8.5 | Features, Bugfixes, Security Updates | +| 7.x.x | 14.3 | 8.2 - 8.5 | Features, Bugfixes, Security Updates | | 6.x.x | 13.4 | 8.2 - 8.4 | Bugfixes, Security Updates | | 5.x.x | 12.4 | 8.1 - 8.4 | Security Updates | | 4.x.x | 10.4, 11.5 | 7.2+ | | diff --git a/composer.json b/composer.json index 8c5a137b..52339cb1 100644 --- a/composer.json +++ b/composer.json @@ -55,10 +55,10 @@ "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0", "ext-json": "*", "ext-pdo": "*", - "extcode/cart": "dev-12.x-dev as 12.0.0", - "typo3/cms-core": "^14.2", - "typo3/cms-extbase": "^14.2", - "typo3/cms-fluid": "^14.2" + "extcode/cart": "dev-main as 12.0.0", + "typo3/cms-core": "^14.3", + "typo3/cms-extbase": "^14.3", + "typo3/cms-fluid": "^14.3" }, "require-dev": { "codappix/typo3-php-datasets": "^2.1", @@ -73,29 +73,33 @@ "phpstan/phpstan-phpunit": "^2.0", "spaze/phpstan-disallowed-calls": "^4.7", "staabm/phpstan-todo-by": "^0.3", - "typo3/cms-fluid-styled-content": "^14.2", - "typo3/cms-install": "^14.2", + "typo3/cms-fluid-styled-content": "^14.3", + "typo3/cms-install": "^14.3", "typo3/testing-framework": "^9.3", "ssch/typo3-rector": "^3.11" }, "scripts": { - "test:cgl": [ - "vendor/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php -v --using-cache=no --path-mode=intersection ./" + "project:reinstall": [ + "rm -rf .build/ composer.lock", + "composer update --prefer-dist --no-progress --working-dir=\"$PROJECT_ROOT\"" ], - "test:cgl:dry-run": [ - "vendor/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php -v --dry-run --using-cache=no --path-mode=intersection ./" + "project:cgl": [ + ".build/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php -v --using-cache=no --dry-run --diff" ], - "test:php:lint": [ + "project:cgl-fix": [ + ".build/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php -v --using-cache=no" + ], + "project:lint:php": [ "find *.php Classes Configuration Tests -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l" ], - "test:php:unit": [ - "vendor/bin/phpunit -c Build/UnitTests.xml" + "project:phpstan": [ + ".build/bin/phpstan analyse -c Build/phpstan.neon --memory-limit 256M" ], - "test:php:functional": [ - "typo3DatabaseDriver=\"pdo_sqlite\" vendor/bin/phpunit -c Build/FunctionalTests.xml" + "project:test:unit": [ + ".build/bin/phpunit -c Build/phpunit.xml.dist --testsuite unit --display-warnings --display-deprecations --display-errors" ], - "test:phpstan:analyse": [ - "vendor/bin/phpstan analyse -c Build/phpstan.neon" + "project:test:functional": [ + ".build/bin/phpunit -c Build/phpunit.xml.dist --testsuite functional --display-warnings --display-deprecations --display-errors" ], "test:rector:process": [ "vendor/bin/rector process" @@ -120,6 +124,6 @@ ] }, "suggest": { - "typo3/cms-form": "^14.2" + "typo3/cms-form": "^14.3" } } diff --git a/shell.nix b/shell.nix index b6b8be8f..63beacf8 100644 --- a/shell.nix +++ b/shell.nix @@ -24,12 +24,12 @@ let projectInstall = pkgs.writeShellApplication { name = "project-install"; runtimeInputs = [ - php composer + php ]; text = '' - rm -rf .build/ composer.lock - composer update --prefer-dist --no-progress --working-dir="$PROJECT_ROOT" + rm -rf .build/ composer.lock, + composer update --prefer-dist --no-progress ''; }; @@ -37,11 +37,12 @@ let name = "project-cgl"; runtimeInputs = [ + composer php ]; text = '' - .build/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php -v --dry-run --diff + composer project:cgl ''; }; @@ -49,23 +50,25 @@ let name = "project-cgl-fix"; runtimeInputs = [ + composer php ]; text = '' - .build/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php + composer project:cgl-fix ''; }; - projectLint = pkgs.writeShellApplication { - name = "project-lint"; + projectLintPhp = pkgs.writeShellApplication { + name = "project-lint-php"; runtimeInputs = [ + composer php ]; text = '' - find ./*.php Classes Configuration Tests -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l + composer project:lint:php ''; }; @@ -73,35 +76,38 @@ let name = "project-phpstan"; runtimeInputs = [ + composer php ]; text = '' - .build/bin/phpstan analyse -c Build/phpstan.neon --memory-limit 256M + composer project:phpstan ''; }; projectTestUnit = pkgs.writeShellApplication { name = "project-test-unit"; runtimeInputs = [ + composer php projectInstall ]; text = '' project-install - .build/bin/phpunit -c Build/phpunit.xml.dist --testsuite unit --display-warnings --display-deprecations --display-errors + composer project:test:unit ''; }; projectTestFunctional = pkgs.writeShellApplication { name = "project-test-functional"; runtimeInputs = [ + composer php projectInstall ]; text = '' project-install - .build/bin/phpunit -c Build/phpunit.xml.dist --testsuite functional --display-warnings --display-deprecations --display-errors + composer project:test:functional ''; }; @@ -120,12 +126,12 @@ let projectTestAcceptance = pkgs.writeShellApplication { name = "project-test-acceptance"; runtimeInputs = [ - projectInstall pkgs.sqlite pkgs.firefox pkgs.geckodriver pkgs.procps php + composer ]; text = '' project-install @@ -152,7 +158,7 @@ in pkgs.mkShellNoCC { projectInstall projectCgl projectCglFix - projectLint + projectLintPhp projectPhpstan projectTestUnit projectTestFunctional From b6b1df29b6beb4c5e8288df01e6b94d7c124c146 Mon Sep 17 00:00:00 2001 From: Daniel Gohlke Date: Sat, 25 Apr 2026 08:44:06 +0200 Subject: [PATCH 05/13] [BUGFIX] Use ArrayMerge Utility for TYPO3_CONF_VARS --- Classes/Configuration/Constants.php | 21 ++ Configuration/TCA/Overrides/pages.php | 65 +++-- .../tx_cartevents_domain_model_event.php | 27 ++- .../tx_cartevents_domain_model_eventdate.php | 12 +- ..._cartevents_domain_model_pricecategory.php | 12 +- ...x_cartevents_domain_model_specialprice.php | 12 +- .../Overrides/tx_kesearch_indexerconfig.php | 18 +- ext_localconf.php | 226 ++++++++++-------- 8 files changed, 268 insertions(+), 125 deletions(-) create mode 100644 Classes/Configuration/Constants.php diff --git a/Classes/Configuration/Constants.php b/Classes/Configuration/Constants.php new file mode 100644 index 00000000..76245447 --- /dev/null +++ b/Classes/Configuration/Constants.php @@ -0,0 +1,21 @@ + $_LLL_be . ':pages.doktype.185', - 'value' => 185, - 'icon' => 'apps-pagetree-page-cartevents-events', - ]; - $GLOBALS['TCA']['pages']['columns']['doktype']['config']['items'][] = [ - 'label' => $_LLL_be . ':pages.doktype.186', - 'value' => 186, - 'icon' => 'apps-pagetree-page-cartevents-events', - ]; - $GLOBALS['TCA']['pages']['columns']['module']['config']['items'][] = [ - 'label' => $_LLL_be . ':tcarecords-pages-contains.cart_events', - 'value' => 'cartevents', - 'icon' => 'apps-pagetree-folder-cartevents-events', - ]; - - $GLOBALS['TCA']['pages']['ctrl']['typeicon_classes'][185] = 'apps-pagetree-page-cartevents-events'; - $GLOBALS['TCA']['pages']['ctrl']['typeicon_classes'][186] = 'apps-pagetree-page-cartevents-events'; - $GLOBALS['TCA']['pages']['ctrl']['typeicon_classes']['contains-cartevents'] = 'apps-pagetree-folder-cartevents-events'; + ArrayUtility::mergeRecursiveWithOverrule( + $GLOBALS['TCA']['pages'], + [ + 'columns' => [ + 'doktype' => [ + 'config' => [ + 'items' => [ + 1777099626 => [ + 'label' => $_LLL_be . ':pages.doktype.' . Constants::DOKTYPE_CARTEVENTS_EVENTS, + 'value' => Constants::DOKTYPE_CARTEVENTS_EVENTS, + 'icon' => 'apps-pagetree-page-cartevents-events', + 'group' => 'default', + ], + 1777099665 => [ + 'label' => $_LLL_be . ':pages.doktype.' . Constants::DOKTYPE_CARTEVENTS_EVENT, + 'value' => Constants::DOKTYPE_CARTEVENTS_EVENT, + 'icon' => 'apps-pagetree-page-cartevents-events', + 'group' => 'default', + ], + ], + ], + ], + 'module' => [ + 'config' => [ + 'items' => [ + 1777099708 => [ + 'label' => $_LLL_be . ':tcarecords-pages-contains.cart_events', + 'value' => 'cartevents', + 'icon' => 'apps-pagetree-folder-cartevents-events', + 'group' => 'default', + ], + ], + ], + ], + ], + 'ctrl' => [ + 'typeicon_classes' => [ + Constants::DOKTYPE_CARTEVENTS_EVENTS => 'apps-pagetree-page-cartevents-events', + Constants::DOKTYPE_CARTEVENTS_EVENT => 'apps-pagetree-page-cartevents-events', + 'contains-cartevents' => 'apps-pagetree-folder-cartevents-events', + ], + ], + ] + ); $newPagesColumns = [ 'cart_events_event' => [ diff --git a/Configuration/TCA/Overrides/tx_cartevents_domain_model_event.php b/Configuration/TCA/Overrides/tx_cartevents_domain_model_event.php index 514ab296..9ba3f994 100644 --- a/Configuration/TCA/Overrides/tx_cartevents_domain_model_event.php +++ b/Configuration/TCA/Overrides/tx_cartevents_domain_model_event.php @@ -4,6 +4,7 @@ use Extcode\Cart\Hooks\FormDefinitions; use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; +use TYPO3\CMS\Core\Utility\ArrayUtility; use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -59,10 +60,26 @@ }; // prepend category restriction at the beginning of foreign_table_where - if (!empty($categoryRestriction)) { - $GLOBALS['TCA']['tx_cartevents_domain_model_event']['columns']['category']['config']['foreign_table_where'] = $categoryRestriction - . $GLOBALS['TCA']['tx_cartevents_domain_model_event']['columns']['category']['config']['foreign_table_where']; - $GLOBALS['TCA']['tx_cartevents_domain_model_event']['columns']['categories']['config']['foreign_table_where'] = $categoryRestriction - . $GLOBALS['TCA']['tx_cartevents_domain_model_event']['columns']['categories']['config']['foreign_table_where']; + if ($categoryRestriction !== '') { + $currentCategoryRestriction = $GLOBALS['TCA']['tx_cartevents_domain_model_event']['columns']['category']['config']['foreign_table_where'] ?? ''; + $currentCategoriesRestriction = $GLOBALS['TCA']['tx_cartevents_domain_model_event']['columns']['categories']['config']['foreign_table_where'] ?? ''; + + ArrayUtility::mergeRecursiveWithOverrule( + $GLOBALS['TCA']['tx_cartevents_domain_model_event'], + [ + 'columns' => [ + 'category' => [ + 'config' => [ + 'foreign_table_where' => $categoryRestriction . $currentCategoryRestriction, + ], + ], + 'categories' => [ + 'config' => [ + 'foreign_table_where' => $categoryRestriction . $currentCategoriesRestriction, + ], + ], + ], + ] + ); } } diff --git a/Configuration/TCA/Overrides/tx_cartevents_domain_model_eventdate.php b/Configuration/TCA/Overrides/tx_cartevents_domain_model_eventdate.php index a5eb6761..f7fffa7f 100644 --- a/Configuration/TCA/Overrides/tx_cartevents_domain_model_eventdate.php +++ b/Configuration/TCA/Overrides/tx_cartevents_domain_model_eventdate.php @@ -3,6 +3,7 @@ defined('TYPO3') or die(); use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; +use TYPO3\CMS\Core\Utility\ArrayUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; $_LLL_db = 'LLL:EXT:cart_events/Resources/Private/Language/locallang_db.xlf'; @@ -11,5 +12,14 @@ ->get('cart_events', 'inputIsNetPrice'); if ((bool)$inputIsNetPrice) { - $GLOBALS['TCA']['tx_cartevents_domain_model_eventdate']['columns']['price']['label'] = $_LLL_db . ':tx_cartevents_domain_model_eventdate.price.net'; + ArrayUtility::mergeRecursiveWithOverrule( + $GLOBALS['TCA']['tx_cartevents_domain_model_eventdate'], + [ + 'columns' => [ + 'price' => [ + 'label' => $_LLL_db . ':tx_cartevents_domain_model_eventdate.price.net', + ], + ], + ] + ); } diff --git a/Configuration/TCA/Overrides/tx_cartevents_domain_model_pricecategory.php b/Configuration/TCA/Overrides/tx_cartevents_domain_model_pricecategory.php index ec001f6e..0ce66045 100644 --- a/Configuration/TCA/Overrides/tx_cartevents_domain_model_pricecategory.php +++ b/Configuration/TCA/Overrides/tx_cartevents_domain_model_pricecategory.php @@ -3,6 +3,7 @@ defined('TYPO3') or die(); use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; +use TYPO3\CMS\Core\Utility\ArrayUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; $_LLL_db = 'LLL:EXT:cart_events/Resources/Private/Language/locallang_db.xlf'; @@ -11,5 +12,14 @@ ->get('cart_events', 'inputIsNetPrice'); if ((bool)$inputIsNetPrice) { - $GLOBALS['TCA']['tx_cartevents_domain_model_pricecategory']['columns']['price']['label'] = $_LLL_db . ':tx_cartevents_domain_model_pricecategory.price.net'; + ArrayUtility::mergeRecursiveWithOverrule( + $GLOBALS['TCA']['tx_cartevents_domain_model_pricecategory'], + [ + 'columns' => [ + 'price' => [ + 'label' => $_LLL_db . ':tx_cartevents_domain_model_pricecategory.price.net', + ], + ], + ] + ); } diff --git a/Configuration/TCA/Overrides/tx_cartevents_domain_model_specialprice.php b/Configuration/TCA/Overrides/tx_cartevents_domain_model_specialprice.php index dae64619..347b11f6 100644 --- a/Configuration/TCA/Overrides/tx_cartevents_domain_model_specialprice.php +++ b/Configuration/TCA/Overrides/tx_cartevents_domain_model_specialprice.php @@ -3,6 +3,7 @@ defined('TYPO3') or die(); use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; +use TYPO3\CMS\Core\Utility\ArrayUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; $_LLL_db = 'LLL:EXT:cart_events/Resources/Private/Language/locallang_db.xlf'; @@ -11,5 +12,14 @@ ->get('cart_events', 'inputIsNetPrice'); if ((bool)$inputIsNetPrice) { - $GLOBALS['TCA']['tx_cartevents_domain_model_specialprice']['columns']['price']['label'] = $_LLL_db . ':tx_cartevents_domain_model_specialprice.price.net'; + ArrayUtility::mergeRecursiveWithOverrule( + $GLOBALS['TCA']['tx_cartevents_domain_model_specialprice'], + [ + 'columns' => [ + 'price' => [ + 'label' => $_LLL_db . ':tx_cartevents_domain_model_specialprice.price.net', + ], + ], + ] + ); } diff --git a/Configuration/TCA/Overrides/tx_kesearch_indexerconfig.php b/Configuration/TCA/Overrides/tx_kesearch_indexerconfig.php index 652cfd49..f9ed0d6a 100644 --- a/Configuration/TCA/Overrides/tx_kesearch_indexerconfig.php +++ b/Configuration/TCA/Overrides/tx_kesearch_indexerconfig.php @@ -2,9 +2,23 @@ defined('TYPO3') or die(); +use TYPO3\CMS\Core\Utility\ArrayUtility; use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; if (ExtensionManagementUtility::isLoaded('ke_search')) { - $GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['startingpoints_recursive']['displayCond'] - .= ',carteventsindexer,cartsingleeventindexer'; + $displayCond = 'carteventsindexer,cartsingleeventindexer'; + if (is_string($GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['startingpoints_recursive']['displayCond'] ?? null)) { + $displayCond = $GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['startingpoints_recursive']['displayCond'] . ',' . $displayCond; + } + + ArrayUtility::mergeRecursiveWithOverrule( + $GLOBALS['TCA']['tx_kesearch_indexerconfig'], + [ + 'columns' => [ + 'startingpoints_recursive' => [ + 'displayCond' => $displayCond, + ], + ], + ] + ); } diff --git a/ext_localconf.php b/ext_localconf.php index 390dcc03..f41d16f8 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -5,103 +5,137 @@ use Extcode\CartEvents\Domain\Finisher\Form\AddToCartFinisher; use Extcode\CartEvents\Hooks\DataHandler; use Extcode\CartEvents\Hooks\DatamapDataHandlerHook; -use Extcode\CartEvents\Updates\SlugUpdater; +use TYPO3\CMS\Core\Utility\ArrayUtility; use TYPO3\CMS\Extbase\Utility\ExtensionUtility; defined('TYPO3') or die(); -$_LLL_be = 'LLL:EXT:cart_events/Resources/Private/Language/locallang_be.xlf:'; - -// configure plugins - -ExtensionUtility::configurePlugin( - 'cart_events', - 'ShowEvent', - [ - EventController::class => 'show, form', - ], - [ - EventController::class => 'form', - ] -); - -ExtensionUtility::configurePlugin( - 'cart_events', - 'ListEvents', - [ - EventController::class => 'list, show, form', - ], - [ - EventController::class => 'form', - ] -); - -ExtensionUtility::configurePlugin( - 'cart_events', - 'TeaserEvents', - [ - EventController::class => 'teaser', - ], - [ - EventController::class => '', - ] -); - -ExtensionUtility::configurePlugin( - 'cart_events', - 'SingleEvent', - [ - EventController::class => 'show, form', - ], - [ - EventController::class => 'form', - ] -); - -ExtensionUtility::configurePlugin( - 'cart_events', - 'EventDates', - [ - EventDateController::class => 'list', - ], - [ - EventDateController::class => '', - ] -); - -// Cart Hooks - -$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cart']['CartEvents']['Form']['AddToCartFinisher'] - = AddToCartFinisher::class; - -// processDatamapClass Hook - -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass']['cartevents_allowed'] - = DatamapDataHandlerHook::class; - -// clearCachePostProc Hook - -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc']['cartevents_clearcache'] - = DataHandler::class . '->clearCachePostProc'; - -// register "cartevents:" namespace -$GLOBALS['TYPO3_CONF_VARS']['SYS']['fluid']['namespaces']['cartevents'][] - = 'Extcode\\CartEvents\\ViewHelpers'; - -// update wizard for slugs -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['cartEventsSlugUpdater'] - = SlugUpdater::class; - -// translation overrides - -$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:cart/Resources/Private/Language/locallang.xlf'][] = 'EXT:cart_events/Resources/Private/Language/Overrides/cart/locallang.xlf'; -$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['de']['EXT:cart/Resources/Private/Language/de.locallang.xlf'][] = 'EXT:cart_events/Resources/Private/Language/Overrides/cart/de.locallang.xlf'; - -// register listTemplateLayouts -$GLOBALS['TYPO3_CONF_VARS']['EXT']['cart_events']['templateLayouts']['list_events'][] = [$_LLL_be . 'flexforms_template.templateLayout.events.table', 'table']; -$GLOBALS['TYPO3_CONF_VARS']['EXT']['cart_events']['templateLayouts']['list_events'][] = [$_LLL_be . 'flexforms_template.templateLayout.events.grid', 'grid']; -$GLOBALS['TYPO3_CONF_VARS']['EXT']['cart_events']['templateLayouts']['teaser_events'][] = [$_LLL_be . 'flexforms_template.templateLayout.events.table', 'table']; -$GLOBALS['TYPO3_CONF_VARS']['EXT']['cart_events']['templateLayouts']['teaser_events'][] = [$_LLL_be . 'flexforms_template.templateLayout.events.grid', 'grid']; -$GLOBALS['TYPO3_CONF_VARS']['EXT']['cart_events']['templateLayouts']['event_dates'][] = [$_LLL_be . 'flexforms_template.templateLayout.event_dates.table', 'table']; -$GLOBALS['TYPO3_CONF_VARS']['EXT']['cart_events']['templateLayouts']['event_dates'][] = [$_LLL_be . 'flexforms_template.templateLayout.event_dates.grid', 'grid']; -$GLOBALS['TYPO3_CONF_VARS']['EXT']['cart_events']['templateLayouts']['single_event'][] = [$_LLL_be . 'flexforms_template.templateLayout.single_event.default', 'default']; +(static function (string $extKey): void { + $_LLL_be = 'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_be.xlf:'; + + if (is_array($GLOBALS['TYPO3_CONF_VARS'] ?? null) === false) { + throw new \Exception('$GLOBALS[\'TYPO3_CONF_VARS\'] is not an array', 1774601240); + } + + ArrayUtility::mergeRecursiveWithOverrule( + $GLOBALS['TYPO3_CONF_VARS'], + [ + 'EXT' => [ + $extKey => [ + 'templateLayouts' => [ + 'list_events' => [ + 'table' => [$_LLL_be . 'flexforms_template.templateLayout.events.table', 'table'], + 'grid' => [$_LLL_be . 'flexforms_template.templateLayout.events.grid', 'grid'], + ], + 'teaser_events' => [ + 'table' => [$_LLL_be . 'flexforms_template.templateLayout.events.table', 'table'], + 'grid' => [$_LLL_be . 'flexforms_template.templateLayout.events.grid', 'grid'], + ], + 'event_dates' => [ + 'table' => [$_LLL_be . 'flexforms_template.templateLayout.event_dates.table', 'table'], + 'grid' => [$_LLL_be . 'flexforms_template.templateLayout.event_dates.grid', 'grid'], + ], + 'single_event' => [ + 'default' => [$_LLL_be . 'flexforms_template.templateLayout.single_event.default', 'default'], + ], + ], + ], + ], + 'EXTCONF' => [ + 'cart' => [ + 'CartEvents' => [ + 'Form' => [ + 'AddToCartFinisher' => AddToCartFinisher::class, + ], + ], + ], + ], + 'SC_OPTIONS' => [ + 't3lib/class.t3lib_tcemain.php' => [ + 'processDatamapClass' => [ + 'cartevents_allowed' => DatamapDataHandlerHook::class, + ], + 'clearCachePostProc' => [ + 'cartevents_clearcache' => DataHandler::class . '->clearCachePostProc', + ], + ], + ], + 'SYS' => [ + 'fluid' => [ + 'namespaces' => [ + 'cartevents' => [ + 1 => 'Extcode\\CartEvents\\ViewHelpers', + ], + ], + ], + 'locallangXMLOverride' => [ + 'EXT:cart/Resources/Private/Language/locallang.xlf' => [ + 'EXT:cart_events/Resources/Private/Language/Overrides/cart/locallang.xlf', + ], + 'de' => [ + 'EXT:cart/Resources/Private/Language/de.locallang.xlf' => [ + 'EXT:cart_events/Resources/Private/Language/Overrides/cart/de.locallang.xlf', + ], + ], + ], + ], + ] + ); + + // configure plugins + ExtensionUtility::configurePlugin( + 'cart_events', + 'ShowEvent', + [ + EventController::class => 'show, form', + ], + [ + EventController::class => 'form', + ] + ); + + ExtensionUtility::configurePlugin( + 'cart_events', + 'ListEvents', + [ + EventController::class => 'list, show, form', + ], + [ + EventController::class => 'form', + ] + ); + + ExtensionUtility::configurePlugin( + 'cart_events', + 'TeaserEvents', + [ + EventController::class => 'teaser', + ], + [ + EventController::class => '', + ] + ); + + ExtensionUtility::configurePlugin( + 'cart_events', + 'SingleEvent', + [ + EventController::class => 'show, form', + ], + [ + EventController::class => 'form', + ] + ); + + ExtensionUtility::configurePlugin( + 'cart_events', + 'EventDates', + [ + EventDateController::class => 'list', + ], + [ + EventDateController::class => '', + ] + ); + +})('cart_events'); From f2741931ba9bc01c4f426a097b22be80bdeb20fe Mon Sep 17 00:00:00 2001 From: Daniel Gohlke Date: Sat, 25 Apr 2026 14:34:45 +0200 Subject: [PATCH 06/13] [TASK] Inject all dependencies via php and remove Services.yaml --- Classes/Updates/SlugUpdater.php | 117 ---------------------- Configuration/Services.php | 30 ++++++ Configuration/Services.yaml | 36 ------- Configuration/Services/EventListeners.php | 65 ++++++++++++ 4 files changed, 95 insertions(+), 153 deletions(-) delete mode 100644 Classes/Updates/SlugUpdater.php create mode 100644 Configuration/Services.php delete mode 100644 Configuration/Services.yaml create mode 100644 Configuration/Services/EventListeners.php diff --git a/Classes/Updates/SlugUpdater.php b/Classes/Updates/SlugUpdater.php deleted file mode 100644 index 010dc041..00000000 --- a/Classes/Updates/SlugUpdater.php +++ /dev/null @@ -1,117 +0,0 @@ -connectionPool->getQueryBuilderForTable(self::TABLE_NAME); - $queryBuilder->getRestrictions()->removeAll(); - $elementCount = $queryBuilder->count('uid') - ->from(self::TABLE_NAME)->where($queryBuilder->expr()->or($queryBuilder->expr()->eq('path_segment', $queryBuilder->createNamedParameter('', Connection::PARAM_STR)), $queryBuilder->expr()->isNull('path_segment')))->executeQuery()->fetchOne(); - - return (bool)$elementCount; - } - - /** - * Performs the database update - */ - public function executeUpdate(): bool - { - $slugHelper = GeneralUtility::makeInstance( - SlugHelper::class, - self::TABLE_NAME, - 'path_segment', - $GLOBALS['TCA'][self::TABLE_NAME]['columns']['path_segment']['config'] - ); - - $connection = $this->connectionPool->getConnectionForTable(self::TABLE_NAME); - $queryBuilder = $connection->createQueryBuilder(); - $queryBuilder->getRestrictions()->removeAll(); - $statement = $queryBuilder->select('uid', 'title') - ->from(self::TABLE_NAME)->where($queryBuilder->expr()->or($queryBuilder->expr()->eq('path_segment', $queryBuilder->createNamedParameter('', Connection::PARAM_STR)), $queryBuilder->expr()->isNull('path_segment')))->executeQuery(); - while ($record = $statement->fetchAssociative()) { - $queryBuilder = $connection->createQueryBuilder(); - $queryBuilder->update(self::TABLE_NAME) - ->where( - $queryBuilder->expr()->eq( - 'uid', - $queryBuilder->createNamedParameter($record['uid'], Connection::PARAM_INT) - ) - ) - ->set('path_segment', $slugHelper->sanitize((string)$record['title'])); - $queryBuilder->executeQuery(); - } - - return true; - } - - /** - * Returns an array of class names of Prerequisite classes - * - * @return string[] - */ - public function getPrerequisites(): array - { - return []; - } - - /** - * Setter injection for output into upgrade wizards - */ - public function setOutput(OutputInterface $output): void - { - $this->output = $output; - } -} diff --git a/Configuration/Services.php b/Configuration/Services.php new file mode 100644 index 00000000..25c9cdb1 --- /dev/null +++ b/Configuration/Services.php @@ -0,0 +1,30 @@ +services() + ->defaults() + ->autowire() + ->autoconfigure() + ; + + $services + ->load( + 'Extcode\\CartEvents\\', + '../Classes/*' + ) + ; + + $services + ->set(DataHandler::class) + ->public() + ; + + $containerConfigurator->import('Services/EventListeners.php'); +}; diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml deleted file mode 100644 index 91fc621b..00000000 --- a/Configuration/Services.yaml +++ /dev/null @@ -1,36 +0,0 @@ -services: - _defaults: - autowire: true - autoconfigure: true - public: false - - Extcode\CartEvents\: - resource: '../Classes/*' - - Extcode\CartEvents\EventListener\Order\Stock\HandleStock: - tags: - - name: event.listener - identifier: 'cart-events--order--stock--handle-stock' - event: Extcode\Cart\Event\Order\StockEvent - - Extcode\CartEvents\EventListener\Order\Stock\FlushCache: - tags: - - name: event.listener - identifier: 'cart-events--order--stock--flush-cache' - event: Extcode\Cart\Event\Order\StockEvent - after: 'cart-events--order--stock--handle-stock' - - Extcode\CartEvents\EventListener\RetrieveProductsFromRequest: - tags: - - name: event.listener - identifier: 'cart-events--retrieve-products-from-request' - event: Extcode\Cart\Event\RetrieveProductsFromRequestEvent - - Extcode\CartEvents\EventListener\CheckProductAvailability: - tags: - - name: event.listener - identifier: 'cart-events--check-product-availability' - event: Extcode\Cart\Event\CheckProductAvailabilityEvent - - Extcode\CartEvents\Updates\SlugUpdater: - public: true diff --git a/Configuration/Services/EventListeners.php b/Configuration/Services/EventListeners.php new file mode 100644 index 00000000..93effde0 --- /dev/null +++ b/Configuration/Services/EventListeners.php @@ -0,0 +1,65 @@ +services() + ->defaults() + ->autowire() + ->autoconfigure(); + + $services + ->set(HandleStock::class) + ->tag( + 'event.listener', + [ + 'event' => StockEvent::class, + 'identifier' => 'cart-events--order--stock--handle-stock', + ] + ) + ; + + $services + ->set(FlushCache::class) + ->tag( + 'event.listener', + [ + 'event' => StockEvent::class, + 'identifier' => 'cart-events--order--stock--flush-cache', + 'after' => 'cart-events--order--stock--handle-stock', + ] + ) + ; + + $services + ->set(RetrieveProductsFromRequest::class) + ->tag( + 'event.listener', + [ + 'event' => CartRetrieveProductsFromRequestEvent::class, + 'identifier' => 'cart-events--retrieve-products-from-request', + ] + ) + ; + + $services + ->set(CheckProductAvailability::class) + ->tag( + 'event.listener', + [ + 'event' => CheckProductAvailabilityEvent::class, + 'identifier' => 'cart-events--check-product-availability', + ] + ) + ; +}; From 9974e8c985c840c580bc2794465b3f7c405cb59c Mon Sep 17 00:00:00 2001 From: Daniel Gohlke Date: Sat, 25 Apr 2026 21:49:37 +0200 Subject: [PATCH 07/13] [TASK] Make all EventListeners final and readonly --- .../CheckProductAvailability.php | 55 +++++-------------- .../EventListener/Order/Stock/FlushCache.php | 4 +- .../EventListener/Order/Stock/HandleStock.php | 12 ++-- .../RetrieveProductsFromRequest.php | 6 +- Configuration/TCA/Overrides/pages.php | 1 - 5 files changed, 26 insertions(+), 52 deletions(-) diff --git a/Classes/EventListener/CheckProductAvailability.php b/Classes/EventListener/CheckProductAvailability.php index 83d8cca6..d5b128df 100644 --- a/Classes/EventListener/CheckProductAvailability.php +++ b/Classes/EventListener/CheckProductAvailability.php @@ -21,19 +21,12 @@ use TYPO3\CMS\Core\Messaging\FlashMessage; use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Extbase\Mvc\Request; use TYPO3\CMS\Extbase\Utility\LocalizationUtility; -class CheckProductAvailability +final readonly class CheckProductAvailability { - protected Cart $cart; - - protected EventDate $eventDate; - - protected PriceCategory $priceCategory; - public function __construct( - private readonly EventDateRepository $eventDateRepository, + private EventDateRepository $eventDateRepository, ) {} public function __invoke(CheckProductAvailabilityEvent $listenerEvent): void @@ -47,18 +40,18 @@ public function __invoke(CheckProductAvailabilityEvent $listenerEvent): void return; } - $this->retrieveEventDateFromDatabase($cartProduct); + $eventDate = $this->retrieveEventDateFromDatabase($cartProduct); - if (!$this->eventDate->isHandleSeats()) { + if (!$eventDate->isHandleSeats()) { return; } - if ($this->eventDate->isHandleSeatsInPriceCategory() === false) { - $this->hasEventDateEnoughSeats($cartProduct, $cart, $mode, (int)$quantity, $listenerEvent); + if ($eventDate->isHandleSeatsInPriceCategory() === false) { + $this->hasEventDateEnoughSeats($eventDate, $cartProduct, $cart, $mode, (int)$quantity, $listenerEvent); return; } - foreach ($this->eventDate->getPriceCategories() as $priceCategory) { + foreach ($eventDate->getPriceCategories() as $priceCategory) { $beVariantId = PriceCategory::class . '-' . $priceCategory->getUid(); if (array_key_exists($beVariantId, $cartProduct->getBeVariants()) === false) { continue; @@ -67,41 +60,23 @@ public function __invoke(CheckProductAvailabilityEvent $listenerEvent): void } } - protected function retrieveEventDateFromDatabase(ProductInterface $cartProduct): void + private function retrieveEventDateFromDatabase(ProductInterface $cartProduct): EventDate { $querySettings = $this->eventDateRepository->createQuery()->getQuerySettings(); $querySettings->setRespectStoragePage(false); $this->eventDateRepository->setDefaultQuerySettings($querySettings); $eventDate = $this->eventDateRepository->findByIdentifier($cartProduct->getProductId()); + if (($eventDate instanceof EventDate) === false) { throw new Exception('Can not find EventDate with uid ' . $cartProduct->getProductId() . '.', 1769634921); } - $this->eventDate = $eventDate; - } - - protected function getQuantitiesFromRequest(Request $request, ProductInterface $cartProduct): mixed - { - if ($request->hasArgument('quantities')) { - $quantities = $request->getArgument('quantities'); - $quantities = $quantities[$cartProduct->getId()]; - return $quantities; - } - - if ($request->hasArgument('quantity')) { - if ($request->hasArgument('priceCategory')) { - $quantities[PriceCategory::class . '-' . $request->getArgument('priceCategory')] = $request->getArgument('quantity'); - - return $quantities; - } - - return $request->getArgument('quantity'); - } - return 0; + return $eventDate; } - protected function hasEventDateEnoughSeats( + private function hasEventDateEnoughSeats( + EventDate $eventDate, ProductInterface $cartProduct, Cart $cart, string $mode, @@ -112,7 +87,7 @@ protected function hasEventDateEnoughSeats( $quantity += $cart->getProductById($cartProduct->getId())->getQuantity(); } - if ($quantity > $this->eventDate->getSeatsAvailable()) { + if ($quantity > $eventDate->getSeatsAvailable()) { $listenerEvent->setAvailable(false); $listenerEvent->addMessage( GeneralUtility::makeInstance( @@ -128,7 +103,7 @@ protected function hasEventDateEnoughSeats( } } - protected function hasPriceCategoryEnoughSeats( + private function hasPriceCategoryEnoughSeats( ProductInterface $cartProduct, Cart $cart, string $mode, @@ -139,7 +114,7 @@ protected function hasPriceCategoryEnoughSeats( ): void { if (($mode === 'add') && $cart->getProductById($cartProduct->getId())) { if ($cart->getProductById($cartProduct->getId())->getBeVariantById($beVariantId)) { - $quantity += (int)$cart->getProductById($cartProduct->getId())->getBeVariantById($beVariantId)->getQuantity(); + $quantity += $cart->getProductById($cartProduct->getId())->getBeVariantById($beVariantId)->getQuantity(); } } if ($quantity > $priceCategory->getSeatsAvailable()) { diff --git a/Classes/EventListener/Order/Stock/FlushCache.php b/Classes/EventListener/Order/Stock/FlushCache.php index 2483e6e1..cb826036 100644 --- a/Classes/EventListener/Order/Stock/FlushCache.php +++ b/Classes/EventListener/Order/Stock/FlushCache.php @@ -18,11 +18,11 @@ use Extcode\CartEvents\Domain\Repository\EventDateRepository; use TYPO3\CMS\Core\Cache\CacheManager; -readonly class FlushCache +final readonly class FlushCache { public function __construct( private EventDateRepository $eventDateRepository, - private readonly CacheManager $cacheManager + private CacheManager $cacheManager ) {} public function __invoke(EventInterface $event): void diff --git a/Classes/EventListener/Order/Stock/HandleStock.php b/Classes/EventListener/Order/Stock/HandleStock.php index 5e91fd3d..109b279c 100644 --- a/Classes/EventListener/Order/Stock/HandleStock.php +++ b/Classes/EventListener/Order/Stock/HandleStock.php @@ -20,12 +20,12 @@ use Extcode\CartEvents\Domain\Repository\PriceCategoryRepository; use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; -class HandleStock +final readonly class HandleStock { public function __construct( - private readonly PersistenceManager $persistenceManager, - private readonly EventDateRepository $eventDateRepository, - private readonly PriceCategoryRepository $priceCategoryRepository, + private PersistenceManager $persistenceManager, + private EventDateRepository $eventDateRepository, + private PriceCategoryRepository $priceCategoryRepository, ) {} public function __invoke(EventInterface $event): void @@ -39,7 +39,7 @@ public function __invoke(EventInterface $event): void } } - protected function handleStockForEventDate(ProductInterface $cartProduct): void + private function handleStockForEventDate(ProductInterface $cartProduct): void { $eventDate = $this->eventDateRepository->findByUid($cartProduct->getProductId()); @@ -50,7 +50,7 @@ protected function handleStockForEventDate(ProductInterface $cartProduct): void if ($eventDate->isHandleSeats()) { if ($eventDate->isHandleSeatsInPriceCategory()) { foreach ($cartProduct->getBeVariants() as $cartBeVariant) { - $explodedId = explode('-', (string)$cartBeVariant->getId()); + $explodedId = explode('-', $cartBeVariant->getId()); $id = (int)end($explodedId); $priceCategory = $this->priceCategoryRepository->findByUid($id); if (($priceCategory instanceof PriceCategory) === false) { diff --git a/Classes/EventListener/RetrieveProductsFromRequest.php b/Classes/EventListener/RetrieveProductsFromRequest.php index 8ed03741..177ac30d 100644 --- a/Classes/EventListener/RetrieveProductsFromRequest.php +++ b/Classes/EventListener/RetrieveProductsFromRequest.php @@ -18,11 +18,11 @@ use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; use TYPO3\CMS\Extbase\Utility\LocalizationUtility; -class RetrieveProductsFromRequest +final readonly class RetrieveProductsFromRequest { public function __construct( - private readonly ExtensionConfiguration $extensionConfiguration, - private readonly ProductFactoryInterface $productFactory, + private ExtensionConfiguration $extensionConfiguration, + private ProductFactoryInterface $productFactory, ) {} public function __invoke(RetrieveProductsFromRequestEvent $event): void diff --git a/Configuration/TCA/Overrides/pages.php b/Configuration/TCA/Overrides/pages.php index d35f29bb..b21f7a34 100644 --- a/Configuration/TCA/Overrides/pages.php +++ b/Configuration/TCA/Overrides/pages.php @@ -38,7 +38,6 @@ 'label' => $_LLL_be . ':tcarecords-pages-contains.cart_events', 'value' => 'cartevents', 'icon' => 'apps-pagetree-folder-cartevents-events', - 'group' => 'default', ], ], ], From b1dc738f525d7cbedf3832723183a4fc9d908308 Mon Sep 17 00:00:00 2001 From: Daniel Gohlke Date: Sun, 9 Aug 2026 13:25:44 +0200 Subject: [PATCH 08/13] [BUGFIX] Change to extcode/testing-framework for acceptance tests The TYPO3 testing framework will remove codeception accceptance tests in next major version. The extcode/testing-framework provides the code for using it without any deprecation warning. --- Tests/Acceptance/Support/Environment.php | 2 +- Tests/Acceptance/Support/Tester.php | 3 --- composer.json | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Tests/Acceptance/Support/Environment.php b/Tests/Acceptance/Support/Environment.php index 336e8ca2..b9e7c794 100644 --- a/Tests/Acceptance/Support/Environment.php +++ b/Tests/Acceptance/Support/Environment.php @@ -13,7 +13,7 @@ use Codappix\Typo3PhpDatasets\PhpDataSet; use Codeception\Event\SuiteEvent; -use TYPO3\TestingFramework\Core\Acceptance\Extension\BackendEnvironment; +use Extcode\TestingFramework\Core\Acceptance\Extension\BackendEnvironment; final class Environment extends BackendEnvironment { diff --git a/Tests/Acceptance/Support/Tester.php b/Tests/Acceptance/Support/Tester.php index d0f5dd69..982e1a70 100644 --- a/Tests/Acceptance/Support/Tester.php +++ b/Tests/Acceptance/Support/Tester.php @@ -13,7 +13,6 @@ use Codeception\Actor; use Extcode\CartEvents\Tests\Acceptance\Support\_generated\TesterActions; -use TYPO3\TestingFramework\Core\Acceptance\Step\FrameSteps; /** * @method void wantToTest($text) @@ -31,7 +30,5 @@ class Tester extends Actor { use TesterActions; - use FrameSteps; - protected int $retryNum = 2; } diff --git a/composer.json b/composer.json index 52339cb1..1c6dbcf9 100644 --- a/composer.json +++ b/composer.json @@ -65,6 +65,7 @@ "codeception/codeception": "^5.0", "codeception/module-db": "^3.1", "codeception/module-webdriver": "^4.0", + "extcode/testing-framework": "^1.0", "friendsofphp/php-cs-fixer": "^3.16", "helmich/typo3-typoscript-lint": "^3.1", "phpstan/extension-installer": "^1.4", @@ -75,7 +76,6 @@ "staabm/phpstan-todo-by": "^0.3", "typo3/cms-fluid-styled-content": "^14.3", "typo3/cms-install": "^14.3", - "typo3/testing-framework": "^9.3", "ssch/typo3-rector": "^3.11" }, "scripts": { From 69533c323553a8200f82f7b8be9b9369b939bc14 Mon Sep 17 00:00:00 2001 From: Daniel Gohlke Date: Sun, 9 Aug 2026 13:31:38 +0200 Subject: [PATCH 09/13] [TASK] Prepare composer.json for release --- composer.json | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 1c6dbcf9..bcb95034 100644 --- a/composer.json +++ b/composer.json @@ -38,24 +38,22 @@ "allow-plugins": { "typo3/cms-composer-installers": true, "typo3/class-alias-loader": true, - "sbuerk/typo3-cmscomposerinstallers-testingframework-bridge": true, "phpstan/extension-installer": true - } + }, + "lock": false, + "sort-packages": true }, - "version": "7.0.0", "extra": { "typo3/cms": { "extension-key": "cart_events", "web-dir": ".build/public" } }, - "minimum-stability": "dev", - "prefer-stable": true, "require": { "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0", "ext-json": "*", "ext-pdo": "*", - "extcode/cart": "dev-main as 12.0.0", + "extcode/cart": "^12.0", "typo3/cms-core": "^14.3", "typo3/cms-extbase": "^14.3", "typo3/cms-fluid": "^14.3" From bda6dc433332d3970d5512e27f28db37d47fbca7 Mon Sep 17 00:00:00 2001 From: Daniel Gohlke Date: Sun, 9 Aug 2026 13:35:56 +0200 Subject: [PATCH 10/13] [BUGFIX] Use stable nixos version and cacert package The obviously removed cacert oackage in newer nixos actions throws an error when pulling a composer dependency from other sources using a Let's Encrypt certificate. --- .github/workflows/ci.yaml | 2 +- shell.nix | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 89e8fb98..c0eb173d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -134,7 +134,7 @@ jobs: - uses: cachix/install-nix-action@v31 with: - nix_path: nixpkgs=channel:nixos-unstable + nix_path: nixpkgs=channel:nixos-26.05 - name: Run Acceptance Tests PHP8.2 run: nix-shell --arg phpVersion \"php82\" --pure --run project-test-acceptance diff --git a/shell.nix b/shell.nix index 63beacf8..b12dea01 100644 --- a/shell.nix +++ b/shell.nix @@ -153,6 +153,7 @@ let in pkgs.mkShellNoCC { name = "TYPO3 Extension extcode/cart-products"; buildInputs = [ + pkgs.cacert php composer projectInstall From 5e90feb0ac80afd9021ed4fdc167d10562609007 Mon Sep 17 00:00:00 2001 From: Daniel Gohlke Date: Thu, 12 Nov 2026 12:42:02 +0100 Subject: [PATCH 11/13] [BUGFIX] Replace see with waitForText in acceptance tests The waitForText waits up to 5 seconds. The see checks immediatly for the string. If the server (test) takes a little bit longer the test will fail. Co-Authored-By: Claude Opus 5.5 --- Tests/Acceptance/AddEventDateToCartCest.php | 48 ++++++++++----------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/Tests/Acceptance/AddEventDateToCartCest.php b/Tests/Acceptance/AddEventDateToCartCest.php index c6e1fce5..8790c024 100644 --- a/Tests/Acceptance/AddEventDateToCartCest.php +++ b/Tests/Acceptance/AddEventDateToCartCest.php @@ -39,14 +39,14 @@ public function addBookableEventToCart(Tester $I): void $I->seeInField("input[name='tx_cart_cart[quantity]']", '1'); $I->seeElement('input[type="submit"]'); $I->click('input[type="submit"]'); - $I->see('Item was added to cart.', '#event-date-2 .form-message .form-success'); + $I->waitForText('Item was added to cart.', 5, '#event-date-2 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-2 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-2 .form-message .form-error'); $I->wantTo('Add the first event date with quantity of 2 to cart.'); $I->fillField("input[name='tx_cart_cart[quantity]']", '2'); $I->click('input[type="submit"]'); - $I->see('2 Items were added to cart.', '#event-date-2 .form-message .form-success'); + $I->waitForText('2 Items were added to cart.', 5, '#event-date-2 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-2 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-2 .form-message .form-error'); @@ -82,7 +82,7 @@ public function addBookableEventDateWithoutSeatHandlingToCart(Tester $I): void $I->fillField("input[name='tx_cart_cart[quantity]']", '1000'); $I->seeElement('input[type="submit"]'); $I->click('input[type="submit"]'); - $I->see('1000 Items were added to cart.', '#event-date-2 .form-message .form-success'); + $I->waitForText('1000 Items were added to cart.', 5, '#event-date-2 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-2 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-2 .form-message .form-error'); @@ -120,14 +120,14 @@ public function addBookableEventDateWithAvailableNumberOfSeatToCart(Tester $I): $I->seeInField("#event-date-3 input[name='tx_cart_cart[quantity]']", '1'); $I->seeElement('#event-date-3 input[type="submit"]'); $I->click('#event-date-3 input[type="submit"]'); - $I->see('Item was added to cart.', '#event-date-3 .form-message .form-success'); + $I->waitForText('Item was added to cart.', 5, '#event-date-3 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-3 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-3 .form-message .form-error'); $I->wantTo('Add the first event date with quantity of 2 to cart.'); $I->fillField("#event-date-3 input[name='tx_cart_cart[quantity]']", '2'); $I->click('#event-date-3 input[type="submit"]'); - $I->see('2 Items were added to cart.', '#event-date-3 .form-message .form-success'); + $I->waitForText('2 Items were added to cart.', 5, '#event-date-3 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-3 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-3 .form-message .form-error'); @@ -165,7 +165,7 @@ public function addDifferentBookableEventDatesWithAvailableNumberOfSeatToCart(Te $I->seeInField("#event-date-3 input[name='tx_cart_cart[quantity]']", '1'); $I->seeElement('#event-date-3 input[type="submit"]'); $I->click('#event-date-3 input[type="submit"]'); - $I->see('Item was added to cart.', '#event-date-3 .form-message .form-success'); + $I->waitForText('Item was added to cart.', 5, '#event-date-3 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-3 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-3 .form-message .form-error'); @@ -175,7 +175,7 @@ public function addDifferentBookableEventDatesWithAvailableNumberOfSeatToCart(Te $I->fillField("#event-date-4 input[name='tx_cart_cart[quantity]']", '2'); $I->seeElement('#event-date-4 input[type="submit"]'); $I->click('#event-date-4 input[type="submit"]'); - $I->see('2 Items were added to cart.', '#event-date-4 .form-message .form-success'); + $I->waitForText('2 Items were added to cart.', 5, '#event-date-4 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-4 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-4 .form-message .form-error'); @@ -218,7 +218,7 @@ public function addBookableEventDateWithAvailableNumberOfSeatButNotMoreToCart(Te $I->seeInField("#event-date-3 input[name='tx_cart_cart[quantity]']", '1'); $I->fillField("#event-date-3 input[name='tx_cart_cart[quantity]']", '10'); $I->click('#event-date-3 input[type="submit"]'); - $I->see('Desired number of this item not available.', '#event-date-3 .form-message .form-error'); + $I->waitForText('Desired number of this item not available.', 5, '#event-date-3 .form-message .form-error'); $I->waitForElementNotVisible('#event-date-3 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-3 .form-message .form-error'); @@ -228,14 +228,14 @@ public function addBookableEventDateWithAvailableNumberOfSeatButNotMoreToCart(Te $I->fillField("#event-date-3 input[name='tx_cart_cart[quantity]']", '9'); $I->seeElement('#event-date-3 input[type="submit"]'); $I->click('#event-date-3 input[type="submit"]'); - $I->see('9 Items were added to cart.', '#event-date-3 .form-message .form-success'); + $I->waitForText('9 Items were added to cart.', 5, '#event-date-3 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-3 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-3 .form-message .form-error'); $I->wantTo('Add the first event date with quantity of 1 to cart.'); $I->seeInField("#event-date-3 input[name='tx_cart_cart[quantity]']", '1'); $I->click('#event-date-3 input[type="submit"]'); - $I->see('Desired number of this item not available.', '#event-date-3 .form-message .form-error'); + $I->waitForText('Desired number of this item not available.', 5, '#event-date-3 .form-message .form-error'); $I->waitForElementNotVisible('#event-date-3 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-3 .form-message .form-error'); @@ -274,14 +274,14 @@ public function addDifferentBookableEventDateWithAvailableNumberOfSeatButNotMore $I->fillField("#event-date-3 input[name='tx_cart_cart[quantity]']", '9'); $I->seeElement('#event-date-3 input[type="submit"]'); $I->click('#event-date-3 input[type="submit"]'); - $I->see('9 Items were added to cart.', '#event-date-3 .form-message .form-success'); + $I->waitForText('9 Items were added to cart.', 5, '#event-date-3 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-3 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-3 .form-message .form-error'); $I->wantTo('Add the first event date with quantity of 1 to cart.'); $I->seeInField("#event-date-3 input[name='tx_cart_cart[quantity]']", '1'); $I->click('#event-date-3 input[type="submit"]'); - $I->see('Desired number of this item not available.', '#event-date-3 .form-message .form-error'); + $I->waitForText('Desired number of this item not available.', 5, '#event-date-3 .form-message .form-error'); $I->waitForElementNotVisible('#event-date-3 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-3 .form-message .form-error'); @@ -289,7 +289,7 @@ public function addDifferentBookableEventDateWithAvailableNumberOfSeatButNotMore $I->seeInField("#event-date-4 input[name='tx_cart_cart[quantity]']", '1'); $I->fillField("#event-date-4 input[name='tx_cart_cart[quantity]']", '9'); $I->click('#event-date-4 input[type="submit"]'); - $I->see('Desired number of this item not available.', '#event-date-4 .form-message .form-error'); + $I->waitForText('Desired number of this item not available.', 5, '#event-date-4 .form-message .form-error'); $I->waitForElementNotVisible('#event-date-4 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-4 .form-message .form-error'); @@ -299,7 +299,7 @@ public function addDifferentBookableEventDateWithAvailableNumberOfSeatButNotMore $I->fillField("#event-date-4 input[name='tx_cart_cart[quantity]']", '7'); $I->seeElement('#event-date-4 input[type="submit"]'); $I->click('#event-date-4 input[type="submit"]'); - $I->see('7 Items were added to cart.', '#event-date-4 .form-message .form-success'); + $I->waitForText('7 Items were added to cart.', 5, '#event-date-4 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-4 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-4 .form-message .form-error'); @@ -309,14 +309,14 @@ public function addDifferentBookableEventDateWithAvailableNumberOfSeatButNotMore $I->fillField("#event-date-4 input[name='tx_cart_cart[quantity]']", '1'); $I->seeElement('#event-date-4 input[type="submit"]'); $I->click('#event-date-4 input[type="submit"]'); - $I->see('Item was added to cart.', '#event-date-4 .form-message .form-success'); + $I->waitForText('Item was added to cart.', 5, '#event-date-4 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-4 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-4 .form-message .form-error'); $I->wantTo('Add the second event date with quantity of 1 to cart.'); $I->seeInField("#event-date-4 input[name='tx_cart_cart[quantity]']", '1'); $I->click('#event-date-4 input[type="submit"]'); - $I->see('Desired number of this item not available.', '#event-date-4 .form-message .form-error'); + $I->waitForText('Desired number of this item not available.', 5, '#event-date-4 .form-message .form-error'); $I->waitForElementNotVisible('#event-date-4 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-4 .form-message .form-error'); @@ -350,7 +350,7 @@ public function addBookableEventDateWithPriceCategoryAvailableNumberOfSeatToCart $I->fillField("#event-date-7 input[name='tx_cart_cart[quantity]']", '1'); $I->seeElement('#event-date-7 input[type="submit"]'); $I->click('#event-date-7 input[type="submit"]'); - $I->see('Item was added to cart.', '#event-date-7 .form-message .form-success'); + $I->waitForText('Item was added to cart.', 5, '#event-date-7 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-7 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-7 .form-message .form-error'); @@ -360,7 +360,7 @@ public function addBookableEventDateWithPriceCategoryAvailableNumberOfSeatToCart $I->fillField("#event-date-7 input[name='tx_cart_cart[quantity]']", '7'); $I->seeElement('#event-date-7 input[type="submit"]'); $I->click('#event-date-7 input[type="submit"]'); - $I->see('7 Items were added to cart.', '#event-date-7 .form-message .form-success'); + $I->waitForText('7 Items were added to cart.', 5, '#event-date-7 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-7 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-7 .form-message .form-error'); } @@ -381,7 +381,7 @@ public function addBookableEventDateWithPriceCategoryAvailableNumberOfSeatButNot $I->fillField("#event-date-7 input[name='tx_cart_cart[quantity]']", '38'); $I->seeElement('#event-date-7 input[type="submit"]'); $I->click('#event-date-7 input[type="submit"]'); - $I->see('Desired number of this item not available.', '#event-date-7 .form-message .form-error'); + $I->waitForText('Desired number of this item not available.', 5, '#event-date-7 .form-message .form-error'); $I->waitForElementNotVisible('#event-date-7 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-7 .form-message .form-error'); @@ -391,7 +391,7 @@ public function addBookableEventDateWithPriceCategoryAvailableNumberOfSeatButNot $I->fillField("#event-date-7 input[name='tx_cart_cart[quantity]']", '37'); $I->seeElement('#event-date-7 input[type="submit"]'); $I->click('#event-date-7 input[type="submit"]'); - $I->see('37 Items were added to cart.', '#event-date-7 .form-message .form-success'); + $I->waitForText('37 Items were added to cart.', 5, '#event-date-7 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-7 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-7 .form-message .form-error'); @@ -401,7 +401,7 @@ public function addBookableEventDateWithPriceCategoryAvailableNumberOfSeatButNot $I->fillField("#event-date-7 input[name='tx_cart_cart[quantity]']", '1'); $I->seeElement('#event-date-7 input[type="submit"]'); $I->click('#event-date-7 input[type="submit"]'); - $I->see('Desired number of this item not available.', '#event-date-7 .form-message .form-error'); + $I->waitForText('Desired number of this item not available.', 5, '#event-date-7 .form-message .form-error'); $I->waitForElementNotVisible('#event-date-7 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-7 .form-message .form-error'); } @@ -423,7 +423,7 @@ public function addDifferentBookableEventDateWithPriceCategoryAvailableNumberOfS $I->fillField("#event-date-7 input[name='tx_cart_cart[quantity]']", '37'); $I->seeElement('#event-date-7 input[type="submit"]'); $I->click('#event-date-7 input[type="submit"]'); - $I->see('37 Items were added to cart.', '#event-date-7 .form-message .form-success'); + $I->waitForText('37 Items were added to cart.', 5, '#event-date-7 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-7 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-7 .form-message .form-error'); @@ -434,7 +434,7 @@ public function addDifferentBookableEventDateWithPriceCategoryAvailableNumberOfS $I->fillField("#event-date-7 input[name='tx_cart_cart[quantity]']", '1'); $I->seeElement('#event-date-7 input[type="submit"]'); $I->click('#event-date-7 input[type="submit"]'); - $I->see('Desired number of this item not available.', '#event-date-7 .form-message .form-error'); + $I->waitForText('Desired number of this item not available.', 5, '#event-date-7 .form-message .form-error'); $I->waitForElementNotVisible('#event-date-7 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-7 .form-message .form-error'); @@ -445,7 +445,7 @@ public function addDifferentBookableEventDateWithPriceCategoryAvailableNumberOfS $I->fillField("#event-date-7 input[name='tx_cart_cart[quantity]']", '1'); $I->seeElement('#event-date-7 input[type="submit"]'); $I->click('#event-date-7 input[type="submit"]'); - $I->see('Item was added to cart.', '#event-date-7 .form-message .form-success'); + $I->waitForText('Item was added to cart.', 5, '#event-date-7 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-7 .form-message .form-success'); $I->waitForElementNotVisible('#event-date-7 .form-message .form-error'); } From 576d9556e533c1fee12895f9acb1a5d26e6cbc6c Mon Sep 17 00:00:00 2001 From: Daniel Gohlke Date: Thu, 12 Nov 2026 12:47:20 +0100 Subject: [PATCH 12/13] [DOCS] Use composer package name as interlink shortcode --- Documentation/guides.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/guides.xml b/Documentation/guides.xml index c3b06fb7..55d8baee 100644 --- a/Documentation/guides.xml +++ b/Documentation/guides.xml @@ -8,7 +8,7 @@ edit-on-github-branch="main" edit-on-github="extcode/cart_events" typo3-core-preferred="stable" - interlink-shortcode="extcode/cart_events" + interlink-shortcode="extcode/cart-events" /> Date: Thu, 12 Nov 2026 12:59:42 +0100 Subject: [PATCH 13/13] [BUGFIX] Use expectExceptionObject in ProductFactoryTest PHPUnit 13, which is installed with PHP 8.5, deprecates expectExceptionMessage(). Its replacements are not available in the PHPUnit versions installed with PHP 8.2 and PHP 8.3, so PHPStan failed only for PHP 8.5. The tests now use expectExceptionObject() like the tests in extcode/cart. It checks class, message and code of the exception and is available in all supported PHPUnit versions. Co-Authored-By: Claude Opus 5.5 --- .../Domain/Model/Cart/ProductFactoryTest.php | 54 ++++++++++++------- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/Tests/Functional/Domain/Model/Cart/ProductFactoryTest.php b/Tests/Functional/Domain/Model/Cart/ProductFactoryTest.php index 5761a397..7af9249f 100644 --- a/Tests/Functional/Domain/Model/Cart/ProductFactoryTest.php +++ b/Tests/Functional/Domain/Model/Cart/ProductFactoryTest.php @@ -40,9 +40,12 @@ public function setUp(): void #[Test] public function throwExceptionWithoutQuantityArgument(): void { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionCode(1741700244); - $this->expectExceptionMessage('Quantity argument is missing'); + $this->expectExceptionObject( + new InvalidArgumentException( + 'Quantity argument is missing', + 1741700244 + ) + ); $productFactory = $this->getProductFactory(); $productFactory->createProductFromRequestArguments( @@ -55,9 +58,12 @@ public function throwExceptionWithoutQuantityArgument(): void #[Test] public function throwExceptionWithQuantityArgumentLowerThanZero(): void { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionCode(1741692900); - $this->expectExceptionMessage('Quantity argument is invalid'); + $this->expectExceptionObject( + new InvalidArgumentException( + 'Quantity argument is invalid', + 1741692900 + ) + ); $productFactory = $this->getProductFactory(); $productFactory->createProductFromRequestArguments( @@ -72,9 +78,12 @@ public function throwExceptionWithQuantityArgumentLowerThanZero(): void #[Test] public function throwExceptionWithoutEventDate(): void { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionCode(1741700304); - $this->expectExceptionMessage('Event date argument is missing'); + $this->expectExceptionObject( + new InvalidArgumentException( + 'Event date argument is missing', + 1741700304 + ) + ); $productFactory = $this->getProductFactory(); $productFactory->createProductFromRequestArguments( @@ -89,9 +98,12 @@ public function throwExceptionWithoutEventDate(): void #[Test] public function throwExceptionWithNonNumericEventDate(): void { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionCode(1741692831); - $this->expectExceptionMessage('Event date argument is invalid'); + $this->expectExceptionObject( + new InvalidArgumentException( + 'Event date argument is invalid', + 1741692831 + ) + ); $productFactory = $this->getProductFactory(); $productFactory->createProductFromRequestArguments( @@ -107,9 +119,12 @@ public function throwExceptionWithNonNumericEventDate(): void #[Test] public function throwExceptionWithNotExistingEventDate(): void { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionCode(1741693220); - $this->expectExceptionMessage('Event date not found'); + $this->expectExceptionObject( + new InvalidArgumentException( + 'Event date not found', + 1741693220 + ) + ); $productFactory = $this->getProductFactory(); $productFactory->createProductFromRequestArguments( @@ -125,9 +140,12 @@ public function throwExceptionWithNotExistingEventDate(): void #[Test] public function throwExceptionWithNotBookableExistingEventDate(): void { - $this->expectException(NotBookableException::class); - $this->expectExceptionCode(1741693273); - $this->expectExceptionMessage('Event date not bookable'); + $this->expectExceptionObject( + new NotBookableException( + 'Event date not bookable', + 1741693273 + ) + ); $productFactory = $this->getProductFactory(); $productFactory->createProductFromRequestArguments(