ikechukwukalu /
dynamicdatabaseconfig
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Ikechukwukalu\Dynamicdatabaseconfig\Tests; |
||
| 4 | |||
| 5 | use Ikechukwukalu\Dynamicdatabaseconfig\DynamicDatabaseConfigServiceProvider; |
||
| 6 | use Ikechukwukalu\Dynamicdatabaseconfig\Middleware\DynamicDatabaseConfig; |
||
| 7 | use Ikechukwukalu\Dynamicdatabaseconfig\Middleware\EnvDatabaseConfig; |
||
| 8 | use Illuminate\Foundation\Testing\RefreshDatabase; |
||
| 9 | |||
| 10 | class ServiceProviderTest extends TestCase |
||
| 11 | { |
||
| 12 | use RefreshDatabase; |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 13 | |||
| 14 | public function test_merges_config(): void |
||
| 15 | { |
||
| 16 | static::assertSame( |
||
| 17 | $this->app->make('files') |
||
| 18 | ->getRequire(DynamicDatabaseConfigServiceProvider::CONFIG), |
||
| 19 | $this->app->make('config')->get('dynamicdatabaseconfig') |
||
| 20 | ); |
||
| 21 | } |
||
| 22 | |||
| 23 | public function test_publishes_middleware(): void |
||
| 24 | { |
||
| 25 | $middleware = $this->app->make('router')->getMiddleware(); |
||
| 26 | |||
| 27 | static::assertSame(DynamicDatabaseConfig::class, $middleware['dynamic.database.config']); |
||
| 28 | static::assertArrayHasKey('dynamic.database.config', $middleware); |
||
| 29 | |||
| 30 | static::assertSame(EnvDatabaseConfig::class, $middleware['env.database.config']); |
||
| 31 | static::assertArrayHasKey('env.database.config', $middleware); |
||
| 32 | } |
||
| 33 | |||
| 34 | } |
||
| 35 |