Skip to content

Commit

Permalink
[TASK] Simplify phpunit invocations
Browse files Browse the repository at this point in the history
This change adds more information to the phpunit
xml files so the calls to phpunit can be simplified.

Relates: #3376
  • Loading branch information
bmack committed Jun 2, 2023
1 parent ae3aef1 commit 245e0db
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 23 deletions.
1 change: 1 addition & 0 deletions Build/Test/IntegrationTests.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="false"
bootstrap="IntegrationTestsBootstrap.php"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
Expand Down
1 change: 1 addition & 0 deletions Build/Test/UnitTests.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="false"
bootstrap="UnitTestsBootstrap.php"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
Expand Down
32 changes: 11 additions & 21 deletions Build/Test/cibuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,18 @@ else
echo "No syntax errors! Great job!"
fi

echo "Check compliance against TYPO3 Coding Standards"
if ! .Build/bin/php-cs-fixer --version > /dev/null 2>&1

echo "TYPO3 Coding Standards compliance: See https://github.com/TYPO3/coding-standards"
if ! composer t3:standards:fix -- --diff --verbose --dry-run && rm .php-cs-fixer.cache
then
echo "TYPO3 https://github.com/TYPO3/coding-standards is not set properly."
echo "Please fix that asap to avoid unwanted changes in the future."
EXIT_CODE=2
echo "Some files are not compliant to TYPO3 Coding Standards"
echo "Please fix the files listed above."
echo "Tip for auto fix: "
echo " TYPO3_VERSION="${TYPO3_VERSION}" composer tests:setup && composer t3:standards:fix"
EXIT_CODE=3
#exit 1
else
echo "TYPO3 Coding Standards compliance: See https://github.com/TYPO3/coding-standards"
if ! composer t3:standards:fix -- --diff --verbose --dry-run && rm .php-cs-fixer.cache
then
echo "Some files are not compliant to TYPO3 Coding Standards"
echo "Please fix the files listed above."
echo "Tip for auto fix: "
echo " TYPO3_VERSION="${TYPO3_VERSION}" composer tests:setup && composer t3:standards:fix"
EXIT_CODE=3
#exit 1
else
echo "The code is TYPO3 Coding Standards compliant! Great job!"
fi
echo "The code is TYPO3 Coding Standards compliant! Great job!"
fi
echo -e "\n\n"

Expand Down Expand Up @@ -83,8 +75,7 @@ fi

echo -e "\n\n"
echo "Run unit tests"
UNIT_BOOTSTRAP="Build/Test/UnitTestsBootstrap.php"
if ! .Build/bin/phpunit --colors -c Build/Test/UnitTests.xml --bootstrap=$UNIT_BOOTSTRAP --coverage-clover=coverage.unit.clover
if ! composer tests:unit -- --coverage-clover=coverage.unit.clover
then
echo "Error during running the unit tests please check and fix them"
EXIT_CODE=5
Expand Down Expand Up @@ -125,8 +116,7 @@ fi

echo -e "\n\n"
echo "Run integration tests"
INTEGRATION_BOOTSTRAP="Build/Test/IntegrationTestsBootstrap.php"
if ! .Build/bin/phpunit --colors -c Build/Test/IntegrationTests.xml --bootstrap=$INTEGRATION_BOOTSTRAP --coverage-clover=coverage.integration.clover
if ! composer tests:integration -- --coverage-clover=coverage.integration.clover
then
echo "Error during running the integration tests please check and fix them"
EXIT_CODE=6
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@
"@tests:restore-git"
],
"tests:unit": [
"phpunit --colors --config=Build/Test/UnitTests.xml --bootstrap=Build/Test/UnitTestsBootstrap.php"
"phpunit --config=Build/Test/UnitTests.xml"
],
"tests:integration": [
"Composer\\Config::disableProcessTimeout",
"phpunit --colors --config=Build/Test/IntegrationTests.xml --bootstrap=Build/Test/IntegrationTestsBootstrap.php"
"phpunit --config=Build/Test/IntegrationTests.xml"
],
"tests:phpstan": [
"phpstan analyze -c Build/Test/phpstan.neon"
Expand Down

0 comments on commit 245e0db

Please sign in to comment.