Skip to content

Commit d05b9dc

Browse files
committed
[TASK] Make extension compatible to TYPO3 v14.2
1 parent 9922bcd commit d05b9dc

11 files changed

Lines changed: 88 additions & 38 deletions

Build/phpstan-baseline.neon

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2436,6 +2436,12 @@ parameters:
24362436
count: 1
24372437
path: ../Classes/Domain/Validator/OrderItemValidator.php
24382438

2439+
-
2440+
message: '#^Parameter \#2 \$validators of method Extcode\\Cart\\Domain\\Validator\\OrderItemValidator\:\:checkProperty\(\) expects Traversable\<mixed, TYPO3\\CMS\\Extbase\\Validation\\Validator\\ValidatorInterface\>, iterable\<TYPO3\\CMS\\Extbase\\Validation\\Validator\\ValidatorInterface\>&SplObjectStorage given\.$#'
2441+
identifier: argument.type
2442+
count: 1
2443+
path: ../Classes/Domain/Validator/OrderItemValidator.php
2444+
24392445
-
24402446
message: '#^Property TYPO3\\CMS\\Extbase\\Validation\\Validator\\AbstractGenericObjectValidator\:\:\$propertyValidators \(array\<string, iterable\<TYPO3\\CMS\\Extbase\\Validation\\Validator\\ValidatorInterface\>&SplObjectStorage\>\) does not accept array\<string, \(iterable\<TYPO3\\CMS\\Extbase\\Validation\\Validator\\ValidatorInterface\>&SplObjectStorage\)\|SplObjectStorage\<object, mixed\>\>\.$#'
24412447
identifier: assign.propertyType

Tests/Fixtures/BackendUser.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
return [
6+
'be_users' => [
7+
0 => [
8+
'uid' => '1',
9+
'pid' => '0',
10+
'username' => 'admin',
11+
'password' => '$1$tCrlLajZ$C0sikFQQ3SWaFAZ1Me0Z/1',
12+
'admin' => 1,
13+
],
14+
],
15+
];

Tests/Fixtures/BaseDatabase.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,23 @@
1616
'deleted' => '0',
1717
'is_siteroot' => '1',
1818
],
19+
100 => [
20+
'uid' => '101',
21+
'pid' => '0',
22+
'title' => 'Shop',
23+
'doktype' => PageRepository::DOKTYPE_SYSFOLDER,
24+
'slug' => '/shop-folder',
25+
'sorting' => '128',
26+
'deleted' => '0',
27+
],
28+
104 => [
29+
'uid' => '105',
30+
'pid' => '101',
31+
'title' => 'Orders',
32+
'doktype' => PageRepository::DOKTYPE_SYSFOLDER,
33+
'slug' => '/orders-folder',
34+
'sorting' => '128',
35+
'deleted' => '0',
36+
],
1937
],
2038
];

Tests/Functional/Command/AbstractCommandTestCase.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@
1111
* LICENSE file that was distributed with this source code.
1212
*/
1313

14-
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
14+
use Codappix\Typo3PhpDatasets\TestingFramework;
1515
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
1616
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
1717

