Skip to content

Commit 0c503a2

Browse files
committed
✅ setting up travis testing
1 parent 31a4c62 commit 0c503a2

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

.travis.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
language: php
2+
3+
sudo: false
4+
5+
matrix:
6+
include:
7+
- php: 5.6
8+
- php: 7.0
9+
- php: 7.1
10+
- php: nightly
11+
- php: hhvm
12+
allow_failures:
13+
- php: nightly
14+
- php: hhvm
15+
fast_finish: true
16+
17+
cache:
18+
directories:
19+
- $HOME/.composer/cache
20+
21+
before_install:
22+
- source .travis/travis.sh
23+
- xdebug-disable
24+
- travis_retry composer self-update
25+
26+
install:
27+
- travis_retry composer install --no-interaction --prefer-dist --no-suggest;
28+
29+
script:
30+
- run-tests

.travis/travis.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
# The problem is that we do not want to remove the configuration file, just disable it for a few tasks, then enable it
4+
#
5+
# For reference, see
6+
#
7+
# - https://docs.travis-ci.com/user/languages/php#Disabling-preinstalled-PHP-extensions
8+
# - https://docs.travis-ci.com/user/languages/php#Custom-PHP-configuration
9+
#
10+
# Original Source (this was copied from):
11+
# - https://github.com/codeclimate/php-test-reporter/blob/master/.travis/travis.sh
12+
13+
config="/home/travis/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini"
14+
15+
function xdebug-disable() {
16+
if [[ -f $config ]]; then
17+
mv $config "$config.bak"
18+
fi
19+
}
20+
21+
function xdebug-enable() {
22+
if [[ -f "$config.bak" ]]; then
23+
mv "$config.bak" $config
24+
fi
25+
}
26+
27+
function run-tests() {
28+
if [[ "$WITH_COVERAGE" == "true" ]]; then
29+
xdebug-enable
30+
vendor/bin/phpunit --coverage-clover=$TRAVIS_BUILD_DIR/build/logs/clover.xml
31+
xdebug-disable
32+
else
33+
vendor/bin/phpunit
34+
fi
35+
}

0 commit comments

Comments
 (0)