Skip to content

Commit

Permalink
Backfill tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmccreary committed Mar 5, 2024
1 parent 05238fc commit 8eacc2f
Show file tree
Hide file tree
Showing 8 changed files with 173 additions and 0 deletions.
54 changes: 54 additions & 0 deletions tests/Foundation/FoundationApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,60 @@ public function testUseConfigPath(): void

$this->assertSame('bar', $app->make('config')->get('app.foo'));
}

public function testMergeableConfig(): void
{
$app = new Application;
$app->useConfigPath(__DIR__.'/fixtures/config');
$app->bootstrapWith([\Illuminate\Foundation\Bootstrap\LoadConfiguration::class]);

$config = $app->make('config');

$this->assertSame('UTC', $config->get('app.timezone'));
$this->assertSame('bar', $config->get('app.foo'));

$this->assertSame('overwrite', $config->get('broadcasting.default'));
$this->assertSame('broadcasting', $config->get('broadcasting.custom_option'));
$this->assertIsArray($config->get('broadcasting.connections.pusher'));
$this->assertSame(['overwrite' => true], $config->get('broadcasting.connections.reverb'));
$this->assertSame(['merge' => true], $config->get('broadcasting.connections.new'));

$this->assertSame('overwrite', $config->get('cache.default'));
$this->assertSame('cache', $config->get('cache.custom_option'));
$this->assertIsArray($config->get('cache.stores.database'));
$this->assertSame(['overwrite' => true], $config->get('cache.stores.array'));
$this->assertSame(['merge' => true], $config->get('cache.stores.new'));

$this->assertSame('overwrite', $config->get('database.default'));
$this->assertSame('database', $config->get('database.custom_option'));
$this->assertIsArray($config->get('database.connections.pgsql'));
$this->assertSame(['overwrite' => true], $config->get('database.connections.mysql'));
$this->assertSame(['merge' => true], $config->get('database.connections.new'));

$this->assertSame('overwrite', $config->get('filesystems.default'));
$this->assertSame('filesystems', $config->get('filesystems.custom_option'));
$this->assertIsArray($config->get('filesystems.disks.s3'));
$this->assertSame(['overwrite' => true], $config->get('filesystems.disks.local'));
$this->assertSame(['merge' => true], $config->get('filesystems.disks.new'));

$this->assertSame('overwrite', $config->get('logging.default'));
$this->assertSame('logging', $config->get('logging.custom_option'));
$this->assertIsArray($config->get('logging.channels.single'));
$this->assertSame(['overwrite' => true], $config->get('logging.channels.stack'));
$this->assertSame(['merge' => true], $config->get('logging.channels.new'));

$this->assertSame('overwrite', $config->get('mail.default'));
$this->assertSame('mail', $config->get('mail.custom_option'));
$this->assertIsArray($config->get('mail.mailers.ses'));
$this->assertSame(['overwrite' => true], $config->get('mail.mailers.smtp'));
$this->assertSame(['merge' => true], $config->get('mail.mailers.new'));

$this->assertSame('overwrite', $config->get('queue.default'));
$this->assertSame('queue', $config->get('queue.custom_option'));
$this->assertIsArray($config->get('queue.connections.redis'));
$this->assertSame(['overwrite' => true], $config->get('queue.connections.database'));
$this->assertSame(['merge' => true], $config->get('queue.connections.new'));
}
}

class ApplicationBasicServiceProviderStub extends ServiceProvider
Expand Down
17 changes: 17 additions & 0 deletions tests/Foundation/fixtures/config/broadcasting.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

return [
'custom_option' => 'broadcasting',

'default' => 'overwrite',

'connections' => [
'reverb' => [
'overwrite' => true,
],

'new' => [
'merge' => true,
],
],
];
17 changes: 17 additions & 0 deletions tests/Foundation/fixtures/config/cache.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

return [
'custom_option' => 'cache',

'default' => 'overwrite',

'stores' => [
'array' => [
'overwrite' => true,
],

'new' => [
'merge' => true,
],
],
];
17 changes: 17 additions & 0 deletions tests/Foundation/fixtures/config/database.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

return [
'custom_option' => 'database',

'default' => 'overwrite',

'connections' => [
'mysql' => [
'overwrite' => true,
],

'new' => [
'merge' => true,
],
],
];
17 changes: 17 additions & 0 deletions tests/Foundation/fixtures/config/filesystems.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

return [
'custom_option' => 'filesystems',

'default' => 'overwrite',

'disks' => [
'local' => [
'overwrite' => true,
],

'new' => [
'merge' => true,
],
],
];
17 changes: 17 additions & 0 deletions tests/Foundation/fixtures/config/logging.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

return [
'custom_option' => 'logging',

'default' => 'overwrite',

'channels' => [
'stack' => [
'overwrite' => true,
],

'new' => [
'merge' => true,
],
],
];
17 changes: 17 additions & 0 deletions tests/Foundation/fixtures/config/mail.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

return [
'custom_option' => 'mail',

'default' => 'overwrite',

'mailers' => [
'smtp' => [
'overwrite' => true,
],

'new' => [
'merge' => true,
],
],
];
17 changes: 17 additions & 0 deletions tests/Foundation/fixtures/config/queue.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

return [
'custom_option' => 'queue',

'default' => 'overwrite',

'connections' => [
'database' => [
'overwrite' => true,
],

'new' => [
'merge' => true,
],
],
];

0 comments on commit 8eacc2f

Please sign in to comment.