Skip to content

Commit f71f0b3

Browse files
committed
Enhance boot method in ParqBridgeServiceProvider to support minimal containers in tests by checking for runningInConsole and config_path functions before publishing configuration.
1 parent 2b7ae0b commit f71f0b3

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/ParqBridgeServiceProvider.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ public function register(): void
1313

1414
public function boot(): void
1515
{
16-
if ($this->app->runningInConsole()) {
17-
$this->publishes([
18-
__DIR__.'/../config/parqbridge.php' => config_path('parqbridge.php'),
19-
], 'parqbridge-config');
16+
// Guard for minimal containers used in tests where runningInConsole isn't available
17+
if (method_exists($this->app, 'runningInConsole') && $this->app->runningInConsole()) {
18+
if (function_exists('config_path')) {
19+
$this->publishes([
20+
__DIR__.'/../config/parqbridge.php' => config_path('parqbridge.php'),
21+
], 'parqbridge-config');
22+
}
2023

2124
$this->commands([
2225
\ParqBridge\Console\ExportTableCommand::class,

0 commit comments

Comments
 (0)