Commit 6914a5aa authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

fix(phpunit): enable xdebug coverage

parent afbdd3ba
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -193,6 +193,13 @@ stages:
    fi
  }

  # appends xdebug.mode=coverage in php.ini file
  function set_xdebug_mode() {
    phpini_path=$(php -i | grep php.ini | sed -e 's/.*=> *//')
    echo 'xdebug.mode=coverage' >> "${phpini_path}/conf.d/xdebug_coverage.ini"
    log_info "xdebug.mode=coverage set in \\e[33;1m${phpini_path}/conf.d/xdebug_coverage.ini\\e[0m"
  }

  # locates and executes phpunit (./vendor/bin/phpunit is default location; ./bin/phpunit alternate location)
  function dophpunit() {
    if [[ -f "./vendor/bin/phpunit" ]]
@@ -267,6 +274,7 @@ php-unit:
      fi
    - pecl install xdebug
    - docker-php-ext-enable xdebug
    - set_xdebug_mode
    # run PHPUnit (no color is important for the coverage regex)
    - dophpunit ${TRACE+--debug} --coverage-text --coverage-clover=reports/clover.xml --log-junit=reports/junit.xml --colors=never $PHP_UNIT_ARGS
  # code coverage RegEx