stages:
  - test

before_script:
  - apt-get -yqq update
  - apt-get -yqq install zip unzip
  - curl -sS https://composer.github.io/installer.sig > installer.sig
  - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
  - php -r "if (hash_file('SHA384', 'composer-setup.php') === file_get_contents('installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
  - php composer-setup.php
  - php -r "unlink('composer-setup.php'); unlink('installer.sig');"
  - pecl -q install xdebug-3.1.5
  - docker-php-ext-enable xdebug
  - echo xdebug.mode=coverage >> /usr/local/etc/php/conf.d/xdebug.ini

cache:
  paths:
    - ./ot_core/.Build/vendor

unit:otcore:
  stage: test

  script:
    - php composer.phar --quiet --no-interaction --working-dir=./ot_core install
    - ./ot_core/.Build/bin/phpunit -c ./ot_core/Tests/Build/UnitTests.xml --coverage-text --colors=never

  artifacts:
    paths:
      - ./ot_core/coverage/
    when: always
    reports:
      junit: ./ot_core/coverage/junit-report.xml

  coverage: '/^\s*Lines:\s*\d+.\d+\%/'


