Skip to content

Commit 1385f04

Browse files
committed
fix.
1 parent b9be3a7 commit 1385f04

File tree

2 files changed

+37
-9
lines changed

2 files changed

+37
-9
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
DB_USERNAME: root
4949
DB_PASSWORD: ''
5050
DB_DATABASE: testing
51+
DB_CONNECTION: 'mysql'
5152

5253
steps:
5354
- uses: actions/checkout@v4
@@ -133,9 +134,11 @@ jobs:
133134
--health-retries=3
134135
135136
env:
136-
POSTGRES_DB: testing
137-
POSTGRES_USER: postgres
138-
POSTGRES_PASSWORD: ''
137+
DB_HOST: 127.0.0.1
138+
DB_USERNAME: postgres
139+
DB_PASSWORD: ''
140+
DB_DATABASE: testing
141+
DB_CONNECTION: 'pgsql'
139142

140143

141144
steps:
@@ -226,6 +229,7 @@ jobs:
226229
DB_USERNAME: SA
227230
DB_PASSWORD: Passw0rd1234!
228231
DB_DATABASE: testing
232+
DB_CONNECTION: 'sqlsrv'
229233

230234
steps:
231235
- uses: actions/checkout@v4

tests/TestCase.php

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace Tests;
44

5+
use Illuminate\Foundation\Application;
56
use N3XT0R\MigrationGenerator\Providers\MigrationGeneratorServiceProvider;
67
use Orchestra\Testbench\TestCase as OrchestraTestCase;
7-
use Illuminate\Foundation\Application;
88

99
abstract class TestCase extends OrchestraTestCase
1010
{
@@ -13,11 +13,11 @@ abstract class TestCase extends OrchestraTestCase
1313
protected function setUp(): void
1414
{
1515
parent::setUp();
16-
$this->resourceFolder = __DIR__ . '/Resources/';
16+
$this->resourceFolder = __DIR__.'/Resources/';
1717
}
1818

1919
/**
20-
* @param Application $app
20+
* @param Application $app
2121
* @return array|string[]
2222
*/
2323
protected function getPackageProviders($app): array
@@ -28,7 +28,7 @@ protected function getPackageProviders($app): array
2828
}
2929

3030
/**
31-
* @param Application $app
31+
* @param Application $app
3232
* @return array
3333
*/
3434
protected function getPackageAliases($app): array
@@ -38,11 +38,13 @@ protected function getPackageAliases($app): array
3838
}
3939

4040
/**
41-
* @param Application $app
41+
* @param Application $app
4242
*/
4343
protected function getEnvironmentSetUp($app): void
4444
{
45-
$app['config']->set('database.default', 'mysql');
45+
$host = env('DB_HOST', 'db_migration');
46+
$app['config']->set('database.connections.mysql.host', $host);
47+
$app['config']->set('database.default', env('DB_CONNECTION', 'mysql'));
4648
$app['config']->set(
4749
'database.connections.mysql',
4850
[
@@ -54,5 +56,27 @@ protected function getEnvironmentSetUp($app): void
5456
'prefix' => '',
5557
]
5658
);
59+
$app['config']->set(
60+
'database.connections.pgsql',
61+
[
62+
'host' => env('DB_HOST', 'db_migration'),
63+
'driver' => 'pgsql',
64+
'database' => 'testing',
65+
'username' => env('DB_USERNAME', 'postgres'),
66+
'password' => env('DB_PASSWORD', '!'),
67+
'prefix' => '',
68+
]
69+
);
70+
$app['config']->set(
71+
'database.connections.sqlsrv',
72+
[
73+
'host' => env('DB_HOST', 'db_migration'),
74+
'driver' => 'sqlsrv',
75+
'database' => 'testing',
76+
'username' => env('DB_USERNAME', 'SA'),
77+
'password' => env('DB_PASSWORD', 'Passw0rd1234!'),
78+
'prefix' => '',
79+
]
80+
);
5781
}
5882
}

0 commit comments

Comments
 (0)