path = base_path("config/{$this->name}.php"); config(['app.timebank_config' => $this->name]); $this->cleanup(); } protected function tearDown(): void { $this->cleanup(); parent::tearDown(); } private function cleanup(): void { File::delete([$this->path, "{$this->path}.example"]); foreach (File::glob(storage_path("config-backups/{$this->name}.php.backup.*")) as $backup) { File::delete($backup); } } public function test_a_platform_config_with_its_own_name_gets_new_keys_from_the_default_template(): void { File::put($this->path, " 'kept',\n];\n"); $this->artisan('config:merge', ['file' => $this->name, '--force' => true])->assertExitCode(0); $merged = include $this->path; $this->assertSame('kept', $merged['own_setting']); $this->assertSame(['App\Models\Admin', 'App\Models\Bank'], $merged['account_info']['privileged_viewer_types']); } public function test_all_includes_the_platform_config(): void { File::put($this->path, " 'kept',\n];\n"); $this->artisan('config:merge', ['--all' => true, '--dry-run' => true]) ->expectsOutputToContain("Config: {$this->name}") ->assertExitCode(0); } public function test_its_own_example_wins_over_the_default_template(): void { File::put($this->path, " 1,\n];\n"); File::put("{$this->path}.example", " 1,\n 'b' => 2,\n];\n"); $this->artisan('config:merge', ['file' => $this->name, '--force' => true])->assertExitCode(0); $this->assertSame(['a' => 1, 'b' => 2], include $this->path); } }