setAppNamespace(); $this->configPath = ROOT . DS . 'cakephp-plugins.php'; if (file_exists($this->configPath)) { unlink($this->configPath); } } protected function tearDown(): void { parent::tearDown(); if (file_exists($this->configPath)) { unlink($this->configPath); } } /** * Test generating help succeeds */ public function testHelp(): void { $this->exec('plugin list --help'); $this->assertExitCode(CommandInterface::CODE_SUCCESS); $this->assertOutputContains('plugin list'); } /** * Test plugin names are being displayed correctly */ public function testList(): void { $file = << [ 'TestPlugin' => '/config/path', 'OtherPlugin' => '/config/path' ] ]; PHP; file_put_contents($this->configPath, $file); $this->exec('plugin list'); $this->assertExitCode(CommandInterface::CODE_SUCCESS); $this->assertOutputContains('TestPlugin'); $this->assertOutputContains('OtherPlugin'); } /** * Test empty plugins array */ public function testListEmpty(): void { $file = <<configPath, $file); $this->exec('plugin list'); $this->assertExitCode(CommandInterface::CODE_SUCCESS); $this->assertErrorContains('No plugins have been found.'); } }