-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[11.x] Fixes
config:publish
with `dontMergeFrameworkConfiguration()…
…` set to `true` (#51751) * [11.x] Fixes `config:publish` with `dontMergeFrameworkConfiguration()` set to `true` fixes #51736 Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * Apply fixes from StyleCI * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * Apply fixes from StyleCI * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * Update ConfigPublishCommandTest.php * Apply fixes from StyleCI * Update composer.json * Update composer.json * Update ConfigPublishCommandTest.php * Update composer.json * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> --------- Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> Co-authored-by: StyleCI Bot <bot@styleci.io>
- Loading branch information
1 parent
c632b1f
commit fecf031
Showing
4 changed files
with
74 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
tests/Integration/Foundation/Console/ConfigPublishCommandTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
namespace Illuminate\Tests\Integration\Foundation\Console; | ||
|
||
use Illuminate\Filesystem\Filesystem; | ||
use Illuminate\Foundation\Bootstrap\LoadConfiguration; | ||
use Illuminate\Support\ServiceProvider; | ||
use Orchestra\Testbench\Concerns\InteractsWithPublishedFiles; | ||
use Orchestra\Testbench\TestCase; | ||
|
||
use function Orchestra\Testbench\package_path; | ||
|
||
class ConfigPublishCommandTest extends TestCase | ||
{ | ||
use InteractsWithPublishedFiles; | ||
|
||
protected array $files = [ | ||
'config-stubs/*.php', | ||
]; | ||
|
||
#[\Override] | ||
protected function setUp(): void | ||
{ | ||
$files = new Filesystem(); | ||
|
||
$this->afterApplicationCreated(function () use ($files) { | ||
$files->ensureDirectoryExists($this->app->basePath('config-stubs')); | ||
}); | ||
|
||
$this->beforeApplicationDestroyed(function () use ($files) { | ||
$files->deleteDirectory($this->app->basePath('config-stubs')); | ||
}); | ||
|
||
parent::setUp(); | ||
} | ||
|
||
#[\Override] | ||
protected function resolveApplicationConfiguration($app) | ||
{ | ||
$app->instance(LoadConfiguration::class, new LoadConfiguration()); | ||
|
||
$app->useConfigPath($app->basePath('config-stubs')); | ||
|
||
$app->dontMergeFrameworkConfiguration(); | ||
|
||
parent::resolveApplicationConfiguration($app); | ||
} | ||
|
||
public function testItCanPublishConfigFilesWhenConfiguredWithDontMergeFrameworkConfiguration() | ||
{ | ||
$this->artisan('config:publish', ['--all' => true])->assertOk(); | ||
|
||
foreach ([ | ||
'app', 'auth', 'broadcasting', 'cache', 'cors', | ||
'database', 'filesystems', 'hashing', 'logging', | ||
'mail', 'queue', 'services', 'session', 'view', | ||
] as $file) { | ||
$this->assertFilenameExists("config-stubs/{$file}.php"); | ||
$this->assertStringContainsString( | ||
file_get_contents(package_path(['config', "{$file}.php"])), file_get_contents(config_path("{$file}.php")) | ||
); | ||
} | ||
|
||
$this->assertSame(config('app.providers'), ServiceProvider::defaultProviders()->toArray()); | ||
} | ||
} |