1
0
Fork 0

Added types to plugin test (#10231)

Co-authored-by: Jakob Vibe <jv@ipw.dk>
pull/10227/head
jakobvibe 2021-10-27 14:52:34 +02:00 committed by GitHub
parent c2a2198089
commit 1ba1463013
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 2 deletions

View File

@ -249,6 +249,8 @@ class PluginInstallerTest extends TestCase
/**
* @param string $newPluginApiVersion
* @param CompletePackage[] $plugins
*
* @return void
*/
private function setPluginApiVersionWithPlugins($newPluginApiVersion, array $plugins = array())
{
@ -351,7 +353,7 @@ class PluginInstallerTest extends TestCase
{
$plugin = $this->getMockBuilder('Composer\Plugin\PluginInterface')
->getMock();
/** @phpstan-ignore-next-line */
$this->assertNull($this->pm->getPluginCapability($plugin, 'Fake\Ability'));
}
@ -377,6 +379,7 @@ class PluginInstallerTest extends TestCase
$this->assertSame(array('a' => 1, 'b' => 2, 'plugin' => $plugin), $capability->args);
}
/** @return mixed[] */
public function invalidImplementationClassNames()
{
return array(
@ -391,6 +394,7 @@ class PluginInstallerTest extends TestCase
);
}
/** @return mixed[] */
public function nonExistingOrInvalidImplementationClassTypes()
{
return array(
@ -401,6 +405,10 @@ class PluginInstallerTest extends TestCase
/**
* @dataProvider invalidImplementationClassNames
* @param callable $invalidImplementationClassNames
* @param string $expect
*
* @return void
*/
public function testQueryingWithInvalidCapabilityClassNameThrows($invalidImplementationClassNames, $expect = 'UnexpectedValueException')
{
@ -420,6 +428,7 @@ class PluginInstallerTest extends TestCase
$this->pm->getPluginCapability($plugin, $capabilityApi);
}
/** @return void */
public function testQueryingNonProvidedCapabilityReturnsNullSafely()
{
$capabilityApi = 'Composer\Plugin\Capability\MadeUpCapability';
@ -433,11 +442,15 @@ class PluginInstallerTest extends TestCase
return array();
}));
/** @phpstan-ignore-next-line */
$this->assertNull($this->pm->getPluginCapability($plugin, $capabilityApi));
}
/**
* @dataProvider nonExistingOrInvalidImplementationClassTypes
* @param callable $wrongImplementationClassTypes
*
* @return void
*/
public function testQueryingWithNonExistingOrWrongCapabilityClassTypesThrows($wrongImplementationClassTypes)
{