Fix the integration guide and installer after a test with a fresh agent
PR CI / flow (pull_request) Successful in 4s
PR CI / ledger (pull_request) Successful in 8s
PR CI / test (stable) (pull_request) Successful in 46s
PR CI / test (lowest) (pull_request) Successful in 48s
PR CI / ui (pull_request) Successful in 52s
PR CI / security (pull_request) Successful in 55s
PR CI / pr-ci (pull_request) Successful in 1s
PR CI / release-automerge (pull_request) Successful in 4s

This commit is contained in:
Matthijs Iriks committed 2026-12-04 04:10:25 +01:00
1 parent 9ff162460d
commit 441d76ef96
7 files changed
+51 -23

No files matched your search

+14 -4
View File
@@ -7,8 +7,14 @@ use IriksIT\Manager\Tests\TestCase;
uses(TestCase::class);
// The installer publishes the config into the app, here the skeleton in vendor/: leave it as it was.
beforeEach(fn () => $this->hadConfig = file_exists(config_path('manager.php')));
afterEach(fn () => $this->hadConfig || @unlink(config_path('manager.php')));
beforeEach(function () {
$this->hadConfig = file_exists(config_path('manager.php'));
$this->env = file_exists(base_path('.env')) ? file_get_contents(base_path('.env')) : null;
});
afterEach(function () {
$this->hadConfig || @unlink(config_path('manager.php'));
$this->env === null ? @unlink(base_path('.env')) : file_put_contents(base_path('.env'), $this->env);
});
function doctorReport(): array
{
@@ -54,12 +60,16 @@ it('refuses an unknown module in the installer', function () {
it('writes the switches to .env', function () {
$env = base_path('.env');
$before = file_exists($env) ? file_get_contents($env) : null;
Artisan::call('manager:install', ['--modules' => 'users,media,posts', '--path' => 'admin']);
$written = file_get_contents($env);
$before === null ? unlink($env) : file_put_contents($env, $before);
expect($written)->toContain('MANAGER_PATH=admin')->toContain('MANAGER_AUDIT=false')->toContain('MANAGER_POSTS=true');
});
it('leaves the check to a new process after it changed the switches', function () {
Artisan::call('manager:install', ['--path' => 'admin']);
expect(Artisan::output())->toContain('manager:doctor')->not->toContain('[OK]');
});