Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Build/.php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
(new PhpCsFixer\Finder())
->ignoreVCSIgnored(true)
->in(__DIR__ . '/../')
->exclude(
[
'var/',
]
)
)
->setRiskyAllowed(true)
->setRules([
Expand Down
13 changes: 6 additions & 7 deletions Build/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2436,6 +2436,12 @@ parameters:
count: 1
path: ../Classes/Domain/Validator/OrderItemValidator.php

-
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\.$#'
identifier: argument.type
count: 1
path: ../Classes/Domain/Validator/OrderItemValidator.php

-
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\>\>\.$#'
identifier: assign.propertyType
Expand Down Expand Up @@ -5555,10 +5561,3 @@ parameters:
identifier: argument.templateType
count: 1
path: ../Tests/Unit/Validation/Validator/EmptyValidatorTest.php

-
message: '#^Cannot access offset ''cart'' on mixed\.$#'
identifier: offsetAccess.nonOffsetAccessible
count: 1
path: ../ext_emconf.php

1 change: 0 additions & 1 deletion Build/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ parameters:
- ../Classes
- ../Configuration
- ../Tests
- ../ext_emconf.php
- ../ext_localconf.php

disallowedFunctionCalls:
Expand Down
2 changes: 1 addition & 1 deletion Classes/Service/OrderItemCleanupService.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private function deleteRecordsFromTable(string $tableName, array $recordUids): v

if ($dataHandler->errorLog !== []) {
throw new RuntimeException(
'Could not properly delete records for table: ' . $tableName . ', got the following errors: ' . implode(', ', array_filter($dataHandler->errorLog, 'is_string')),
'Could not properly delete records for table: ' . $tableName . ', got the following errors: ' . implode(', ', array_filter($dataHandler->errorLog, is_string(...))),
1751526777
);
}
Expand Down
15 changes: 15 additions & 0 deletions Tests/Fixtures/BackendUser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

return [
'be_users' => [
0 => [
'uid' => '1',
'pid' => '0',
'username' => 'admin',
'password' => '$1$tCrlLajZ$C0sikFQQ3SWaFAZ1Me0Z/1',
'admin' => 1,
],
],
];
18 changes: 18 additions & 0 deletions Tests/Fixtures/BaseDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,23 @@
'deleted' => '0',
'is_siteroot' => '1',
],
100 => [
'uid' => '101',
'pid' => '0',
'title' => 'Shop',
'doktype' => PageRepository::DOKTYPE_SYSFOLDER,
'slug' => '/shop-folder',
'sorting' => '128',
'deleted' => '0',
],
104 => [
'uid' => '105',
'pid' => '101',
'title' => 'Orders',
'doktype' => PageRepository::DOKTYPE_SYSFOLDER,
'slug' => '/orders-folder',
'sorting' => '128',
'deleted' => '0',
],
],
];
24 changes: 13 additions & 11 deletions Tests/Functional/Command/AbstractCommandTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@
* LICENSE file that was distributed with this source code.
*/

use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use Codappix\Typo3PhpDatasets\TestingFramework;
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