1818
abstract class AbstractCommandTestCase extends FunctionalTestCase
1919
{
20+
use TestingFramework;
21+
22+
private const FORM_PROTECTION_SESSION_TOKEN = 'testtoken';
23+
2024
protected function setUp(): void
2125
{
2226
$this->testExtensionsToLoad = [
@@ -25,28 +29,27 @@ protected function setUp(): void
2529

2630
$this->coreExtensionsToLoad = [
2731
'typo3/cms-beuser',
32+
'typo3/cms-core',
33+
'typo3/cms-form',
2834
];
2935

3036
$this->pathsToLinkInTestInstance['typo3conf/ext/cart/Tests/Functional/Fixtures/Import/Sites/'] = 'typo3conf/sites';
3137

3238
parent::setUp();
3339

34-
$backendUser = self::createStub(BackendUserAuthentication::class);
35-
$backendUser->method('isAdmin')->willReturn(true);
36-
$backendUser->method('recordEditAccessInternals')->willReturn(true);
37-
$backendUser->workspace = 0;
38-
$backendUser->user = [
39-
'uid' => 1,
40-
'admin' => true,
41-
];
42-
$GLOBALS['BE_USER'] = $backendUser;
40+
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/BaseDatabase.php');
41+
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/BackendUser.php');
42+
43+
$this->setUpBackendUser(1)
44+
->getSession()
45+
->set('formProtectionSessionToken', self::FORM_PROTECTION_SESSION_TOKEN);
46+
4347
$GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->create('en');
4448
}
4549

4650
protected function tearDown(): void
4751
{
4852
unset(
49-
$GLOBALS['BE_USER'],
5053
$GLOBALS['LANG']
5154
);
5255

Tests/Functional/EventListener/Mail/AttachmentFromOrderItemTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ public function setUp(): void
2727
$this->testExtensionsToLoad[] = 'extcode/cart';
2828
$this->testExtensionsToLoad[] = 'typo3conf/ext/cart/Tests/Fixtures/cart_example';
2929

30+
$this->coreExtensionsToLoad = [
31+
'typo3/cms-beuser',
32+
'typo3/cms-core',
33+
'typo3/cms-form',
34+
];
35+
3036
parent::setUp();
3137

3238
$GLOBALS['TYPO3_REQUEST'] = (new ServerRequest())

Tests/Functional/EventListener/Mail/AttachmentFromTypoScriptTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ public function setUp(): void
2929
$this->testExtensionsToLoad[] = 'extcode/cart';
3030
$this->testExtensionsToLoad[] = 'typo3conf/ext/cart/Tests/Fixtures/cart_example';
3131

32+
$this->coreExtensionsToLoad = [
33+
'typo3/cms-beuser',
34+
'typo3/cms-core',
35+
'typo3/cms-form',
36+
];
37+
3238
parent::setUp();
3339

3440
$GLOBALS['TYPO3_REQUEST'] = (new ServerRequest())

Tests/Functional/Service/MailHandlerTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ public function setUp(): void
3737
$this->testExtensionsToLoad[] = 'extcode/cart';
3838
$this->testExtensionsToLoad[] = 'typo3conf/ext/cart/Tests/Fixtures/cart_example';
3939

40+
$this->coreExtensionsToLoad = [
41+
'typo3/cms-beuser',
42+
'typo3/cms-core',
43+
'typo3/cms-form',
44+
];
45+
4046
$this->configurationToUseInTestInstance = [
4147
'LOG' => [
4248
'Extcode' => [

Tests/Functional/ViewHelpers/CsvHeaderViewHelperTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ public function setUp(): void
2727
{
2828
$this->testExtensionsToLoad[] = 'extcode/cart';
2929

30+
$this->coreExtensionsToLoad = [
31+
'typo3/cms-beuser',
32+
'typo3/cms-core',
33+
'typo3/cms-form',
34+
];
35+
3036
parent::setUp();
3137
}
3238

Tests/Functional/ViewHelpers/CsvValuesViewHelperTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ public function setUp(): void
3131
{
3232
$this->testExtensionsToLoad[] = 'extcode/cart';
3333

34+
$this->coreExtensionsToLoad = [
35+
'typo3/cms-beuser',
36+
'typo3/cms-core',
37+
'typo3/cms-form',
38+
];
39+
3440
parent::setUp();
3541

3642
$this->itemRepository = GeneralUtility::makeInstance(ItemRepository::class);

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@
5353
"php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
5454
"ext-json": "*",
5555
"ext-openssl": "*",
56-
"typo3/cms-core": "^14.0",
57-
"typo3/cms-extbase": "^14.0",
58-
"typo3/cms-fluid": "^14.0",
59-
"typo3/cms-form": "^14.0",
60-
"typo3/cms-frontend": "^14.0"
56+
"typo3/cms-core": "^14.2",
57+
"typo3/cms-extbase": "^14.2",
58+
"typo3/cms-fluid": "^14.2",
59+
"typo3/cms-form": "^14.2",
60+
"typo3/cms-frontend": "^14.2"
6161
},
6262
"require-dev": {
6363
"codappix/typo3-php-datasets": "^2.1",

0 commit comments

Comments
 (0)