#!/bin/bash

set -e

function unit () {
  echo "Running Unit Test Suite"

  if [ "${TRAVIS}" == "true" ]; then
    $(dirname $0)/../../vendor/bin/phpunit --coverage-clover=build/clover.xml
  else
    $(dirname $0)/../../vendor/bin/phpunit
  fi
}

function snippets() {
  echo "Running Snippet Test Suite"

  $(dirname $0)/../../vendor/bin/phpunit -c phpunit-snippets.xml.dist
}

function composer() {
  echo "Running Composer Integration Test"

  $(dirname $0)/../../dev/sh/test-composer
}

function system () {
  echo "Running System Test Suite"

  $(dirname $0)/../../vendor/bin/phpunit -c phpunit-system.xml.dist
}

unit
snippets

if [ "${TRAVIS_EVENT_TYPE}" == "cron" ]; then
  composer
  system
fi
