Skip to content

Commit

Permalink
[FEATURE] Add unit tests to runTests.sh, make and github action
Browse files Browse the repository at this point in the history
  • Loading branch information
linawolf committed Jun 3, 2024
1 parent 78372d6 commit 7b981d3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 48 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,7 @@ 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
run: Build/Scripts/runTests.sh -n -p ${{ matrix.php }} -s phpstan

- name: unit
run: Build/Scripts/runTests.sh -n -p ${{ matrix.php }} -s unit
2 changes: 1 addition & 1 deletion Build/Scripts/runTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=$?
;;
Expand Down
45 changes: 0 additions & 45 deletions Build/phpstan/phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 cgl -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 cgl -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
Expand All @@ -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
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 7b981d3

Please sign in to comment.