Skip to content

Commit b272e4f

Browse files
committed
[TASK] Add TYPO3 v14 support
1 parent c0f5a42 commit b272e4f

37 files changed

Lines changed: 185 additions & 321 deletions

.github/workflows/ci.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
run: composer install --prefer-dist --no-progress --no-suggest
6262

6363
- name: Coding Guideline
64-
run: vendor/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php -v --dry-run --using-cache=no --path-mode=intersection ./
64+
run: .build/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php -v --dry-run --using-cache=no --path-mode=intersection ./
6565

6666
code-quality:
6767
runs-on: ubuntu-latest
@@ -71,13 +71,13 @@ jobs:
7171
matrix:
7272
include:
7373
- php-version: '8.2'
74-
typo3-version: '^13.4'
74+
typo3-version: '^14.1'
7575
- php-version: '8.3'
76-
typo3-version: '^13.4'
76+
typo3-version: '^14.1'
7777
- php-version: '8.4'
78-
typo3-version: '^13.4'
78+
typo3-version: '^14.1'
7979
- php-version: '8.5'
80-
typo3-version: '^13.4'
80+
typo3-version: '^14.1'
8181
steps:
8282
- uses: actions/checkout@v4
8383

@@ -92,20 +92,20 @@ jobs:
9292
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 }}"
9393
9494
- name: Build codeception tester
95-
run: vendor/bin/codecept build
95+
run: .build/bin/codecept build
9696

9797
- name: Code Quality (by PHPStan)
98-
run: vendor/bin/phpstan analyse -c Build/phpstan.neon
98+
run: .build/bin/phpstan analyse -c Build/phpstan.neon
9999

100-
test-php:
100+
test-unit-and-functional:
101101
runs-on: ubuntu-latest
102102
needs:
103103
- coding-guideline
104104
- code-quality
105105
steps:
106-
- uses: actions/checkout@v3
106+
- uses: actions/checkout@v5
107107

108-
- uses: cachix/install-nix-action@v17
108+
- uses: cachix/install-nix-action@v31
109109
with:
110110
nix_path: nixpkgs=channel:nixos-unstable
111111

Build/phpunit.xml.dist

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="true" bootstrap="../vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php" colors="true" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" beStrictAboutTestsThatDoNotTestAnything="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd" cacheDirectory=".phpunit.cache" requireCoverageMetadata="false">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
4+
backupGlobals="true"
5+
beStrictAboutTestsThatDoNotTestAnything="false"
6+
bootstrap="../.build/vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php"
7+
cacheResult="false"
8+
colors="true"
9+
failOnDeprecation="true"
10+
failOnWarning="true"
11+
failOnRisky="true"
12+
processIsolation="false"
13+
requireCoverageMetadata="false"
14+
stopOnError="false"
15+
stopOnFailure="false"
16+
stopOnIncomplete="false"
17+
stopOnSkipped="false"
18+
>
319
<coverage/>
420
<testsuites>
521
<testsuite name="functional">

