create(); $product = HostingProduct::create([ 'name' => 'Isolation Test Product', 'slug' => 'isolation-test-' . str()->random(6), 'category' => HostingProduct::CATEGORY_SHARED, 'type' => HostingProduct::TYPE_SINGLE_DOMAIN, 'price_monthly' => 10, 'currency' => 'GHS', 'disk_gb' => 10, 'max_domains' => 1, 'is_active' => true, 'is_visible' => true, ]); $account = HostingAccount::create([ 'user_id' => $user->id, 'hosting_product_id' => $product->id, 'username' => 'isolateacct', 'primary_domain' => 'example.test', 'type' => HostingAccount::TYPE_SHARED, 'status' => HostingAccount::STATUS_ACTIVE, ]); $provider = \Mockery::mock(SharedNodeProvider::class); $provider->shouldReceive('hardenAccountFilesystem')->once()->withArgs( fn (HostingAccount $candidate): bool => $candidate->id === $account->id ); $this->app->instance(SharedNodeProvider::class, $provider); $this->artisan('hosting:harden-account-isolation', [ '--account' => $account->id, ])->assertExitCode(0); } public function test_it_supports_dry_run_without_touching_accounts(): void { $user = User::factory()->create(); $product = HostingProduct::create([ 'name' => 'Isolation Test Product', 'slug' => 'isolation-dry-run-' . str()->random(6), 'category' => HostingProduct::CATEGORY_SHARED, 'type' => HostingProduct::TYPE_SINGLE_DOMAIN, 'price_monthly' => 10, 'currency' => 'GHS', 'disk_gb' => 10, 'max_domains' => 1, 'is_active' => true, 'is_visible' => true, ]); HostingAccount::create([ 'user_id' => $user->id, 'hosting_product_id' => $product->id, 'username' => 'dryrunacct', 'primary_domain' => 'dry-run.test', 'type' => HostingAccount::TYPE_SHARED, 'status' => HostingAccount::STATUS_ACTIVE, ]); $provider = \Mockery::mock(SharedNodeProvider::class); $provider->shouldNotReceive('hardenAccountFilesystem'); $this->app->instance(SharedNodeProvider::class, $provider); $this->artisan('hosting:harden-account-isolation', [ '--dry-run' => true, ])->assertExitCode(0); } }