clear(); $this->configFile = CONFIG . 'plugins.php'; $this->originalContent = file_get_contents($this->configFile); $contents = << ['routes' => false], 'TestPluginTwo', 'Company/TestPluginThree' ]; CONTENTS; file_put_contents($this->configFile, $contents); $this->setAppNamespace(); } /** * tearDown method */ public function tearDown(): void { parent::tearDown(); file_put_contents($this->configFile, $this->originalContent); } /** * testUnload * * @dataProvider pluginNameProvider */ public function testUnload($plugin): void { $this->exec('plugin unload ' . $plugin); $this->assertExitCode(CommandInterface::CODE_SUCCESS); $contents = file_get_contents($this->configFile); $this->assertStringNotContainsString("'" . $plugin . "'", $contents); $this->assertStringContainsString("'Company/TestPluginThree'", $contents); } public static function pluginNameProvider() { return [ ['TestPlugin'], ['TestPluginTwo'], ]; } public function testUnloadNoConfigFile(): void { unlink($this->configFile); $this->exec('plugin unload TestPlugin'); $this->assertExitCode(CommandInterface::CODE_ERROR); $this->assertErrorContains('`CONFIG/plugins.php` not found or does not return an array'); } public function testUnloadUnknownPlugin(): void { $this->exec('plugin unload NopeNotThere'); $this->assertExitCode(CommandInterface::CODE_ERROR); $this->assertErrorContains('Plugin `NopeNotThere` could not be found'); } }