Browse Source

Let PHPUnit run the code coverage.

Lacey Sanderson 6 years ago
parent
commit
fce91b7c3e
2 changed files with 14 additions and 1 deletions
  1. 4 1
      .travis.yml
  2. 10 0
      phpunit.xml

+ 4 - 1
.travis.yml

@@ -17,6 +17,8 @@ before_script:
   - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
   - chmod +x ./cc-test-reporter
   - ./cc-test-reporter before-build
+  - GIT_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH
+  - GIT_COMMIT_SHA=$TRAVIS_PULL_REQUEST_SHA
 after_script:
   - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
 script:
@@ -25,4 +27,5 @@ script:
  #install blast
   - docker exec -it tripal bash -c "cp /modules/tripal_blast/ncbi-blast-2.2.30+/bin/* /usr/local/bin"
   - docker exec -it tripal drush pm-enable -y blast_ui
-  - docker exec -it tripal bash -c "cd /modules/tripal_blast && composer install && DRUPAL_ROOT=/var/www/html ./vendor/bin/phpunit"
+  - docker exec -it tripal yum install -y php-pecl-xdebug.x86_64
+  - docker exec -it tripal bash -c "cd /modules/tripal_blast && composer install && DRUPAL_ROOT=/var/www/html ./vendor/bin/phpunit --coverage-clover ./clover.xml"

+ 10 - 0
phpunit.xml

@@ -12,4 +12,14 @@
       <directory suffix="Test.php">tests</directory>
     </testsuite>
   </testsuites>
+  <filter>
+    <whitelist addUncoveredFilesFromWhitelist="true">
+      <directory suffix=".inc">./includes</directory>
+      <directory suffix=".php">./includes</directory>
+     <directory suffix=".inc">./api</directory>
+     <directory suffix=".php">./api</directory>
+     <directory suffix=".inc">./theme</directory>
+     <directory suffix=".php">./theme</directory>
+    </whitelist>
+  </filter>
 </phpunit>