Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
edgrosvenor committed Aug 6, 2020
1 parent 5927abc commit 000390d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/GenerateShiftableConfigsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function handle(Configurations $configurations)
}
}

File::put(config('shiftable-config.overrides_file'), VarExporter::export($overrides));
File::put(config('shiftable-config.overrides_file'), "<?php\n\nreturn " . VarExporter::export($overrides) . ';');

return 0;
}
Expand Down
5 changes: 4 additions & 1 deletion src/ShiftableConfigsProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Grosv\ShiftableConfigs;

use Illuminate\Contracts\Foundation\CachesConfiguration;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\ServiceProvider;

Expand All @@ -10,7 +11,9 @@ class ShiftableConfigsProvider extends ServiceProvider
public function boot(Configurations $configurations): void
{
$this->mergeConfigFrom(Config::get('shiftable-config.overrides') ?? __DIR__ . '/../config/overrides.php', 'shiftable-config-overrides');
$configurations->custom();
if (!($this->app instanceof CachesConfiguration && $this->app->configurationIsCached())) {
$configurations->custom();
}

$this->publishes([
__DIR__ . '/../config/config.php' => config_path('shiftable-configs.php'),
Expand Down
6 changes: 6 additions & 0 deletions tests/CommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Tests;

use Illuminate\Support\Arr;
use Illuminate\Support\Facades\File;

class CommandTest extends TestCase
Expand All @@ -19,5 +20,10 @@ public function can_run_the_command()
->assertExitCode(0);

$this->assertStringContainsString('An App By Any Other Name', File::get(__DIR__ . '/configs/overrides.php'));

$overrides = [];
Arr::set($overrides, 'root', include(__DIR__ . '/configs/overrides.php'));

$this->assertContains('Grosv\ShiftableConfigs\ShiftableConfigsProvider', $overrides['root']['app']['providers']);
}
}

0 comments on commit 000390d

Please sign in to comment.