abstract class AbstractCommandTestCase extends FunctionalTestCase
{
use TestingFramework;

private const FORM_PROTECTION_SESSION_TOKEN = 'testtoken';

protected function setUp(): void
{
$this->testExtensionsToLoad = [
Expand All @@ -25,28 +29,26 @@ protected function setUp(): void

$this->coreExtensionsToLoad = [
'typo3/cms-beuser',
'typo3/cms-core',
];

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

parent::setUp();

$backendUser = self::createStub(BackendUserAuthentication::class);
$backendUser->method('isAdmin')->willReturn(true);
$backendUser->method('recordEditAccessInternals')->willReturn(true);
$backendUser->workspace = 0;
$backendUser->user = [
'uid' => 1,
'admin' => true,
];
$GLOBALS['BE_USER'] = $backendUser;
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/BaseDatabase.php');
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/BackendUser.php');

$this->setUpBackendUser(1)
->getSession()
->set('formProtectionSessionToken', self::FORM_PROTECTION_SESSION_TOKEN);

$GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->create('en');
}

protected function tearDown(): void
{
unset(
$GLOBALS['BE_USER'],
$GLOBALS['LANG']
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,15 @@ class AttachmentFromOrderItemTest extends FunctionalTestCase

public function setUp(): void
{
$this->testExtensionsToLoad[] = 'extcode/cart';
$this->testExtensionsToLoad[] = 'typo3conf/ext/cart/Tests/Fixtures/cart_example';
$this->testExtensionsToLoad = [
'extcode/cart',
'typo3conf/ext/cart/Tests/Fixtures/cart_example',
];

$this->coreExtensionsToLoad = [
'typo3/cms-beuser',
'typo3/cms-core',
];

parent::setUp();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,15 @@ class AttachmentFromTypoScriptTest extends FunctionalTestCase

public function setUp(): void
{
$this->testExtensionsToLoad[] = 'extcode/cart';
$this->testExtensionsToLoad[] = 'typo3conf/ext/cart/Tests/Fixtures/cart_example';
$this->testExtensionsToLoad = [
'extcode/cart',
'typo3conf/ext/cart/Tests/Fixtures/cart_example',
];

$this->coreExtensionsToLoad = [
'typo3/cms-beuser',
'typo3/cms-core',
];

parent::setUp();

Expand Down
13 changes: 10 additions & 3 deletions Tests/Functional/Service/MailHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,15 @@ class MailHandlerTest extends FunctionalTestCase

public function setUp(): void
{
$this->testExtensionsToLoad[] = 'extcode/cart';
$this->testExtensionsToLoad[] = 'typo3conf/ext/cart/Tests/Fixtures/cart_example';
$this->testExtensionsToLoad = [
'extcode/cart',
'typo3conf/ext/cart/Tests/Fixtures/cart_example',
];

$this->coreExtensionsToLoad = [
'typo3/cms-beuser',
'typo3/cms-core',
];

$this->configurationToUseInTestInstance = [
'LOG' => [
Expand Down Expand Up @@ -346,7 +353,7 @@ private function getMockBuilderForMailHandlerClass(bool $mailerThrowException =
$mailer->method('send')->willThrowException(new Exception());
}

$logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__);
$logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(self::class);
$logService = GeneralUtility::makeInstance(
LogService::class,
$logger,
Expand Down
9 changes: 8 additions & 1 deletion Tests/Functional/ViewHelpers/CsvHeaderViewHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@ final class CsvHeaderViewHelperTest extends FunctionalTestCase

public function setUp(): void
{
$this->testExtensionsToLoad[] = 'extcode/cart';
$this->testExtensionsToLoad = [
'extcode/cart',
];

$this->coreExtensionsToLoad = [
'typo3/cms-beuser',
'typo3/cms-core',
];

parent::setUp();
}
Expand Down
9 changes: 8 additions & 1 deletion Tests/Functional/ViewHelpers/CsvValuesViewHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ final class CsvValuesViewHelperTest extends FunctionalTestCase

public function setUp(): void
{
$this->testExtensionsToLoad[] = 'extcode/cart';
$this->testExtensionsToLoad = [
'extcode/cart',
];

$this->coreExtensionsToLoad = [
'typo3/cms-beuser',
'typo3/cms-core',
];

parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/Domain/Model/Cart/CartCouponFixTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ private function createCartMock(array $methods = ['getGross']): Cart|MockObject
);

return $this->getMockBuilder(Cart::class)
->onlyMethods(array_values(array_filter(array_filter($methods, 'is_string'))))
->onlyMethods(array_values(array_filter(array_filter($methods, is_string(...)))))
->setConstructorArgs([[$this->taxClass]])
->getMock();
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/Domain/Model/Cart/CartCouponPercentageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ private function createCartMock(array $methods = ['getGross']): Cart|MockObject
);

return $this->getMockBuilder(Cart::class)
->onlyMethods(array_values(array_filter(array_filter($methods, 'is_string'))))
->onlyMethods(array_values(array_filter(array_filter($methods, is_string(...)))))
->setConstructorArgs([[$this->taxClass]])
->getMock();
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/Domain/Model/Cart/ServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ private function createCartMock(array $methods = ['getGross']): Cart|MockObject
);

return $this->getMockBuilder(Cart::class)
->onlyMethods(array_values(array_filter(array_filter($methods, 'is_string'))))
->onlyMethods(array_values(array_filter(array_filter($methods, is_string(...)))))
->setConstructorArgs([$this->taxClasses])
->getMock();
}
Expand Down
67 changes: 13 additions & 54 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@
"allow-plugins": {
"typo3/class-alias-loader": true,
"typo3/cms-composer-installers": true,
"sbuerk/typo3-cmscomposerinstallers-testingframework-bridge": true,
"phpstan/extension-installer": true
}
},
"lock": false,
"sort-packages": true
},
"version": "12.0.0",
"extra": {
Expand All @@ -53,11 +54,10 @@
"php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
"ext-json": "*",
"ext-openssl": "*",
"typo3/cms-core": "^14.0",
"typo3/cms-extbase": "^14.0",
"typo3/cms-fluid": "^14.0",
"typo3/cms-form": "^14.0",
"typo3/cms-frontend": "^14.0"
"typo3/cms-core": "^14.2",
"typo3/cms-extbase": "^14.2",
"typo3/cms-fluid": "^14.2",
"typo3/cms-frontend": "^14.2"
},
"require-dev": {
"codappix/typo3-php-datasets": "^2.1",
Expand All @@ -68,55 +68,14 @@
"phpstan/phpstan-phpunit": "^2.0",
"spaze/phpstan-disallowed-calls": "^4.7",
"staabm/phpstan-todo-by": "^0.3",
"typo3/cms-beuser": "^14.0",
"typo3/cms-dashboard": "^14.0",
"typo3/cms-form": "^14.0",
"typo3/testing-framework": "^9.0",
"typo3/cms-beuser": "^14.2",
"typo3/cms-dashboard": "^14.2",
"typo3/cms-form": "^14.2",
"typo3/testing-framework": "^9.5",
"ssch/typo3-rector": "^3.11"
},
"scripts": {
"test:cgl": [
".build/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php -v --using-cache=no --path-mode=intersection ./"
],
"test:cgl:dry-run": [
".build/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php -v --dry-run --using-cache=no --path-mode=intersection ./"
],
"test:php:lint": [
"find *.php Classes Configuration Tests -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l"
],
"test:php:unit": [
".build/bin/phpunit -c Build/UnitTests.xml"
],
"test:php:functional": [
"typo3DatabaseDriver=\"pdo_sqlite\" .build/bin/phpunit -c Build/phpunit.xml.dist"
],
"test:phpstan:analyse": [
".build/bin/phpstan analyse -c Build/phpstan.neon --memory-limit 256M"
],
"test:rector:process": [
".build/bin/rector process *"
],
"test:rector:process:dry-run": [
".build/bin/rector process * --dry-run"
],
"test:typoscript:lint": [
".build/bin/typoscript-lint -c Build/typoscriptlint.yaml Configuration"
],
"test:php": [
"@test:php:lint",
"@test:php:unit",
"@test:php:functional"
],
"test:all": [
"@test:phpstan:analyse",
"@test:rector:process",
"@test:cgl",
"@test:typoscript:lint",
"@test:php"
]
},
"suggest": {
"typo3/cms-dashboard": "^14.0",
"typo3/cms-form": "^14.0"
"typo3/cms-dashboard": "^14.2",
"typo3/cms-form": "^14.2"
}
}
22 changes: 0 additions & 22 deletions ext_emconf.php

This file was deleted.

1 change: 0 additions & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
__DIR__ . '/Classes',
__DIR__ . '/Configuration',
__DIR__ . '/Tests',
__DIR__ . '/ext_emconf.php',
__DIR__ . '/ext_localconf.php',
])
// uncomment to reach your current PHP version
Expand Down
Loading