[PROPOSAL] Add more tests to the library (#865)

* phpunit: use dedicate `Tests` namespace for tests

* tests: replace phpunit with orchestra/testbench

* phpunit: ignore result cache file

* phpunit: adapt test for newer version

* tests: add base testcase class with a helper to run/assert commands

* tests: add test for ide-helper:eloquent

* travis: add global default variables

* travis: disable xdebug, speeds up running tests

* travis: convert php versions to build matrix for environment vars

* travis: only run phpcs/phpunit when the env vars signal it

However phpcs only runs with one test combination from the matrix,
not necessary to execute it every time.
This commit is contained in:
Markus Podar
2020-01-01 22:51:21 +01:00
committed by Barry vd. Heuvel
parent 0d1dd2182b
commit fb0c576806
6 changed files with 135 additions and 15 deletions
+24 -10
View File
@@ -1,25 +1,39 @@
language: php
php:
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4
## Cache composer
cache:
directories:
- $HOME/.composer/cache
env:
global:
- RUN_PHPUNIT=1
- RUN_PHPCS=0
matrix:
include:
- php: 7.0
env: 'COMPOSER_FLAGS="--prefer-stable --prefer-lowest"'
env: RUN_PHPUNIT=0
- php: 7.0
env: RUN_PHPUNIT=0 COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
- php: 7.1
env: RUN_PHPUNIT=0
- php: 7.2
- php: 7.3
- php: 7.4
env: RUN_PHPCS=1
before_script:
- phpenv config-rm xdebug.ini || true
install:
- |
if [[ $RUN_PHPUNIT = 0 ]]; then
# We assume the older PHP/Laravel versions and thus restore a working dependency system for them
composer remove --dev orchestra/testbench --no-interaction --no-update
fi
- travis_wait 20 travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-dist
script:
- vendor/bin/phpcs --standard=psr2 src/
- vendor/bin/phpunit
- if [[ $RUN_PHPCS = 1 ]]; then vendor/bin/phpcs --standard=psr2 src/; fi
- if [[ $RUN_PHPUNIT = 1 ]]; then vendor/bin/phpunit; fi