mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-22 08:56:42 -06:00
Added execution of db tests with mysql and postgres to travis
This commit is contained in:
parent
6fa255386b
commit
840e377245
@ -9,6 +9,10 @@ php:
|
||||
- 7.2
|
||||
- 7.3
|
||||
|
||||
services:
|
||||
- mysql
|
||||
- postgresql
|
||||
|
||||
before_install:
|
||||
- echo 'extension = memcached.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||
- echo 'extension = apcu.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||
@ -19,6 +23,10 @@ install:
|
||||
- composer self-update
|
||||
- composer install --no-interaction
|
||||
|
||||
before_script:
|
||||
- mysql -e 'CREATE DATABASE shlink_test;'
|
||||
- psql -c 'create database shlink_test;' -U postgres
|
||||
|
||||
script:
|
||||
- mkdir build
|
||||
- composer ci
|
||||
|
@ -110,6 +110,8 @@
|
||||
"test:ci": [
|
||||
"@test:unit:ci",
|
||||
"@test:db",
|
||||
"@test:db:mysql",
|
||||
"@test:db:postgres",
|
||||
"@test:api"
|
||||
],
|
||||
"test:unit": "phpdbg -qrr vendor/bin/phpunit --order-by=random --coverage-php build/coverage-unit.cov --testdox",
|
||||
|
@ -17,6 +17,7 @@ $swooleTestingPort = 9999;
|
||||
|
||||
$buildDbConnection = function () {
|
||||
$driver = env('DB_DRIVER', 'sqlite');
|
||||
$isCi = env('TRAVIS') === 'true';
|
||||
|
||||
switch ($driver) {
|
||||
case 'sqlite':
|
||||
@ -27,9 +28,9 @@ $buildDbConnection = function () {
|
||||
case 'mysql':
|
||||
return [
|
||||
'driver' => 'pdo_mysql',
|
||||
'host' => 'shlink_db',
|
||||
'host' => $isCi ? 'localhost' : 'shlink_db',
|
||||
'user' => 'root',
|
||||
'password' => 'root',
|
||||
'password' => $isCi ? '' : 'root',
|
||||
'dbname' => 'shlink_test',
|
||||
'charset' => 'utf8',
|
||||
'driverOptions' => [
|
||||
@ -39,9 +40,9 @@ $buildDbConnection = function () {
|
||||
case 'postgres':
|
||||
return [
|
||||
'driver' => 'pdo_pgsql',
|
||||
'host' => 'shlink_db_postgres',
|
||||
'host' => $isCi ? 'localhost' : 'shlink_db_postgres',
|
||||
'user' => 'postgres',
|
||||
'password' => 'root',
|
||||
'password' => $isCi ? '' : 'root',
|
||||
'dbname' => 'shlink_test',
|
||||
'charset' => 'utf8',
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user