Classes/Controller/ProductController.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ protected function addCategoriesToDemandObjectFromSettings(ProductDemand $demand
125125
protected function isActionAllowed(string $action): bool
126126
{
127127
$frameworkConfiguration = $this->configurationManager->getConfiguration($this->configurationManager::CONFIGURATION_TYPE_FRAMEWORK);
128-
$allowedActions = $frameworkConfiguration['controllerConfiguration'][\Extcode\CartProducts\Controller\ProductController::class]['actions'] ?? [];
128+
$allowedActions = $frameworkConfiguration['controllerConfiguration'][ProductController::class]['actions'] ?? [];
129129

130130
return in_array($action, $allowedActions, true);
131131
}
@@ -184,8 +184,8 @@ public function listAction(int $currentPage = 1): ResponseInterface
184184

185185
public function showAction(?Product $product = null): ResponseInterface
186186
{
187-
if ((int)$GLOBALS['TSFE']->page['doktype'] === 183) {
188-
$productUid = (int)$GLOBALS['TSFE']->page['cart_products_product'];
187+
if ((int)$this->request->getAttribute('frontend.page.information')->getPageRecord()['doktype'] === 183) {
188+
$productUid = (int)$this->request->getAttribute('frontend.page.information')->getPageRecord()['cart_products_product'];
189189
$product = $this->productRepository->findByUid($productUid);
190190
}
191191

@@ -254,17 +254,15 @@ protected function getProduct(): ?Product
254254
*/
255255
public function getProductUid(): mixed
256256
{
257-
if ((int)$GLOBALS['TSFE']->page['doktype'] === 183) {
258-
return (int)$GLOBALS['TSFE']->page['cart_products_product'];
257+
if ((int)$this->request->getAttribute('frontend.page.information')->getPageRecord()['doktype'] === 183) {
258+
return (int)$this->request->getAttribute('frontend.page.information')->getPageRecord()['cart_products_product'];
259259
}
260260

261261
if ($this->request->getPluginName() !== 'ProductPartial') {
262262
return 0;
263263
}
264264

265-
$configurationManager = GeneralUtility::makeInstance(
266-
ConfigurationManager::class
267-
);
265+
$configurationManager = $this->configurationManager;
268266
$configuration = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_FRAMEWORK);
269267

270268
$typoscriptService = GeneralUtility::makeInstance(

Classes/Domain/Model/Product/BeVariant.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111

1212
use TYPO3\CMS\Core\Utility\GeneralUtility;
13-
use TYPO3\CMS\Extbase\Annotation\ORM\Cascade;
13+
use TYPO3\CMS\Extbase\Attribute\ORM\Cascade;
1414
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
1515
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
1616

@@ -29,7 +29,7 @@ class BeVariant extends AbstractEntity
2929
/**
3030
* @var ObjectStorage<SpecialPrice>
3131
*/
32-
#[Cascade(['value' => 'remove'])]
32+
#[Cascade(value: 'remove')]
3333
protected ObjectStorage $specialPrices;
3434

3535
protected int $priceCalcMethod = 0;

Classes/Domain/Model/Product/FeVariant.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
* LICENSE file that was distributed with this source code.
1010
*/
1111

12-
use TYPO3\CMS\Extbase\Annotation\Validate;
12+
use TYPO3\CMS\Extbase\Attribute\Validate;
1313
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
1414

1515
class FeVariant extends AbstractEntity
1616
{
17-
#[Validate(['validator' => 'NotEmpty'])]
17+
#[Validate(validator: 'NotEmpty')]
1818
protected string $sku = '';
1919

20-
#[Validate(['validator' => 'NotEmpty'])]
20+
#[Validate(validator: 'NotEmpty')]
2121
protected string $title = '';
2222

2323
protected string $description = '';

Classes/Domain/Model/Product/Product.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
use Extcode\Cart\Domain\Model\Product\TagTrait;
1717
use Extcode\CartProducts\Domain\Model\Category;
1818
use Extcode\CartProducts\Domain\Model\TtContent;
19-
use TYPO3\CMS\Extbase\Annotation\ORM\Cascade;
20-
use TYPO3\CMS\Extbase\Annotation\ORM\Lazy;
19+
use TYPO3\CMS\Extbase\Attribute\ORM\Cascade;
20+
use TYPO3\CMS\Extbase\Attribute\ORM\Lazy;
2121
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
2222

2323
class Product extends AbstractProduct
@@ -48,21 +48,21 @@ class Product extends AbstractProduct
4848
/**
4949
* @var ObjectStorage<SpecialPrice>
5050
*/
51-
#[Cascade(['value' => 'remove'])]
51+
#[Cascade(value: 'remove')]
5252
protected ObjectStorage $specialPrices;
5353

5454
/**
5555
* @var ObjectStorage<QuantityDiscount>
5656
*/
57-
#[Cascade(['value' => 'remove'])]
57+
#[Cascade(value: 'remove')]
5858
protected ObjectStorage $quantityDiscounts;
5959

6060
protected int $taxClassId = 1;
6161

6262
/**
6363
* @var ObjectStorage<FeVariant>
6464
*/
65-
#[Cascade(['value' => 'remove'])]
65+
#[Cascade(value: 'remove')]
6666
protected ObjectStorage $feVariants;
6767

6868
/**

Classes/Domain/Model/Product/ProductBackendVariantTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* LICENSE file that was distributed with this source code.
1010
*/
1111

12-
use TYPO3\CMS\Extbase\Annotation\ORM\Cascade;
12+
use TYPO3\CMS\Extbase\Attribute\ORM\Cascade;
1313
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
1414

1515
trait ProductBackendVariantTrait
@@ -23,7 +23,7 @@ trait ProductBackendVariantTrait
2323
/**
2424
* @var ObjectStorage<BeVariant>
2525
*/
26-
#[Cascade(['value' => 'remove'])]
26+
#[Cascade(value: 'remove')]
2727
protected ObjectStorage $beVariants;
2828

2929
public function getBeVariantAttribute1(): ?BeVariantAttribute

Classes/Domain/Model/Product/QuantityDiscount.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@
1010
*/
1111

1212
use Extcode\Cart\Domain\Model\FrontendUserGroup;
13-
use TYPO3\CMS\Extbase\Annotation\Validate;
13+
use TYPO3\CMS\Extbase\Attribute\Validate;
1414
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
1515

1616
class QuantityDiscount extends AbstractEntity
1717
{
18-
#[Validate(['validator' => 'NotEmpty'])]
18+
#[Validate(validator: 'NotEmpty')]
1919
protected float $price = 0.0;
2020

2121
/**
2222
* Quantity (lower bound)
2323
*/
24-
#[Validate(['validator' => 'NotEmpty'])]
24+
#[Validate(validator: 'NotEmpty')]
2525
protected int $quantity = 0;
2626

2727
protected ?FrontendUserGroup $frontendUserGroup = null;

Classes/Domain/Model/Product/SpecialPrice.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
*/
1111

1212
use Extcode\Cart\Domain\Model\FrontendUserGroup;
13-
use TYPO3\CMS\Extbase\Annotation\Validate;
13+
use TYPO3\CMS\Extbase\Attribute\Validate;
1414
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
1515

1616
class SpecialPrice extends AbstractEntity
1717
{
18-
#[Validate(['validator' => 'NotEmpty'])]
18+
#[Validate(validator: 'NotEmpty')]
1919
protected string $title = '';
2020

21-
#[Validate(['validator' => 'NotEmpty'])]
21+
#[Validate(validator: 'NotEmpty')]
2222
protected float $price = 0.0;
2323

2424
protected ?FrontendUserGroup $frontendUserGroup = null;

Classes/Domain/Model/WatchlistItemFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function __construct(
2222
public function createFromIdentifier(
2323
string $identifier,
2424
): ?WatchlistItem {
25-
list($uid, $detailPid) = explode('-', $identifier);
25+
[$uid, $detailPid] = explode('-', $identifier);
2626

2727
$product = $this->productRepository->findProductByUid((int)$uid);
2828

0 commit comments

Comments
 (0)