Skip to content

Commit

Permalink
Enhancement: Collect coverage from all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Mar 31, 2020
1 parent 2296926 commit f4545b6
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 79 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ on: # yamllint disable-line rule:truthy
- "master"

env:
MIN_COVERED_MSI: 95
MIN_MSI: 91
MIN_COVERED_MSI: 98
MIN_MSI: 96
REQUIRED_PHP_EXTENSIONS: "mbstring"

jobs:
Expand Down Expand Up @@ -268,13 +268,13 @@ jobs:
run: "vendor/bin/doctrine orm:validate-schema --skip-sync"

- name: "Run auto-review tests with phpunit/phpunit"
run: "vendor/bin/phpunit --configuration=test/AutoReview/phpunit.xml"
run: "vendor/bin/phpunit --configuration=test/phpunit.xml --coverage-text --testsuite=auto-review"

- name: "Run unit tests with phpunit/phpunit"
run: "vendor/bin/phpunit --configuration=test/Unit/phpunit.xml"
run: "vendor/bin/phpunit --configuration=test/phpunit.xml --coverage-text --testsuite=unit"

- name: "Run integration tests with phpunit/phpunit"
run: "vendor/bin/phpunit --configuration=test/Integration/phpunit.xml"
run: "vendor/bin/phpunit --configuration=test/phpunit.xml --coverage-text --testsuite=integration"

code-coverage:
name: "Code Coverage"
Expand Down Expand Up @@ -324,7 +324,7 @@ jobs:
run: "composer update --no-interaction --no-progress --no-suggest"

- name: "Collect code coverage with pcov and phpunit/phpunit"
run: "vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-clover=.build/logs/clover.xml"
run: "vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-clover=.build/logs/clover.xml --testsuite=unit,integration"

- name: "Send code coverage report to Codecov.io"
env:
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
MIN_COVERED_MSI:=95
MIN_MSI:=91
MIN_COVERED_MSI:=98
MIN_MSI:=96

.PHONY: it
it: coding-standards static-code-analysis tests ## Runs the coding-standards, static-code-analysis, and tests targets

.PHONY: code-coverage
code-coverage: vendor ## Collects coverage from running unit tests with phpunit/phpunit
mkdir -p .build/phpunit
vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-text
vendor/bin/phpunit --configuration=test/phpunit.xml --coverage-text --testsuite=unit,integration

.PHONY: coding-standards
coding-standards: vendor ## Fixes code style issues with friendsofphp/php-cs-fixer
Expand Down Expand Up @@ -51,9 +51,9 @@ static-code-analysis-baseline: vendor ## Generates a baseline for static code an
.PHONY: tests
tests: vendor ## Runs auto-review, unit, and integration tests with phpunit/phpunit
mkdir -p .build/phpunit
vendor/bin/phpunit --configuration=test/AutoReview/phpunit.xml
vendor/bin/phpunit --configuration=test/Unit/phpunit.xml
vendor/bin/phpunit --configuration=test/Integration/phpunit.xml
vendor/bin/phpunit --configuration=test/phpunit.xml --testsuite=auto-review
vendor/bin/phpunit --configuration=test/phpunit.xml --testsuite=unit
vendor/bin/phpunit --configuration=test/phpunit.xml --testsuite=integration

vendor: composer.json composer.lock
composer validate --strict
Expand Down
2 changes: 1 addition & 1 deletion infection.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
]
},
"phpUnit": {
"configDir": "test\/Unit"
"configDir": "test\/"
},
"logs": {
"text": ".build/infection/infection-log.txt"
Expand Down
30 changes: 0 additions & 30 deletions test/AutoReview/phpunit.xml

This file was deleted.

3 changes: 3 additions & 0 deletions test/Integration/FixtureFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
* @internal
*
* @covers \Ergebnis\FactoryBot\FixtureFactory
*
* @uses \Ergebnis\FactoryBot\EntityDefinition
* @uses \Ergebnis\FactoryBot\FieldDefinition
*/
final class FixtureFactoryTest extends AbstractTestCase
{
Expand Down
30 changes: 0 additions & 30 deletions test/Integration/phpunit.xml

This file was deleted.

18 changes: 12 additions & 6 deletions test/Unit/phpunit.xml → test/phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="../vendor/phpunit/phpunit/phpunit.xsd"
beStrictAboutChangesToGlobalState="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutResourceUsageDuringSmallTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutTodoAnnotatedTests="true"
bootstrap="../../vendor/autoload.php"
bootstrap="../vendor/autoload.php"
cacheResult="true"
cacheResultFile="../../.build/phpunit/unit.cache"
cacheResultFile="../.build/phpunit/cache"
colors="true"
columns="max"
convertErrorsToExceptions="true"
Expand All @@ -23,13 +23,19 @@
verbose="true"
>
<testsuites>
<testsuite name="Unit Tests">
<directory>.</directory>
<testsuite name="auto-review">
<directory>AutoReview/</directory>
</testsuite>
<testsuite name="integration">
<directory>Integration/</directory>
</testsuite>
<testsuite name="unit">
<directory>Unit/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">../../src/</directory>
<directory suffix=".php">../src/</directory>
</whitelist>
</filter>
</phpunit>

0 comments on commit f4545b6

Please sign in to comment.