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