diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9c2cd56e..e5a5c860 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,7 +15,6 @@ jobs: strategy: matrix: php-version: - - 8.1 - 8.2 - 8.3 steps: @@ -71,7 +70,7 @@ jobs: - name: Install PHP uses: shivammathur/setup-php@v2 with: - php-version: "8.1" + php-version: "8.2" tools: composer:v2 - name: Install dependencies @@ -87,12 +86,10 @@ jobs: strategy: matrix: include: - - php-version: '8.1' - typo3-version: '^12.4' - php-version: '8.2' - typo3-version: '^12.4' + typo3-version: '^13.2' - php-version: '8.3' - typo3-version: '^12.4' + typo3-version: '^13.2' steps: - uses: actions/checkout@v4 @@ -104,7 +101,9 @@ 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: Code Quality (by PHPStan) run: .build/bin/phpstan analyse -c Build/phpstan.neon @@ -121,18 +120,12 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable - - name: Run Unit Tests PHP8.1 - run: nix-shell --pure --run project-test-unit - - 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 Functional Tests PHP8.1 - run: nix-shell --pure --run project-test-functional - - name: Run Functional Tests PHP8.2 run: nix-shell --arg phpVersion \"php82\" --pure --run project-test-functional diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5a1a41c8..b0f922ab 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,7 +24,7 @@ stages: - analysis lint:cgl: - image: $CI_REGISTRY/containers/phpunit-with-php-8.1:main + image: $CI_REGISTRY/containers/phpunit-with-php-8.2:main stage: lint before_script: - composer remove typo3/cms-core --no-update @@ -54,13 +54,7 @@ lint:yaml: stage: lint image: $CONTAINER_IMAGE script: - - find *.php Classes Configuration Tests -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l - -lint:php81: - <<: *lint_php - stage: lint - variables: - CONTAINER_IMAGE: php:8.1-alpine + - find *.php Classes Configuration Tests lint:php82: <<: *lint_php @@ -73,10 +67,12 @@ lint:php83: CONTAINER_IMAGE: php:8.3-alpine phpstan:analyse: - image: $CI_REGISTRY/containers/phpunit-with-php-8.1:main + image: $CI_REGISTRY/containers/phpunit-with-php-8.2:main stage: lint before_script: - - composer config platform.php 8.1 + - composer config platform.php 8.2 + - composer remove --dev ssch/typo3-rector + - composer require typo3/cms-install "*" - composer install --no-progress --no-ansi --no-interaction script: - .build/bin/phpstan analyse -c Build/phpstan.neon --memory-limit 256M @@ -112,28 +108,20 @@ phpstan:analyse: expire_in: 1 day when: always -# Build in PHP 8.1 and TYPO3 12.4 -test:php81:typo3_12: - <<: *test_php - variables: - CONTAINER_IMAGE: $CI_REGISTRY/containers/phpunit-with-php-8.1:main - TYPO3_VERSION: ^12.4 - COVERAGE: 0 - -# Build in PHP 8.2 and TYPO3 12.4 -test:php82:typo3_12: +# Build in PHP 8.2 and TYPO3 13.3 +test:php82:typo3_13: <<: *test_php variables: CONTAINER_IMAGE: $CI_REGISTRY/containers/phpunit-with-php-8.2:main - TYPO3_VERSION: ^12.4 + TYPO3_VERSION: ^13.3 COVERAGE: 0 -# Build in PHP 8.3 and TYPO3 12.4 -test:php83:typo3_12: +# Build in PHP 8.3 and TYPO3 13.2 +test:php83:typo3_13: <<: *test_php variables: CONTAINER_IMAGE: $CI_REGISTRY/containers/phpunit-with-php-8.3:main - TYPO3_VERSION: ^12.4 + TYPO3_VERSION: ^13.3 COVERAGE: 1 documentation: @@ -163,7 +151,7 @@ sonarqube: SONAR_SOURCES: "./Classes" SONAR_GITLAB_PROJECT_ID: "$CI_PROJECT_ID" script: - - echo "sonar.projectKey=cart-9.x" > sonar-project.properties + - echo "sonar.projectKey=cart-10.x" > sonar-project.properties - gitlab-sonar-scanner -Dsonar.php.coverage.reportPath=phpunit.coverage.xml -Dsonar.php.tests.reportPath=phpunit.report.xml allow_failure: true @@ -179,5 +167,5 @@ sonarqube-reports: SONAR_SOURCES: "./Classes" SONAR_TESTS: "./Tests" script: - - echo "sonar.projectKey=cart-9.x" > sonar-project.properties + - echo "sonar.projectKey=cart-10.x" > sonar-project.properties - gitlab-sonar-scanner -Dsonar.php.coverage.reportPath=phpunit.coverage.xml -Dsonar.php.tests.reportPath=phpunit.report.xml diff --git a/Build/FunctionalTests.xml b/Build/FunctionalTests.xml index ebba3b5d..c381bae5 100644 --- a/Build/FunctionalTests.xml +++ b/Build/FunctionalTests.xml @@ -1,5 +1,21 @@ - + diff --git a/Build/UnitTests.xml b/Build/UnitTests.xml index 2b2373ac..9825de0b 100644 --- a/Build/UnitTests.xml +++ b/Build/UnitTests.xml @@ -1,5 +1,21 @@ - + diff --git a/Build/phpstan-baseline.neon b/Build/phpstan-baseline.neon index 2c4057f4..3cfb689d 100644 --- a/Build/phpstan-baseline.neon +++ b/Build/phpstan-baseline.neon @@ -19,8 +19,3 @@ parameters: message: "#^Call to an undefined method Extcode\\\\Cart\\\\Service\\\\PaymentMethodsServiceInterface\\:\\:getConfigurationsForType\\(\\)\\.$#" count: 1 path: ../Classes/EventListener/Order/Finish/ClearCart.php - - - - message: "#^Call to an undefined method TYPO3Fluid\\\\Fluid\\\\Core\\\\Rendering\\\\RenderingContextInterface\\:\\:getRequest\\(\\)\\.$#" - count: 1 - path: ../Classes/View/CartTemplateView.php diff --git a/Classes/Controller/Backend/Order/OrderController.php b/Classes/Controller/Backend/Order/OrderController.php index 7d82f3e4..ccbb3061 100644 --- a/Classes/Controller/Backend/Order/OrderController.php +++ b/Classes/Controller/Backend/Order/OrderController.php @@ -21,8 +21,8 @@ use TYPO3\CMS\Backend\Template\Components\ButtonBar; use TYPO3\CMS\Backend\Template\ModuleTemplate; use TYPO3\CMS\Backend\Template\ModuleTemplateFactory; -use TYPO3\CMS\Core\Imaging\Icon; use TYPO3\CMS\Core\Imaging\IconFactory; +use TYPO3\CMS\Core\Imaging\IconSize; use TYPO3\CMS\Core\Localization\LanguageService; use TYPO3\CMS\Core\Page\PageRenderer; use TYPO3\CMS\Core\Pagination\SimplePagination; @@ -259,7 +259,7 @@ private function setDocHeader(array $buttons): void foreach ($buttons as $button) { $title = $this->getLanguageService()->sL(self::LANG_FILE . $button['title']); - $icon = $this->iconFactory->getIcon($button['icon'], Icon::SIZE_SMALL); + $icon = $this->iconFactory->getIcon($button['icon'], IconSize::SMALL->value); $viewButton = $buttonBar->makeLinkButton() ->setHref($button['link']) diff --git a/Classes/Controller/Cart/CartController.php b/Classes/Controller/Cart/CartController.php index 7224e066..53be2f2c 100755 --- a/Classes/Controller/Cart/CartController.php +++ b/Classes/Controller/Cart/CartController.php @@ -16,50 +16,12 @@ use Extcode\Cart\Domain\Model\Order\ShippingAddress; use Extcode\Cart\Event\Cart\BeforeShowCartEvent; use Extcode\Cart\Event\CheckProductAvailabilityEvent; -use Extcode\Cart\View\CartTemplateView; use Psr\Http\Message\ResponseInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Mvc\ExtbaseRequestParameters; class CartController extends ActionController { - public function __construct() - { - $this->defaultViewObjectName = CartTemplateView::class; - } - - protected function initializeView(CartTemplateView $view): void - { - if ($this->request->getControllerActionName() !== 'show') { - return; - } - - if (!isset($this->settings['cart']['steps'])) { - return; - } - - $steps = (int)($this->settings['cart']['steps'] ?? 0); - if ($steps > 1) { - if ($this->request->hasArgument('step')) { - $currentStep = (int)$this->request->getArgument('step') ?: 1; - } else { - $currentStep = 1; - } - - if ($currentStep > $steps) { - throw new \InvalidArgumentException(); - } - $view->setStep($currentStep); - - if ($currentStep < $steps) { - $view->assign('nextStep', $currentStep + 1); - } - if ($currentStep > 1) { - $view->assign('previousStep', $currentStep - 1); - } - } - } - public function showAction( Item $orderItem = null, BillingAddress $billingAddress = null, @@ -145,7 +107,10 @@ public function showAction( if (count($this->cart->getProducts()) === 0 && $currentStep > 1) { return $this->redirect('show', null, null, ['step' => 1])->withStatus(303); } - return $this->htmlResponse(); + + $template = $this->getTemplateForShowAction(); + + return $this->htmlResponse($this->view->render($template)); } @@ -204,4 +169,31 @@ public function updateAction(): ResponseInterface return $this->redirect('show'); } + + private function getTemplateForShowAction(): string + { + $steps = (int)($this->settings['cart']['steps'] ?? 1); + + if ($steps === 1) { + return 'Show'; + } + + $currentStep = 1; + if ($this->request->hasArgument('step')) { + $currentStep = (int)$this->request->getArgument('step') ?: 1; + } + + if ($currentStep > $steps) { + throw new \InvalidArgumentException(); + } + + if ($currentStep < $steps) { + $this->view->assign('nextStep', $currentStep + 1); + } + if ($currentStep > 1) { + $this->view->assign('previousStep', $currentStep - 1); + } + + return 'ShowStep' . $currentStep; + } } diff --git a/Classes/Controller/Cart/OrderController.php b/Classes/Controller/Cart/OrderController.php index 228d7d63..0da990e9 100644 --- a/Classes/Controller/Cart/OrderController.php +++ b/Classes/Controller/Cart/OrderController.php @@ -33,12 +33,12 @@ class OrderController extends ActionController { - protected function getErrorFlashMessage(): ?string + protected function getErrorFlashMessage(): bool|string { return LocalizationUtility::translate( 'tx_cart.error.validation', 'Cart' - ); + ) ?? false; } public function initializeCreateAction(): void diff --git a/Classes/Domain/Model/Cart/TaxClass.php b/Classes/Domain/Model/Cart/TaxClass.php index f43ec0fa..0cc0d897 100644 --- a/Classes/Domain/Model/Cart/TaxClass.php +++ b/Classes/Domain/Model/Cart/TaxClass.php @@ -11,13 +11,13 @@ * LICENSE file that was distributed with this source code. */ -final class TaxClass implements TaxClassInterface +final readonly class TaxClass implements TaxClassInterface { public function __construct( - private readonly int $id, - private readonly string $value, - private readonly float $calc, - private readonly string $title + private int $id, + private string $value, + private float $calc, + private string $title ) {} public function getId(): int diff --git a/Classes/Domain/Model/Cart/TaxClassFactory.php b/Classes/Domain/Model/Cart/TaxClassFactory.php index 87547156..b2e91c39 100644 --- a/Classes/Domain/Model/Cart/TaxClassFactory.php +++ b/Classes/Domain/Model/Cart/TaxClassFactory.php @@ -13,10 +13,10 @@ use Psr\Log\LoggerInterface; -final class TaxClassFactory implements TaxClassFactoryInterface +final readonly class TaxClassFactory implements TaxClassFactoryInterface { public function __construct( - private readonly LoggerInterface $logger + private LoggerInterface $logger ) {} public function getTaxClass(int $taxClassKey, array $taxClassValue): ?TaxClass diff --git a/Classes/Event/Cart/UpdateCountryEvent.php b/Classes/Event/Cart/UpdateCountryEvent.php index 279defe9..92bb889b 100644 --- a/Classes/Event/Cart/UpdateCountryEvent.php +++ b/Classes/Event/Cart/UpdateCountryEvent.php @@ -14,11 +14,11 @@ use Extcode\Cart\Domain\Model\Cart\Cart; use TYPO3\CMS\Extbase\Mvc\Request; -final class UpdateCountryEvent implements UpdateCountryEventInterface +final readonly class UpdateCountryEvent implements UpdateCountryEventInterface { public function __construct( - private readonly Cart $cart, - private readonly Request $request + private Cart $cart, + private Request $request ) {} public function getCart(): Cart diff --git a/Classes/Event/Cart/UpdateCurrencyEvent.php b/Classes/Event/Cart/UpdateCurrencyEvent.php index d3072eb6..a9bdb2b4 100644 --- a/Classes/Event/Cart/UpdateCurrencyEvent.php +++ b/Classes/Event/Cart/UpdateCurrencyEvent.php @@ -14,12 +14,12 @@ use Extcode\Cart\Domain\Model\Cart\Cart; use TYPO3\CMS\Extbase\Mvc\Request; -final class UpdateCurrencyEvent implements UpdateCurrencyEventInterface +final readonly class UpdateCurrencyEvent implements UpdateCurrencyEventInterface { public function __construct( - private readonly Cart $cart, - private readonly Request $request, - private readonly array $settings = [] + private Cart $cart, + private Request $request, + private array $settings = [] ) {} public function getCart(): Cart diff --git a/Classes/Updates/ListTypeToCTypeUpdate.php b/Classes/Updates/ListTypeToCTypeUpdate.php new file mode 100644 index 00000000..2f046f3a --- /dev/null +++ b/Classes/Updates/ListTypeToCTypeUpdate.php @@ -0,0 +1,37 @@ + 'cart_cart', + 'cart_currency' => 'cart_currency', + 'cart_minicart' => 'cart_minicart', + 'cart_order' => 'cart_order', + ]; + } + + public function getTitle(): string + { + return 'Update cart list_type to CType.'; + } + + public function getDescription(): string + { + return 'Update all cart list_type plugin to CType.'; + } +} diff --git a/Classes/View/CartTemplateView.php b/Classes/View/CartTemplateView.php deleted file mode 100644 index d6cc64e9..00000000 --- a/Classes/View/CartTemplateView.php +++ /dev/null @@ -1,26 +0,0 @@ -baseRenderingContext->getTemplatePaths(); - $templatePathAndFilename = $templatePaths->resolveTemplateFileForControllerAndActionAndFormat( - $this->getRenderingContext()->getRequest()->getControllerName(), - 'ShowStep' . $step - ); - - $this->setTemplatePathAndFilename($templatePathAndFilename); - } -} diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index 6f9a6ec2..9173ffbd 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -148,9 +148,6 @@ services: Extcode\Cart\Service\TaxClassService: public: true - Extcode\Cart\View\CartTemplateView: - public: true - querybuilder.tx_cart_domain_model_order_item: class: 'TYPO3\CMS\Core\Database\Query\QueryBuilder' factory: diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index a572c891..cbb8484d 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -1,44 +1,48 @@ [ + 'iconIdentifier' => 'ext-cart-wizard-icon', + ], + 'Cart' => [ + 'iconIdentifier' => 'ext-cart-wizard-icon', + ], + 'Currency' => [ + 'iconIdentifier' => 'ext-cart-wizard-icon', + ], + 'Order' => [ + 'iconIdentifier' => 'ext-cart-wizard-icon', + ], ]; - foreach ($pluginNames as $pluginName) { + foreach ($pluginNames as $pluginName => $pluginConfig) { $pluginSignature = 'cart_' . strtolower($pluginName); + ExtensionUtility::registerPlugin( 'Cart', $pluginName, - $_LLL_db . 'tx_cart.plugin.' . strtolower((string)preg_replace('/[A-Z]/', '_$0', lcfirst($pluginName))) + $_LLL_db . 'tx_cart.plugin.' . $pluginSignature, + $pluginConfig['iconIdentifier'], + 'cart' ); - $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature] = 'select_key'; $flexFormPath = 'EXT:cart/Configuration/FlexForms/' . $pluginName . 'Plugin.xml'; if (file_exists(GeneralUtility::getFileAbsFileName($flexFormPath))) { - $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform'; + $GLOBALS['TCA']['tt_content']['types'][$pluginSignature]['showitem'] = 'pi_flexform'; + ExtensionManagementUtility::addPiFlexFormValue( $pluginSignature, 'FILE:' . $flexFormPath ); } } - - $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['cart_minicart'] = 'select_key,pages,recursive'; - $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['cart_currency'] = 'select_key,pages,recursive'; - $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['cart_flexproduct'] = 'select_key,pages,recursive'; }); diff --git a/Configuration/TSconfig/ContentElementWizard.tsconfig b/Configuration/TSconfig/ContentElementWizard.tsconfig deleted file mode 100644 index 3ed22066..00000000 --- a/Configuration/TSconfig/ContentElementWizard.tsconfig +++ /dev/null @@ -1,13 +0,0 @@ -mod.wizards.newContentElement.wizardItems.plugins { - elements { - cart { - iconIdentifier = ext-cart-wizard-icon - title = LLL:EXT:cart/Resources/Private/Language/locallang_be.xlf:tx_cart.plugin.cart.title - description = LLL:EXT:cart/Resources/Private/Language/locallang_be.xlf:tx_cart.plugin.cart.description - tt_content_defValues { - CType = list - list_type = cart_cart - } - } - } -} \ No newline at end of file diff --git a/README.md b/README.md index 69836caf..be5b4ec6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ +# Cart Products + [![Codacy Badge](https://api.codacy.com/project/badge/Grade/5b5b6e0c8ac143c381026061abf3c9e8)](https://www.codacy.com/app/extcode/cart?utm_source=github.com&utm_medium=referral&utm_content=extcode/cart&utm_campaign=Badge_Grade) +![GitHub Actions](https://github.com/extcode/cart/actions/workflows/ci.yaml/badge.svg?branch=10.x-dev) The extension is a small but powerful extension which "solely" adds a shopping cart to your TYPO3 installation and is well suited for content commerce. @@ -45,17 +48,18 @@ Sometimes minor versions also result in minor adjustments to own templates or co ## 3.1 Compatibility and supported Versions -| Cart | TYPO3 | PHP | Support/Development | -|-------|------------|-----------|--------------------------------------| -| 9.x.x | 12.0 | 8.1+ | Features, Bugfixes, Security Updates | -| 8.x.x | 10.4, 11.5 | 7.2+ | Features, Bugfixes, Security Updates | -| 7.x.x | 10.4 | 7.2 - 7.4 | Security Updates | -| 6.x.x | 9.5 | 7.2 - 7.4 | | -| 5.x.x | 8.7 | 7.0 - 7.4 | | -| 4.x.x | 7.6 - 8.7 | 5.6 - 7.2 | | -| 3.x.x | 6.2 - 8.7 | 5.6 - 7.0 | | -| 2.x.x | | | | -| 1.x.x | | | | +| Cart | TYPO3 | PHP | Support/Development | +|--------|------------|-----------|--------------------------------------| +| 10.x.x | 13.0 | 8.2+ | Features, Bugfixes, Security Updates | +| 9.x.x | 12.4 | 8.1+ | Bugfixes, Security Updates | +| 8.x.x | 10.4, 11.5 | 7.2+ | Security Updates | +| 7.x.x | 10.4 | 7.2 - 7.4 | | +| 6.x.x | 9.5 | 7.2 - 7.4 | | +| 5.x.x | 8.7 | 7.0 - 7.4 | | +| 4.x.x | 7.6 - 8.7 | 5.6 - 7.2 | | +| 3.x.x | 6.2 - 8.7 | 5.6 - 7.0 | | +| 2.x.x | | | | +| 1.x.x | | | | If you need extended support for features and bug fixes outside of the currently supported versions, we are happy to offer paid services. diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index d0b6a3c7..17546d38 100644 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -3,16 +3,16 @@
- + Cart: Mini-Cart - + Cart: Cart - + Cart: Currency Selector - + Cart: Orders diff --git a/Tests/Functional/EventListener/Mail/AttachmentFromOrderItemTest.php b/Tests/Functional/EventListener/Mail/AttachmentFromOrderItemTest.php index b971f61d..38217d48 100644 --- a/Tests/Functional/EventListener/Mail/AttachmentFromOrderItemTest.php +++ b/Tests/Functional/EventListener/Mail/AttachmentFromOrderItemTest.php @@ -13,7 +13,9 @@ use Extcode\Cart\Event\Mail\AttachmentEvent; use Extcode\Cart\EventListener\Mail\AttachmentFromOrderItem; use PHPUnit\Framework\Attributes\Test; +use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; use TYPO3\CMS\Core\EventDispatcher\ListenerProvider; +use TYPO3\CMS\Core\Http\ServerRequest; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; class AttachmentFromOrderItemTest extends FunctionalTestCase @@ -28,6 +30,10 @@ class AttachmentFromOrderItemTest extends FunctionalTestCase public function setUp(): void { parent::setUp(); + + $GLOBALS['TYPO3_REQUEST'] = (new ServerRequest()) + ->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_BE); + $this->importPHPDataSet(__DIR__ . '/../../../Fixtures/BaseDatabase.php'); } diff --git a/Tests/Functional/EventListener/Mail/AttachmentFromTypoScriptTest.php b/Tests/Functional/EventListener/Mail/AttachmentFromTypoScriptTest.php index 036443a2..e4f09c49 100644 --- a/Tests/Functional/EventListener/Mail/AttachmentFromTypoScriptTest.php +++ b/Tests/Functional/EventListener/Mail/AttachmentFromTypoScriptTest.php @@ -13,7 +13,9 @@ use Extcode\Cart\Event\Mail\AttachmentEvent; use Extcode\Cart\EventListener\Mail\AttachmentFromTypoScript; use PHPUnit\Framework\Attributes\Test; +use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; use TYPO3\CMS\Core\EventDispatcher\ListenerProvider; +use TYPO3\CMS\Core\Http\ServerRequest; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Configuration\ConfigurationManager; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -30,6 +32,10 @@ class AttachmentFromTypoScriptTest extends FunctionalTestCase public function setUp(): void { parent::setUp(); + + $GLOBALS['TYPO3_REQUEST'] = (new ServerRequest()) + ->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_BE); + $this->importPHPDataSet(__DIR__ . '/../../../Fixtures/BaseDatabase.php'); } diff --git a/composer.json b/composer.json index 71b6fa67..e1148762 100644 --- a/composer.json +++ b/composer.json @@ -48,22 +48,21 @@ } }, "require": { - "php": "^8.1", + "php": "^8.2", "ext-json": "*", "ext-openssl": "*", - "typo3/cms-core": "^12.4", - "typo3/cms-extbase": "^12.4", - "typo3/cms-fluid": "^12.4", - "typo3/cms-form": "^12.4" + "typo3/cms-core": "^13.4", + "typo3/cms-extbase": "^13.4", + "typo3/cms-fluid": "^13.4", + "typo3/cms-form": "^13.4" }, "require-dev": { "codappix/typo3-php-datasets": "^1.5", - "friendsofphp/php-cs-fixer": "^3.16", - "phpstan/phpstan": "^1.10", - "sbuerk/typo3-cmscomposerinstallers-testingframework-bridge": "^0.0.1", - "ssch/typo3-rector": "^2.6", - "typo3/cms-dashboard": "^12.4", - "typo3/testing-framework": "^8.0" + "friendsofphp/php-cs-fixer": "^3.64", + "phpstan/phpstan": "^1.12", + "ssch/typo3-rector": "^2.9", + "typo3/cms-dashboard": "^13.4", + "typo3/testing-framework": "^8.2" }, "scripts": { "test:cgl": [ @@ -85,10 +84,10 @@ ".build/bin/phpstan analyse -c Build/phpstan.neon --memory-limit 256M" ], "test:rector:process": [ - ".build/bin/rector process" + ".build/bin/rector process *" ], "test:rector:process:dry-run": [ - ".build/bin/rector process --dry-run" + ".build/bin/rector process * --dry-run" ], "test:typoscript:lint": [ ".build/bin/typoscript-lint -c Build/typoscriptlint.yaml Configuration" @@ -107,6 +106,6 @@ ] }, "suggest": { - "typo3/cms-dashboard": "^12.3" + "typo3/cms-dashboard": "^13.4" } } diff --git a/ext_emconf.php b/ext_emconf.php index 6868636a..c6c27ed7 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -4,14 +4,14 @@ 'title' => 'Cart', 'description' => 'Shopping Cart(s) for TYPO3', 'category' => 'plugin', - 'version' => '9.0.3', + 'version' => '10.0.0', 'state' => 'stable', 'author' => 'Daniel Gohlke', 'author_email' => 'ext@extco.de', 'author_company' => 'extco.de UG (haftungsbeschränkt)', 'constraints' => [ 'depends' => [ - 'typo3' => '12.4.0-12.4.99', + 'typo3' => '13.4.0-13.4.99', ], 'conflicts' => [], 'suggests' => [], diff --git a/ext_localconf.php b/ext_localconf.php index 3d5add58..24086288 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -25,7 +25,8 @@ [ CartPreviewController::class => 'show', CurrencyController::class => 'update', - ] + ], + ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT ); ExtensionUtility::configurePlugin( @@ -50,7 +51,8 @@ PaymentController::class => 'update', ProductController::class => 'add, remove', ShippingController::class => 'update', - ] + ], + ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT ); ExtensionUtility::configurePlugin( @@ -61,7 +63,8 @@ ], [ CurrencyController::class => 'edit, update', - ] + ], + ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT ); ExtensionUtility::configurePlugin( @@ -72,7 +75,8 @@ ], [ \Extcode\Cart\Controller\Order\OrderController::class => 'list, show', - ] + ], + ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT ); // register "cart:" namespace diff --git a/rector.php b/rector.php index b4f7afcf..54b60925 100644 --- a/rector.php +++ b/rector.php @@ -24,12 +24,12 @@ __DIR__ . '/ext_localconf.php', ]) // uncomment to reach your current PHP version - ->withPhpSets(php81: true) - ->withPhpVersion(PhpVersion::PHP_81) + ->withPhpSets(php82: true) + ->withPhpVersion(PhpVersion::PHP_82) ->withSets([ Typo3SetList::CODE_QUALITY, Typo3SetList::GENERAL, - Typo3LevelSetList::UP_TO_TYPO3_12, + Typo3LevelSetList::UP_TO_TYPO3_13, ]) // To have a better analysis from PHPStan, we teach it here some more things ->withPHPStanConfigs([ @@ -40,8 +40,8 @@ ConvertImplicitVariablesToExplicitGlobalsRector::class, ]) ->withConfiguredRule(ExtEmConfRector::class, [ - ExtEmConfRector::PHP_VERSION_CONSTRAINT => '8.1.0-8.3.99', - ExtEmConfRector::TYPO3_VERSION_CONSTRAINT => '12.4.0-12.4.99', + ExtEmConfRector::PHP_VERSION_CONSTRAINT => '8.2.0-8.3.99', + ExtEmConfRector::TYPO3_VERSION_CONSTRAINT => '13.4.0-13.4.99', ExtEmConfRector::ADDITIONAL_VALUES_TO_BE_REMOVED => [], ]) // If you use withImportNames(), you should consider excluding some TYPO3 files. diff --git a/shell.nix b/shell.nix index 4319c0cd..c0a30c3b 100644 --- a/shell.nix +++ b/shell.nix @@ -1,6 +1,6 @@ { pkgs ? import { } - ,phpVersion ? "php81" + ,phpVersion ? "php82" }: let @@ -83,7 +83,7 @@ let ]; text = '' project-install - .build/bin/phpunit -c Build/UnitTests.xml + .build/bin/phpunit -c Build/UnitTests.xml --display-deprecations --display-warnings ''; }; @@ -95,7 +95,7 @@ let ]; text = '' project-install - .build/bin/phpunit -c Build/FunctionalTests.xml --display-deprecations + .build/bin/phpunit -c Build/FunctionalTests.xml --display-deprecations --display-warnings ''; }; @@ -105,6 +105,7 @@ in pkgs.mkShell { php composer projectInstall + projectPhpstan projectCgl projectCglFix projectLint