diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7b3a952..3968a89 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -49,7 +49,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 @@ -74,12 +74,14 @@ jobs: - name: Install dependencies with expected TYPO3 version run: |- 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: vendor/bin/phpstan analyse -c Build/phpstan.neon + - name: Build codeception tester + run: .build/bin/codecept build + - name: Code Quality (by PHPStan) + run: ./.build/bin/phpstan analyse -c Build/phpstan.neon + test-unit-and-functional: runs-on: ubuntu-latest needs: @@ -90,7 +92,7 @@ jobs: - uses: cachix/install-nix-action@v31 with: - nix_path: nixpkgs=channel:nixos-unstable + nix_path: nixpkgs=channel:nixos-26.05 - name: Run Unit Tests PHP8.2 run: nix-shell --arg phpVersion \"php82\" --pure --run project-test-unit diff --git a/.gitignore b/.gitignore index c33c81b..4b416fa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .build composer.lock +var .php-cs-fixer.cache .phplint.cache @@ -10,8 +11,5 @@ Documentation/_make .DS_Store .idea -var/ -vendor/ - phpunit.coverage.xml phpunit.report.xml diff --git a/Build/.php-cs-fixer.dist.php b/Build/.php-cs-fixer.dist.php index 58818f6..f33cf71 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/UnitTests.xml b/Build/UnitTests.xml deleted file mode 100644 index d69a6b6..0000000 --- a/Build/UnitTests.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - ../Tests/Unit/ - - - - - ../Classes/ - - - diff --git a/Build/phpmd-ruleset.xml b/Build/phpmd-ruleset.xml deleted file mode 100644 index b9d2251..0000000 --- a/Build/phpmd-ruleset.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - The rulesets attempting to respect the TYPO3 best practices :) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Build/phpstan-baseline.neon b/Build/phpstan-baseline.neon new file mode 100644 index 0000000..9127bda --- /dev/null +++ b/Build/phpstan-baseline.neon @@ -0,0 +1,199 @@ +parameters: + ignoreErrors: + - + message: '#^Method Extcode\\CartBooks\\Domain\\Model\\Book\:\:getBestSpecialPrice\(\) has parameter \$frontendUserGroupIds with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: ../Classes/Domain/Model/Book.php + + - + message: '#^Method Extcode\\CartBooks\\Domain\\Model\\Book\:\:getSpecialPrices\(\) return type with generic class TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage does not specify its types\: TEntity$#' + identifier: missingType.generics + count: 1 + path: ../Classes/Domain/Model/Book.php + + - + message: '#^Method Extcode\\CartBooks\\Domain\\Model\\Book\:\:setSpecialPrices\(\) has parameter \$specialPrices with generic class TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage but does not specify its types\: TEntity$#' + identifier: missingType.generics + count: 1 + path: ../Classes/Domain/Model/Book.php + + - + message: '#^Binary operation "\+\=" between mixed and int results in an error\.$#' + identifier: assignOp.invalid + count: 1 + path: ../Classes/EventListener/CheckProductAvailability.php + + - + message: '#^Cannot cast mixed to int\.$#' + identifier: cast.int + count: 4 + path: ../Classes/EventListener/RetrieveProductsFromRequest.php + + - + message: '#^Method Extcode\\CartBooks\\EventListener\\RetrieveProductsFromRequest\:\:checkRequestArguments\(\) has parameter \$requestArguments with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: ../Classes/EventListener/RetrieveProductsFromRequest.php + + - + message: '#^Method Extcode\\CartBooks\\EventListener\\RetrieveProductsFromRequest\:\:checkRequestArguments\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: ../Classes/EventListener/RetrieveProductsFromRequest.php + + - + message: '#^Method Extcode\\CartBooks\\EventListener\\RetrieveProductsFromRequest\:\:getCartProductFromBook\(\) has parameter \$taxClasses with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: ../Classes/EventListener/RetrieveProductsFromRequest.php + + - + message: '#^Parameter \#1 \$book of method Extcode\\CartBooks\\EventListener\\RetrieveProductsFromRequest\:\:getCartProductFromBook\(\) expects Extcode\\CartBooks\\Domain\\Model\\Book, TYPO3\\CMS\\Extbase\\DomainObject\\DomainObjectInterface\|null given\.$#' + identifier: argument.type + count: 1 + path: ../Classes/EventListener/RetrieveProductsFromRequest.php + + - + message: '#^Parameter \#2 \$productId of class Extcode\\Cart\\Domain\\Model\\Cart\\Product constructor expects int, int\<1, max\>\|null given\.$#' + identifier: argument.type + count: 1 + path: ../Classes/EventListener/RetrieveProductsFromRequest.php + + - + message: '#^Parameter \#6 \$taxClass of class Extcode\\Cart\\Domain\\Model\\Cart\\Product constructor expects Extcode\\Cart\\Domain\\Model\\Cart\\TaxClass, mixed given\.$#' + identifier: argument.type + count: 1 + path: ../Classes/EventListener/RetrieveProductsFromRequest.php + + - + message: '#^Cannot access offset ''cart'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 2 + path: ../Classes/EventListener/View/ModifyView.php + + - + message: '#^Cannot access offset ''pid'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 2 + path: ../Classes/EventListener/View/ModifyView.php + + - + message: '#^Parameter \#1 \$key of method Extcode\\Cart\\Service\\SessionHandler\:\:restoreCart\(\) expects string, mixed given\.$#' + identifier: argument.type + count: 1 + path: ../Classes/EventListener/View/ModifyView.php + + - + message: '#^Parameter \#1 \$key of method Extcode\\Cart\\Service\\SessionHandler\:\:writeCart\(\) expects string, mixed given\.$#' + identifier: argument.type + count: 1 + path: ../Classes/EventListener/View/ModifyView.php + + - + message: '#^Property Extcode\\CartBooks\\EventListener\\View\\ModifyView\:\:\$cartConfiguration type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: ../Classes/EventListener/View/ModifyView.php + + - + message: '#^Cannot call method getAuthor\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: ../Classes/ViewHelpers/SchemaViewHelper.php + + - + message: '#^Cannot call method getPrice\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: ../Classes/ViewHelpers/SchemaViewHelper.php + + - + message: '#^Cannot call method getTitle\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: ../Classes/ViewHelpers/SchemaViewHelper.php + + - + message: '#^Method Extcode\\CartBooks\\ViewHelpers\\SchemaViewHelper\:\:render\(\) should return string but returns string\|false\.$#' + identifier: return.type + count: 1 + path: ../Classes/ViewHelpers/SchemaViewHelper.php + + - + message: '#^Cannot access an offset on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: ../Configuration/TCA/Overrides/tx_cart_domain_model_order_product.php + + - + message: '#^Cannot access offset ''columns'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: ../Configuration/TCA/Overrides/tx_cart_domain_model_order_product.php + + - + message: '#^Cannot access offset ''config'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: ../Configuration/TCA/Overrides/tx_cart_domain_model_order_product.php + + - + message: '#^Cannot access offset ''items'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: ../Configuration/TCA/Overrides/tx_cart_domain_model_order_product.php + + - + message: '#^Cannot access offset ''product_type'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: ../Configuration/TCA/Overrides/tx_cart_domain_model_order_product.php + + - + message: '#^Cannot access offset ''tx_cart_domain_model_order_product'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: ../Configuration/TCA/Overrides/tx_cart_domain_model_order_product.php + + - + message: '#^Parameter \#1 \$dataSet of method Codappix\\Typo3PhpDatasets\\PhpDataSet\:\:import\(\) expects array\\>\>, mixed given\.$#' + identifier: argument.type + count: 1 + path: ../Tests/Acceptance/Support/Environment.php + + - + message: '#^Property Extcode\\CartBooks\\Tests\\Acceptance\\Support\\Environment\:\:\$localConfig type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: ../Tests/Acceptance/Support/Environment.php + + - + message: '#^Cannot access an offset on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: ../ext_localconf.php + + - + message: '#^Cannot access offset ''SYS'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: ../ext_localconf.php + + - + message: '#^Cannot access offset ''cartbooks'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: ../ext_localconf.php + + - + message: '#^Cannot access offset ''fluid'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: ../ext_localconf.php + + - + message: '#^Cannot access offset ''namespaces'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: ../ext_localconf.php diff --git a/Build/phpstan.neon b/Build/phpstan.neon index c166ea3..1d47392 100644 --- a/Build/phpstan.neon +++ b/Build/phpstan.neon @@ -1,10 +1,37 @@ +includes: + - 'phpstan-baseline.neon' + parameters: - level: 4 + level: 'max' + paths: - ../Classes - ../Configuration - ../Tests - - ../ext_emconf.php - ../ext_localconf.php excludePaths: - - ../Tests/Acceptance + - '../Tests/Acceptance/Support/_generated/TesterActions.php' + + disallowedFunctionCalls: + - + function: + - 'var_dump()' + - 'xdebug_break()' + message: 'Do not add debugging' + - + function: 'header()' + message: 'Use API instead' + + disallowedStaticCalls: + - + method: 'TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump()' + message: 'Do not add debugging' + + disallowedSuperglobals: + - + superglobal: + - '$_GET' + - '$_POST' + - '$_FILES' + - '$_SERVER' + message: 'Use API instead' diff --git a/Build/FunctionalTests.xml b/Build/phpunit.xml.dist similarity index 55% rename from Build/FunctionalTests.xml rename to Build/phpunit.xml.dist index 888811b..a9a5a58 100644 --- a/Build/FunctionalTests.xml +++ b/Build/phpunit.xml.dist @@ -3,7 +3,7 @@ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd" backupGlobals="true" beStrictAboutTestsThatDoNotTestAnything="false" - bootstrap="../vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php" + bootstrap="../.build/vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php" cacheResult="false" colors="true" failOnDeprecation="true" @@ -16,15 +16,18 @@ stopOnIncomplete="false" stopOnSkipped="false" > - - - - ../Tests/Functional/ - - - - - ../Classes/ - - + + + + ../Tests/Functional/ + + + ../Tests/Unit/ + + + + + ../Classes/ + + diff --git a/Classes/Domain/Model/Book.php b/Classes/Domain/Model/Book.php index 152b6aa..39110d7 100644 --- a/Classes/Domain/Model/Book.php +++ b/Classes/Domain/Model/Book.php @@ -83,7 +83,9 @@ public function getBestSpecialPrice(array $frontendUserGroupIds = []): float $bestSpecialPrice = $this->price; foreach ($this->getSpecialPrices() as $specialPrice) { - if ($specialPrice->getPrice() < $bestSpecialPrice) { + if ($specialPrice instanceof SpecialPrice + && $specialPrice->getPrice() < $bestSpecialPrice + ) { if (!$specialPrice->getFrontendUserGroup() || in_array($specialPrice->getFrontendUserGroup()->getUid(), $frontendUserGroupIds) ) { diff --git a/Configuration/TCA/tx_cartbooks_domain_model_specialprice.php b/Configuration/TCA/tx_cartbooks_domain_model_specialprice.php index 21075d5..233ed95 100644 --- a/Configuration/TCA/tx_cartbooks_domain_model_specialprice.php +++ b/Configuration/TCA/tx_cartbooks_domain_model_specialprice.php @@ -35,7 +35,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_books/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_books/Resources/Private/Language/locallang_tca.xlf:palettes.visibility;hiddenonly,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.access;access', ], ], 'palettes' => [ @@ -46,7 +46,7 @@ 'showitem' => 'hidden;' . $_LLL . ':tx_cartbooks_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 0000000..98d1c31 --- /dev/null +++ b/Documentation/Changelog/7.0/Index.rst @@ -0,0 +1,10 @@ +.. 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 0036933..a5b692b 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/guides.xml b/Documentation/guides.xml index fd791ce..18806a6 100644 --- a/Documentation/guides.xml +++ b/Documentation/guides.xml @@ -11,8 +11,8 @@ interlink-shortcode="extcode/cart_books" /> diff --git a/README.md b/README.md index 62e8578..fe0a521 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,10 @@ Sometimes minor versions also result in minor adjustments to own templates or co | Cart Books | TYPO3 | PHP | Support/Development | |------------|------------|-----------|--------------------------------------| -| 6.x.x | 13.0 | 8.2 - 8.4 | Features, Bugfixes, Security Updates | -| 5.x.x | 12.0 | 8.1 - 8.4 | Bugfixes, Security Updates | -| 4.x.x | 10.4, 11.5 | 7.2+ | Security Updates | +| 7.x.x | 14.3 | 8.2 - 8.4 | Features, Bugfixes, Security Updates | +| 6.x.x | 13.4 | 8.2 - 8.4 | Bugfixes, Security Updates | +| 5.x.x | 12.0 | 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 | | @@ -63,4 +64,4 @@ News uses **semantic versioning** which basically means for you, that * [PayPal.Me](https://paypal.me/extcart) [1]: https://docs.typo3.org/typo3cms/extensions/cart_books/ -[2]: https://getcomposer.org/ \ No newline at end of file +[2]: https://getcomposer.org/ diff --git a/Tests/Acceptance/Support/Environment.php b/Tests/Acceptance/Support/Environment.php index f7c9a0e..7993074 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 2290a7e..ad8ef69 100644 --- a/Tests/Acceptance/Support/Tester.php +++ b/Tests/Acceptance/Support/Tester.php @@ -13,7 +13,6 @@ use Codeception\Actor; use Extcode\CartBooks\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/Tests/Unit/Domain/Model/BookTest.php b/Tests/Unit/Domain/Model/BookTest.php index 9a56cdc..bdb5bea 100644 --- a/Tests/Unit/Domain/Model/BookTest.php +++ b/Tests/Unit/Domain/Model/BookTest.php @@ -16,12 +16,9 @@ class BookTest extends UnitTestCase protected function setUp(): void { - $this->book = new Book(); - } + parent::setUp(); - protected function tearDown(): void - { - unset($this->book); + $this->book = new Book(); } #[Test] @@ -84,7 +81,7 @@ public function getTaxClassIdReturnsValueForTaxClassId(): void ); } - private function setProperty(object $instance, string $propertyName, mixed $propertyValue) + private function setProperty(object $instance, string $propertyName, mixed $propertyValue): void { $reflection = new \ReflectionProperty($instance, $propertyName); $reflection->setValue($instance, $propertyValue); diff --git a/codeception.dist.yml b/codeception.dist.yml index 33354b7..6aaa80d 100644 --- a/codeception.dist.yml +++ b/codeception.dist.yml @@ -3,7 +3,7 @@ namespace: 'Extcode\CartBooks\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 e1920e1..c2b8e25 100644 --- a/composer.json +++ b/composer.json @@ -1,69 +1,80 @@ { - "name": "extcode/cart-books", - "type": "typo3-cms-extension", - "description": "Shopping Cart(s) for TYPO3 - Book Extension", - "homepage": "https://cart.extco.de", - "license": [ - "GPL-2.0-or-later" - ], - "keywords": [ - "TYPO3 CMS", - "Shopping Cart", - "cart", - "books" - ], - "authors": [ - { - "name": "Daniel Gohlke", - "email": "ext@extco.de", - "role": "Developer" - } - ], - "support": { - "issues": "https://github.com/extcode/cart_books/issues" - }, - "autoload": { - "psr-4": { - "Extcode\\CartBooks\\": "Classes/" - } - }, - "autoload-dev": { - "psr-4": { - "Extcode\\CartBooks\\Tests\\": "Tests/" - } - }, - "config": { - "allow-plugins": { - "typo3/cms-composer-installers": true, - "typo3/class-alias-loader": true - } - }, - "extra": { - "typo3/cms": { - "extension-key": "cart_books", - "web-dir": ".build/web" - } - }, - "require": { - "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0", - "ext-json": "*", - "ext-pdo": "*", - "extcode/cart": "^11.0", - "extcode/books": "^1.0", - "typo3/cms-core": "^13.4", - "typo3/cms-extbase": "^13.4", - "typo3/cms-fluid": "^13.4" + "name": "extcode/cart-books", + "type": "typo3-cms-extension", + "description": "Shopping Cart(s) for TYPO3 - Book Extension", + "homepage": "https://cart.extco.de", + "license": [ + "GPL-2.0-or-later" + ], + "keywords": [ + "TYPO3 CMS", + "Shopping Cart", + "cart", + "books" + ], + "authors": [ + { + "name": "Daniel Gohlke", + "email": "ext@extco.de", + "role": "Developer" + } + ], + "support": { + "issues": "https://github.com/extcode/cart_books/issues" + }, + "autoload": { + "psr-4": { + "Extcode\\CartBooks\\": "Classes/" + } + }, + "autoload-dev": { + "psr-4": { + "Extcode\\CartBooks\\Tests\\": "Tests/" + } + }, + "config": { + "bin-dir": ".build/bin", + "vendor-dir": ".build/vendor", + "allow-plugins": { + "typo3/cms-composer-installers": true, + "typo3/class-alias-loader": true, + "phpstan/extension-installer": true }, - "require-dev": { - "codappix/typo3-php-datasets": "^2.1", - "codeception/codeception": "^5.0", - "codeception/module-db": "^3.1", - "codeception/module-webdriver": "^4.0", - "friendsofphp/php-cs-fixer": "^3.16", - "helmich/typo3-typoscript-lint": "^3.1", - "phpstan/phpstan": "^1.10", - "typo3/cms-fluid-styled-content": "^13.4", - "typo3/cms-install": "^13.4", - "typo3/testing-framework": "^8.2" + "lock": false, + "sort-packages": true + }, + "extra": { + "typo3/cms": { + "extension-key": "cart_books", + "web-dir": ".build/public" } + }, + "require": { + "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0", + "ext-json": "*", + "ext-pdo": "*", + "extcode/cart": "^12.0", + "extcode/books": "^2.0", + "typo3/cms-core": "^14.3", + "typo3/cms-extbase": "^14.3", + "typo3/cms-fluid": "^14.3" + }, + "require-dev": { + "codappix/typo3-php-datasets": "^2.1", + "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", + "phpstan/phpstan": "^2.1", + "phpstan/phpstan-deprecation-rules": "^2.0", + "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", + "ssch/typo3-rector": "^3.11" + } } diff --git a/ext_emconf.php b/ext_emconf.php deleted file mode 100644 index 840fb17..0000000 --- a/ext_emconf.php +++ /dev/null @@ -1,21 +0,0 @@ - 'Cart - Books', - 'description' => 'Shopping Cart(s) for TYPO3 - Book Extension', - 'category' => 'plugin', - 'version' => '6.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.0.0', - 'books' => '1.0.0', - ], - 'conflicts' => [], - 'suggests' => [], - ], -]; diff --git a/rector.php b/rector.php index 99f969c..60ec024 100644 --- a/rector.php +++ b/rector.php @@ -7,7 +7,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\CodeQuality\General\InjectMethodToConstructorInjectionRector; use Ssch\TYPO3Rector\Configuration\Typo3Option; @@ -29,7 +28,7 @@ ->withSets([ Typo3SetList::CODE_QUALITY, Typo3SetList::GENERAL, - Typo3LevelSetList::UP_TO_TYPO3_12, + Typo3LevelSetList::UP_TO_TYPO3_14, ]) // To have a better analysis from PHPStan, we teach it here some more things ->withPHPStanConfigs([ @@ -37,7 +36,6 @@ ]) ->withRules([ AddVoidReturnTypeWhereNoReturnRector::class, - ConvertImplicitVariablesToExplicitGlobalsRector::class, ]) ->withConfiguredRule(ExtEmConfRector::class, [ ExtEmConfRector::PHP_VERSION_CONSTRAINT => '8.2.0-8.3.99', diff --git a/shell.nix b/shell.nix index 2e57aca..142a54f 100644 --- a/shell.nix +++ b/shell.nix @@ -23,7 +23,8 @@ let composer ]; text = '' - composer update --prefer-dist --no-progress + rm -rf .build/ composer.lock + composer update --prefer-dist --no-progress --working-dir="$PROJECT_ROOT" ''; }; @@ -35,7 +36,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 ''; }; @@ -47,12 +48,12 @@ 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 ''; }; - projectLintPhp = pkgs.writeShellApplication { - name = "project-lint-php"; + projectLint = pkgs.writeShellApplication { + name = "project-lint"; runtimeInputs = [ php @@ -63,51 +64,51 @@ let ''; }; - projectLintTypoScript = pkgs.writeShellApplication { - name = "project-lint-typoscript"; + projectPhpstan = pkgs.writeShellApplication { + name = "project-phpstan"; runtimeInputs = [ php ]; text = '' - ./vendor/bin/typoscript-lint -c Build/typoscriptlint.yaml Configuration + ./.build/bin/phpstan analyse -c Build/phpstan.neon --memory-limit 256M ''; }; - projectPhpstan = pkgs.writeShellApplication { - name = "project-phpstan"; - + projectTestUnit = pkgs.writeShellApplication { + name = "project-test-unit"; runtimeInputs = [ php + projectInstall ]; - text = '' - ./vendor/bin/phpstan analyse -c Build/phpstan.neon --memory-limit 256M + project-install + ./.build/bin/phpunit -c Build/phpunit.xml.dist --testsuite unit --display-warnings --display-deprecations --display-errors ''; }; - projectTestUnit = pkgs.writeShellApplication { - name = "project-test-unit"; + projectTestFunctional = pkgs.writeShellApplication { + name = "project-test-functional"; runtimeInputs = [ php projectInstall ]; text = '' project-install - vendor/bin/phpunit -c Build/UnitTests.xml + ./.build/bin/phpunit -c Build/phpunit.xml.dist --testsuite functional --display-warnings --display-deprecations --display-errors ''; }; - projectTestFunctional = pkgs.writeShellApplication { - name = "project-test-functional"; + projectTestWithCoverage = pkgs.writeShellApplication { + name = "project-test-with-coverage"; runtimeInputs = [ php projectInstall ]; text = '' project-install - vendor/bin/phpunit -c Build/FunctionalTests.xml + XDEBUG_MODE=coverage ./.build/bin/phpunit -c Build/phpunit.xml.dist --coverage-html=coverage_result ''; }; @@ -124,36 +125,36 @@ 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" - ./vendor/bin/codecept run + ./.build/bin/codecept run pgrep -f "php -S" | xargs -r kill pgrep -f "geckodriver" | xargs -r kill ''; }; -in pkgs.mkShell { - name = "TYPO3 Extension cart-books"; +in pkgs.mkShellNoCC { + name = "TYPO3 Extension extcode/cart-books"; buildInputs = [ + pkgs.cacert php composer projectInstall - projectPhpstan projectCgl projectCglFix - projectLintPhp - projectLintTypoScript + projectLint + projectPhpstan projectTestUnit projectTestFunctional + projectTestWithCoverage projectTestAcceptance ]; - packages = [ pkgs.gnumake pkgs.busybox ]; shellHook = '' export PROJECT_ROOT="$(pwd)"