public function testQueryingNonProvidedCapabilityReturnsNullSafely() { $capabilityApi = 'Composer\\Plugin\\Capability\\MadeUpCapability'; $plugin = $this->getMockBuilder('Composer\\Test\\Plugin\\Mock\\CapablePluginInterface')->getMock(); $plugin->expects($this->once())->method('getCapabilities')->will($this->returnCallback(function () { return array(); })); $this->assertNull($this->pm->getPluginCapability($plugin, $capabilityApi)); }
public function testPluginRangeConstraintsWorkOnlyWithCertainAPIVersion() { $pluginWithApiConstraint = array($this->packages[6]); $this->setPluginApiVersionWithPlugins('1.0.0', $pluginWithApiConstraint); $this->assertCount(0, $this->pm->getPlugins()); $this->setPluginApiVersionWithPlugins('3.0.0', $pluginWithApiConstraint); $this->assertCount(1, $this->pm->getPlugins()); $this->setPluginApiVersionWithPlugins('5.5.0', $pluginWithApiConstraint); $this->assertCount(0, $this->pm->getPlugins()); }