#!/bin/bash

set -e

# defaults if not set
: "${SKIP_LINT:=0}"

# run linting of php and yaml files
if [ "$SKIP_LINT" -ne 1 ]; then
  echo 'Running linting...'
  yamllint -s docker-compose.yml spec/swagger.yaml
  ant phpcs
else
  echo 'Skipping linting...'
fi

# run phpunit
echo 'Running tests...'
export Environment=test

ant -DtestFilter=${TEST_FILTER} phpunit

echo 'Done!'
