Browse Source

DX: Fix collecting code coverage

Dariusz Ruminski 6 years ago
parent
commit
a0300a8637
3 changed files with 9 additions and 5 deletions
  1. 1 2
      .travis.yml
  2. 6 1
      phpunit.xml.dist
  3. 2 2
      tests/AutoReview/ProjectCodeTest.php

+ 1 - 2
.travis.yml

@@ -114,7 +114,7 @@ jobs:
                 # Composer: boost installation
                 - composer global show hirak/prestissimo -q || travis_retry composer global require $DEFAULT_COMPOSER_FLAGS hirak/prestissimo
             script:
-                - phpdbg -qrr vendor/bin/phpunit --exclude-group covers-nothing --coverage-clover build/logs/clover.xml || travis_terminate 1
+                - phpdbg -qrr vendor/bin/phpunit --testsuite coverage --exclude-group covers-nothing --coverage-clover build/logs/clover.xml || travis_terminate 1
                 - php vendor/bin/php-coveralls -v
 
         -
@@ -148,4 +148,3 @@ jobs:
 
     allow_failures:
         - php: nightly
-        - env: COLLECT_COVERAGE=1

+ 6 - 1
phpunit.xml.dist

@@ -21,9 +21,14 @@
     verbose="true"
 >
     <testsuites>
-        <testsuite>
+        <testsuite name="all">
             <directory>./tests</directory>
         </testsuite>
+        <testsuite name="coverage">
+            <directory>./tests</directory>
+            <exclude>./tests/AutoReview</exclude>
+            <exclude>./tests/Smoke</exclude>
+        </testsuite>
     </testsuites>
 
     <filter>

+ 2 - 2
tests/AutoReview/ProjectCodeTest.php

@@ -365,8 +365,8 @@ final class ProjectCodeTest extends TestCase
 
     public function provideClassesWherePregFunctionsAreForbiddenCases()
     {
-        if (extension_loaded('xdebug') && false === getenv('CI')) {
-            $this->markTestSkipped('Test too slow when Xdebug is loaded.');
+        if ((extension_loaded('xdebug') || 'phpdbg' === PHP_SAPI) && false === getenv('CI')) {
+            $this->markTestSkipped('Data provider too slow when Xdebug is loaded or running under phpdbg.');
         }
 
         return array_map(