Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Send code coverage to SonarCloud
Antonio Spinelli551c1f4cda77
diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.ymlindex a1a34fa24f..e9ba1b9b27 100644--- a/.github/workflows/sonarcloud.yml+++ b/.github/workflows/sonarcloud.yml@@ -1,5 +1,6 @@name: Sonarcloudon:+ pull_request:push:branches:- main@@ -12,6 +13,33 @@ jobs:- uses: actions/checkout@v3with:fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis++ - name: Checkout+ uses: actions/checkout@v2+ with:+ fetch-depth: 0++ - name: Setup PHP with Xdebug+ uses: shivammathur/setup-php@v2+ with:+ php-version: '8.2'+ coverage: xdebug++ - name: Install Composer dependencies+ run: composer install --prefer-dist --no-interaction --no-progress --no-scripts++ - name: Copy environment file+ run: cp .env.example .env++ - name: Generate app key+ run: php artisan key:generate++ - name: "Run tests with coverage"+ run: composer coverage++ - name: Fix code coverage paths+ run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml+- name: SonarCloud Scanuses: SonarSource/sonarcloud-github-action@masterenv:diff --git a/.gitignore b/.gitignoreindex 220b48d300..ab681f4f44 100644--- a/.gitignore+++ b/.gitignore@@ -7,4 +7,4 @@ npm-debug.logyarn-error.log.env/.ci/php-cs-fixer/vendor-/.ci/coverage+coverage.xmldiff --git a/composer.json b/composer.jsonindex 0b8810c515..1c6c62f1ba 100644--- a/composer.json+++ b/composer.json@@ -170,10 +170,13 @@"@php artisan firefly-iii:verify-security-alerts"],"unit-test": [- "@php vendor/bin/phpunit -c phpunit.xml --testsuite unit"+ "@php vendor/bin/phpunit -c phpunit.xml --testsuite unit --no-coverage"],"integration-test": [- "@php vendor/bin/phpunit -c phpunit.xml --testsuite integration"+ "@php vendor/bin/phpunit -c phpunit.xml --testsuite integration --no-coverage"+ ],+ "coverage": [+ "@php vendor/bin/phpunit -c phpunit.xml --testsuite unit"]},"config": {diff --git a/phpunit.xml b/phpunit.xmlindex 575dac224f..aa51a02e21 100644--- a/phpunit.xml+++ b/phpunit.xml@@ -18,25 +18,46 @@~ You should have received a copy of the GNU Affero General Public License~ along with this program. If not, see <https://www.gnu.org/licenses/>.-->-<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" stopOnFailure="true" processIsolation="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">- <coverage/>- <testsuites>- <testsuite name="unit">- <directory suffix="Test.php">./tests/unit</directory>- </testsuite>- <testsuite name="integration">- <directory suffix="Test.php">./tests/integration</directory>- </testsuite>- </testsuites>- <php>- <env name="APP_ENV" value="testing"/>- <env name="CACHE_DRIVER" value="array"/>- <env name="SESSION_DRIVER" value="array"/>- <env name="QUEUE_DRIVER" value="sync"/>- </php>- <source>- <include>- <directory suffix=".php">./app</directory>- </include>- </source>+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"+ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd"+ backupGlobals="false"+ backupStaticProperties="false"+ beStrictAboutOutputDuringTests="true"+ bootstrap="vendor/autoload.php"+ cacheDirectory=".phpunit.cache"+ colors="true"+ executionOrder="depends,defects"+ failOnRisky="true"+ failOnWarning="true"+ processIsolation="false"+ stopOnFailure="true">+ <php>+ <env name="APP_ENV" value="testing"/>+ <env name="CACHE_DRIVER" value="array"/>+ <env name="SESSION_DRIVER" value="array"/>+ <env name="QUEUE_DRIVER" value="sync"/>+ <ini name="xdebug.mode" value="coverage"/>+ </php>+ <testsuites>+ <testsuite name="all">+ <directory suffix="Test.php">./tests</directory>+ </testsuite>+ <testsuite name="unit">+ <directory suffix="Test.php">./tests/unit</directory>+ </testsuite>+ <testsuite name="integration">+ <directory suffix="Test.php">./tests/integration</directory>+ </testsuite>+ </testsuites>+ <source>+ <include>+ <directory suffix=".php">app</directory>+ </include>+ </source>+ <coverage ignoreDeprecatedCodeUnits="true"+ pathCoverage="true">+ <report>+ <clover outputFile="coverage.xml"/>+ </report>+ </coverage></phpunit>diff --git a/sonar-project.properties b/sonar-project.propertiesindex 72777406a0..30a426dd31 100644--- a/sonar-project.properties+++ b/sonar-project.properties@@ -15,3 +15,4 @@ sonar.organization=firefly-iiisonar.projectVersion=6.0.11sonar.sources=app,bootstrap,database,resources/assets,resources/views,routes,testssonar.sourceEncoding=UTF-8+sonar.php.coverage.reportPaths=coverage.xmldiff --git a/tests/integration/CreatesApplication.php b/tests/integration/CreatesApplication.phpindex 1900ee8eb1..6dbc977700 100644--- a/tests/integration/CreatesApplication.php+++ b/tests/integration/CreatesApplication.php@@ -38,7 +38,7 @@ trait CreatesApplication*/public function createApplication(){- $app = require __DIR__ . '/../bootstrap/app.php';+ $app = require_once __DIR__ . '/../../bootstrap/app.php';$app->make(Kernel::class)->bootstrap();