Skip to content

Commit 9e2f701

Browse files
authored
Attempt to improve performance of phpunit with coverage. (#513)
1 parent f8ea6e8 commit 9e2f701

2 files changed

Lines changed: 35 additions & 2 deletions

File tree

.travis.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ install:
7777
# Reference the module in the build site.
7878
- ln -s $TRAVIS_BUILD_DIR $DRUPAL_BUILD_DIR/modules/graphql
7979

80+
# Copy the customized phpunit configuration file to the core directory so
81+
# the relative paths are correct.
82+
- cp $DRUPAL_BUILD_DIR/modules/graphql/phpunit.xml.dist $DRUPAL_BUILD_DIR/core/phpunit.xml
83+
8084
# When running with phpdbg we need to replace all code occurrences that check
8185
# for 'cli' with 'phpdbg'. Some files might be write protected, hence the
8286
# fallback.
@@ -91,12 +95,12 @@ install:
9195
script:
9296
# Run the unit tests using phpdbg if the environment variable is 'true'.
9397
- if [[ "$WITH_PHPDBG_COVERAGE" == "true" ]];
94-
then phpdbg -qrr $DRUPAL_BUILD_DIR/vendor/bin/phpunit --configuration $DRUPAL_BUILD_DIR/core/phpunit.xml.dist --coverage-clover $TRAVIS_BUILD_DIR/coverage.xml $TRAVIS_BUILD_DIR;
98+
then phpdbg -qrr $DRUPAL_BUILD_DIR/vendor/bin/phpunit --configuration $DRUPAL_BUILD_DIR/core/phpunit.xml --coverage-clover $TRAVIS_BUILD_DIR/coverage.xml $TRAVIS_BUILD_DIR;
9599
fi
96100

97101
# Run the unit tests with standard php otherwise.
98102
- if [[ "$WITH_PHPDBG_COVERAGE" != "true" ]];
99-
then $DRUPAL_BUILD_DIR/vendor/bin/phpunit --configuration $DRUPAL_BUILD_DIR/core/phpunit.xml.dist $TRAVIS_BUILD_DIR;
103+
then $DRUPAL_BUILD_DIR/vendor/bin/phpunit --configuration $DRUPAL_BUILD_DIR/core/phpunit.xml $TRAVIS_BUILD_DIR;
100104
fi
101105

102106
after_success:

phpunit.xml.dist

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<phpunit bootstrap="tests/bootstrap.php" colors="true"
4+
beStrictAboutTestsThatDoNotTestAnything="true"
5+
beStrictAboutOutputDuringTests="true"
6+
beStrictAboutChangesToGlobalState="true"
7+
checkForUnintentionallyCoveredCode="false">
8+
<testsuites>
9+
<testsuite name="unit">
10+
<file>./tests/TestSuites/UnitTestSuite.php</file>
11+
</testsuite>
12+
<testsuite name="kernel">
13+
<file>./tests/TestSuites/KernelTestSuite.php</file>
14+
</testsuite>
15+
</testsuites>
16+
<listeners>
17+
<listener class="\Drupal\Tests\Listeners\DrupalStandardsListener">
18+
</listener>
19+
</listeners>
20+
<filter>
21+
<whitelist>
22+
<directory suffix=".php">./modules/graphql</directory>
23+
<exclude>
24+
<directory suffix="Test.php">./</directory>
25+
<directory suffix="TestBase.php">./</directory>
26+
</exclude>
27+
</whitelist>
28+
</filter>
29+
</phpunit>

0 commit comments

Comments
 (0)