createdPath && is_file($this->createdPath)) { @unlink($this->createdPath); } } public function testMakeCommandCreatesFileAndIsDiscovered(): void { $root = dirname(__DIR__); $target = $root . '/console/commands/HelloWorld.php'; if (is_file($target)) { @unlink($target); } $cmd = 'php ' . escapeshellarg($root . '/bin/phred') . ' create:command hello:world'; $output = shell_exec($cmd) ?: ''; $this->assertStringContainsString('created', $output, 'Expected creation message'); $this->createdPath = $target; $this->assertFileExists($target, 'Scaffolded command file should exist'); $contents = @file_get_contents($target) ?: ''; $this->assertStringContainsString("protected string \$command = 'hello:world';", $contents); // And the new command should be listed by the CLI $listOut = shell_exec('php ' . escapeshellarg($root . '/bin/phred') . ' list') ?: ''; $this->assertStringContainsString('hello:world', $listOut); } }