find('app:doctors:purge') ); } public function testDryRunRunsInTestEnv(): void { $tester = $this->tester(); $tester->execute([]); $tester->assertCommandIsSuccessful(); $this->assertStringContainsString('dry-run', $tester->getDisplay()); } /** * محیط از kernel تزریق می‌شود، پس گارد با ساختِ مستقیم کامند در محیط prod تست * می‌شود — نه با دست‌کاری $_ENV که دیگر خوانده نمی‌شود. */ public function testRefusesOnProdWithNoEscapeHatch(): void { self::bootKernel(); $command = new PurgeDoctorsCommand(static::getContainer()->get(Connection::class), 'prod'); $tester = new CommandTester($command); $tester->execute(['--force' => true]); $this->assertSame(Command::FAILURE, $tester->getStatusCode()); $this->assertStringContainsString('فقط در محیط dev', $tester->getDisplay()); } }