'version'], ['value' => '1.2.09-beta']); $exitCode = Artisan::call('version:bump'); expect($exitCode)->toBe(0); $setting = Setting::where('key', 'version')->value('value'); expect($setting)->toBe('1.2.10-beta'); $data = json_decode((string) file_get_contents($path), true); expect($data['version'] ?? null)->toBe('1.2.10-beta'); }); }); it('fails when composer.json cannot be decoded', function (): void { withComposerBackup(function (string $path): void { file_put_contents($path, 'not-json'); Setting::updateOrCreate(['key' => 'version'], ['value' => '1.2.3']); $exitCode = Artisan::call('version:bump'); expect($exitCode)->toBe(1); }); }); it('fails when composer.json is not readable', function (): void { withComposerBackup(function (string $path): void { chmod($path, 0000); Setting::updateOrCreate(['key' => 'version'], ['value' => '1.2.3']); $exitCode = Artisan::call('version:bump'); expect($exitCode)->toBe(1); chmod($path, 0644); }); }); it('fails when file_get_contents returns false', function (): void { withComposerBackup(function (): void { $GLOBALS['version_bump_file_get_contents_false'] = true; Setting::updateOrCreate(['key' => 'version'], ['value' => '1.2.3']); $exitCode = Artisan::call('version:bump'); expect($exitCode)->toBe(1); }); }); it('fails when json_encode returns false', function (): void { withComposerBackup(function (): void { $GLOBALS['version_bump_json_encode_false'] = true; Setting::updateOrCreate(['key' => 'version'], ['value' => '1.2.3']); $exitCode = Artisan::call('version:bump'); expect($exitCode)->toBe(1); }); }); }