Skip to content

Commit

Permalink
add postgresql for unittests
Browse files Browse the repository at this point in the history
  • Loading branch information
Gummibeer committed Feb 6, 2017
1 parent 207ddae commit b974e09
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ addons:
## Services used by this package
services:
- mysql
- postgresql

## List all PHP versions to test with
php:
Expand All @@ -36,12 +37,22 @@ env:
matrix:
fast_finish: true
include:
## php5.5 support build
- php: 5.5
env: LARAVEL_VERSION="5.1.*"
## mysql laravel lts build
- php: 5.6
env: LARAVEL_VERSION="5.1.*" DB_TYPE="mysql"
## mysql laravel latest build
- php: 7.1
env: LARAVEL_VERSION="5.4.*" DB_TYPE="mysql"
## pgsql laravel lts build
- php: 5.6
env: LARAVEL_VERSION="5.1.*" DB_TYPE="pgsql"
## pgsql laravel latest build
- php: 7.1
env: LARAVEL_VERSION="5.4.*" DB_TYPE="pgsql"
## laravel future build
- php: 7.1
env: LARAVEL_VERSION="dev-master"
allow_failures:
Expand All @@ -52,6 +63,7 @@ matrix:
## Run Scripts before Install
before_install:
- mysql -e 'CREATE DATABASE IF NOT EXISTS notifynder;'
- psql -c 'create database notifynder;' -U postgres

## Install Dependencies
install:
Expand Down
13 changes: 13 additions & 0 deletions tests/NotifynderTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,21 @@ protected function getEnvironmentSetUp($app)
'strict' => false,
'engine' => null,
]);
$app['config']->set('database.connections.test_pgsql', [
'driver' => 'pgsql',
'host' => 'localhost',
'port' => 5432,
'database' => 'notifynder',
'username' => 'postgres',
'password' => '',
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
]);
if (env('DB_TYPE', 'sqlite') == 'mysql') {
$app['config']->set('database.default', 'test_mysql');
} elseif (env('DB_TYPE', 'sqlite') == 'pgsql') {
$app['config']->set('database.default', 'test_pgsql');
} else {
$app['config']->set('database.default', 'test_sqlite');
}
Expand Down

0 comments on commit b974e09

Please sign in to comment.