1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +00:00

Adjust the CommandProvider to use plugin capabilities and test actual command creation, refs #3377

This commit is contained in:
Jordi Boggiano 2016-04-28 20:37:34 +01:00
parent 4319435154
commit 090295dbcb
8 changed files with 92 additions and 30 deletions

View file

@ -297,6 +297,24 @@ class PluginInstallerTest extends TestCase
$this->assertCount(0, $this->pm->getPlugins());
}
public function testCommandProviderCapability()
{
$this->repository
->expects($this->exactly(2))
->method('getPackages')
->will($this->returnValue(array($this->packages[7])));
$installer = new PluginInstaller($this->io, $this->composer);
$this->pm->loadInstalledPlugins();
$caps = $this->pm->getPluginCapabilities('Composer\Plugin\Capability\CommandProvider');
$this->assertCount(1, $caps);
$this->assertInstanceOf('Composer\Plugin\Capability\CommandProvider', $caps[0]);
$commands = $caps[0]->getCommands();
$this->assertCount(1, $commands);
$this->assertInstanceOf('Composer\Command\BaseCommand', $commands[0]);
}
public function testIncapablePluginIsCorrectlyDetected()
{
$plugin = $this->getMockBuilder('Composer\Plugin\PluginInterface')