diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4ad8159..ea2a8af 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,6 +27,27 @@ jobs: - name: Lint PHP run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s lint + unit: + name: Unit + runs-on: ubuntu-latest + strategy: + matrix: + php: + - '7.4' + - '8.0' + - '8.1' + - '8.2' + - '8.3' + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install testing system + run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s composerUpdate + + - name: unit + run: Build/Scripts/runTests.sh -n -p ${{ matrix.php }} -s unit + code-quality: name: Code quality runs-on: ubuntu-latest @@ -51,4 +72,4 @@ jobs: run: Build/Scripts/runTests.sh -n -p ${{ matrix.php }} -s cgl - name: phpstan - run: Build/Scripts/runTests.sh -n -p ${{ matrix.php }} -s phpstan \ No newline at end of file + run: Build/Scripts/runTests.sh -n -p ${{ matrix.php }} -s phpstan diff --git a/Build/Scripts/runTests.sh b/Build/Scripts/runTests.sh index 2ba1d6f..74438c3 100755 --- a/Build/Scripts/runTests.sh +++ b/Build/Scripts/runTests.sh @@ -546,7 +546,7 @@ case ${TEST_SUITE} in SUITE_EXIT_CODE=$? ;; unit) - COMMAND=(.Build/bin/phpunit -c Build/phpunit/UnitTests.xml ${EXTRA_TEST_OPTIONS} "$@") + COMMAND=(.Build/bin/phpunit -c .Build/vendor/nimut/testing-framework/res/Configuration/UnitTests.xml Tests/Unit ${EXTRA_TEST_OPTIONS} "$@") ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name unit-${SUFFIX} ${XDEBUG_MODE} -e XDEBUG_CONFIG="${XDEBUG_CONFIG}" ${IMAGE_PHP} "${COMMAND[@]}" SUITE_EXIT_CODE=$? ;; diff --git a/Build/phpstan/phpstan-baseline.neon b/Build/phpstan/phpstan-baseline.neon index e2cdd98..66c6abb 100644 --- a/Build/phpstan/phpstan-baseline.neon +++ b/Build/phpstan/phpstan-baseline.neon @@ -1,50 +1,5 @@ parameters: ignoreErrors: - - - message: "#^Call to static method getRecord\\(\\) on an unknown class TYPO3\\\\CMS\\\\Backend\\\\Utility\\\\BackendUtility\\.$#" - count: 1 - path: ../../Classes/Controller/DataModuleController.php - - - - message: "#^Parameter \\$moduleTemplateFactory of method Cobweb\\\\ExternalImport\\\\Controller\\\\DataModuleController\\:\\:__construct\\(\\) has invalid type TYPO3\\\\CMS\\\\Backend\\\\Template\\\\ModuleTemplateFactory\\.$#" - count: 1 - path: ../../Classes/Controller/DataModuleController.php - - - - message: "#^Property Cobweb\\\\ExternalImport\\\\Controller\\\\DataModuleController\\:\\:\\$moduleTemplate has unknown class TYPO3\\\\CMS\\\\Backend\\\\Template\\\\ModuleTemplate as its type\\.$#" - count: 1 - path: ../../Classes/Controller/DataModuleController.php - - - - message: "#^Property Cobweb\\\\ExternalImport\\\\Controller\\\\DataModuleController\\:\\:\\$moduleTemplateFactory has unknown class TYPO3\\\\CMS\\\\Backend\\\\Template\\\\ModuleTemplateFactory as its type\\.$#" - count: 1 - path: ../../Classes/Controller/DataModuleController.php - - - - message: "#^Parameter \\$moduleTemplateFactory of method Cobweb\\\\ExternalImport\\\\Controller\\\\LogModuleController\\:\\:__construct\\(\\) has invalid type TYPO3\\\\CMS\\\\Backend\\\\Template\\\\ModuleTemplateFactory\\.$#" - count: 1 - path: ../../Classes/Controller/LogModuleController.php - - - - message: "#^Property Cobweb\\\\ExternalImport\\\\Controller\\\\LogModuleController\\:\\:\\$moduleTemplate has unknown class TYPO3\\\\CMS\\\\Backend\\\\Template\\\\ModuleTemplate as its type\\.$#" - count: 1 - path: ../../Classes/Controller/LogModuleController.php - - - - message: "#^Property Cobweb\\\\ExternalImport\\\\Controller\\\\LogModuleController\\:\\:\\$moduleTemplateFactory has unknown class TYPO3\\\\CMS\\\\Backend\\\\Template\\\\ModuleTemplateFactory as its type\\.$#" - count: 1 - path: ../../Classes/Controller/LogModuleController.php - - - - message: "#^Attribute class TYPO3\\\\CMS\\\\Core\\\\Attribute\\\\WebhookMessage does not exist\\.$#" - count: 1 - path: ../../Classes/Message/AfterImportMessage.php - - - - message: "#^Parameter \\$reaction of method Cobweb\\\\ExternalImport\\\\Reaction\\\\ImportReaction\\:\\:react\\(\\) has invalid type TYPO3\\\\CMS\\\\Reactions\\\\Model\\\\ReactionInstruction\\.$#" - count: 1 - path: ../../Classes/Reaction/ImportReaction.php - - message: "#^Variable \\$tceDeleteCommands on left side of \\?\\? always exists and is not nullable\\.$#" count: 1 diff --git a/Makefile b/Makefile index ded0fa6..dcb78db 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,17 @@ fix: fix-cgl## Run all fixes test-cgl: ## Fix PHP coding styles Build/Scripts/runTests.sh -s cgl +.PHONY: test-unit-7-4 +test-unit-7-4: ## Run unit tests with PHP 7.4 (lowest) + Build/Scripts/runTests.sh -s unit -p 7.4 + +.PHONY: test-unit-8-3 +test-unit-8-3: ## Run unit tests with PHP 8.3 (highest supported by TYPO3 11) + Build/Scripts/runTests.sh -s unit -p 8.3 + +.PHONY: test-unit +test-unit: test-unit-7-4 test-unit-8-3## Run unit tests with PHP 7.4 and 8.3 + .PHONY: phpstan phpstan: ## Run phpstan tests Build/Scripts/runTests.sh -s phpstan @@ -39,4 +50,4 @@ phpstan-baseline: ## Update the phpstan baseline Build/Scripts/runTests.sh -s phpstanBaseline .PHONY: test -test: test-cgl phpstan test-docs## Run all tests +test: test-cgl phpstan test-docs test-unit## Run all tests diff --git a/composer.json b/composer.json index d8a3286..4e0ee78 100644 --- a/composer.json +++ b/composer.json @@ -31,8 +31,11 @@ "cobweb/svconnector": "^5.0" }, "require-dev": { + "cobweb/svconnector_csv": "^4.1", + "cobweb/svconnector_feed": "^4.1", "ergebnis/composer-normalize": "~2.42.0", "friendsofphp/php-cs-fixer": "^3.52", + "nimut/testing-framework": "^6.0", "phpstan/phpstan": "^1.10" }, "suggest": {