Skip to content

Commit b99bdf8

Browse files
committed
Add breaking test to demo config array has been incorrectly keyed with numbers
1 parent 64dd9da commit b99bdf8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/Foundation/Bootstrap/LoadConfigurationTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Illuminate\Tests\Foundation\Bootstrap;
44

5+
use Illuminate\Filesystem\Filesystem;
56
use Illuminate\Foundation\Application;
67
use Illuminate\Foundation\Bootstrap\LoadConfiguration;
78
use PHPUnit\Framework\TestCase;
@@ -37,4 +38,23 @@ public function testLoadsConfigurationInIsolation()
3738
$this->assertNull($app['config']['bar.foo']);
3839
$this->assertSame('bar', $app['config']['custom.foo']);
3940
}
41+
42+
public function testConfigurationArrayKeysMatchLoadedFilenames()
43+
{
44+
$baseConfigPath = __DIR__.'/../../../config';
45+
$customConfigPath = __DIR__.'/../fixtures/config';
46+
47+
$app = new Application();
48+
$app->useConfigPath($customConfigPath);
49+
50+
(new LoadConfiguration)->bootstrap($app);
51+
52+
$this->assertEqualsCanonicalizing(
53+
array_keys($app['config']->all()),
54+
collect((new Filesystem)->files([
55+
$baseConfigPath,
56+
$customConfigPath,
57+
]))->map(fn ($file) => $file->getBaseName('.php'))->unique()->values()->toArray()
58+
);
59+
}
4060
}

0 commit comments

Comments
 (0)