forked from slimkit/plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.php
39 lines (35 loc) · 980 Bytes
/
.travis.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
$db = $argv[1] ?? 'mysql';
$connection = [];
switch ($db) {
case 'postgres':
case 'pgsql':
$connection = [
'DB_CONNECTION' => 'pgsql',
'DB_HOST' => '127.0.0.1',
'DB_PORT' => '5432',
'DB_DATABASE' => 'plus',
'DB_USERNAME' => 'postgres',
'DB_PASSWORD' => 'postgres',
];
break;
case 'mysql':
default:
$connection = [
'DB_CONNECTION' => 'mysql',
'DB_HOST' => '127.0.0.1',
'DB_PORT' => '3306',
'DB_DATABASE' => 'plus',
'DB_USERNAME' => 'root',
'DB_PASSWORD' => '',
];
break;
}
$connection = array_merge($connection, [
'APP_ENV' => 'testing',
]);
$env = file_get_contents(__DIR__.'/.env.example');
foreach ($connection as $key => $value) {
$env = preg_replace("/{$key}=(.*)?/i", "{$key}={$value}", $env);
}
file_put_contents(__DIR__.'/.env.travis', $env);