Add MySQL tests to Travis config

This commit is contained in:
Bubka 2022-04-01 14:09:34 +02:00
parent 0e7a8a3166
commit 4452a0b920
2 changed files with 17 additions and 5 deletions

View File

@ -7,14 +7,26 @@ php:
- 7.4
- 8.0
services:
- mysql
cache:
directories:
- $HOME/.composer/cache
- $HOME/vendor
before_install:
- mysql -e 'CREATE DATABASE 2fauth_test;'
before_script:
- travis_retry composer self-update
- travis_retry composer install --no-interaction
- travis_retry composer install --no-interaction --prefer-source
# no need to use a dedicated Travis .env file as phpunit
# will use .env.testing by default
script:
- vendor/bin/phpunit --coverage-clover=coverage.xml
- DATABASE=mysql vendor/bin/phpunit -c phpunit-mysql.xml
- DATABASE=sqlite vendor/bin/phpunit -c phpunit.xml --coverage-clover=coverage.xml
after_success:
# Submit coverage report to https://codecov.io

View File

@ -32,10 +32,10 @@
<env name="APP_ENV" value="testing"/>
<!-- following values override .env.testing vars -->
<env name="DB_CONNECTION" value="mysql"/>
<env name="DB_HOST" value="localhost"/>
<env name="DB_HOST" value="127.0.0.1"/>
<env name="DB_PORT" value="3306"/>
<env name="DB_DATABASE" value="2fauth_test"/>
<env name="DB_USERNAME" value="test_user"/>
<env name="DB_PASSWORD" value="password"/>
<env name="DB_USERNAME" value="travis"/>
<env name="DB_PASSWORD" value=""/>
</php>
</phpunit>