From 1ba14630131c912ef75a6556baf69297e5928139 Mon Sep 17 00:00:00 2001 From: jakobvibe Date: Wed, 27 Oct 2021 14:52:34 +0200 Subject: [PATCH] Added types to plugin test (#10231) Co-authored-by: Jakob Vibe --- .../Test/Plugin/PluginInstallerTest.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/Composer/Test/Plugin/PluginInstallerTest.php b/tests/Composer/Test/Plugin/PluginInstallerTest.php index fd27abfaf..4e137b3f4 100644 --- a/tests/Composer/Test/Plugin/PluginInstallerTest.php +++ b/tests/Composer/Test/Plugin/PluginInstallerTest.php @@ -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'; @@ -432,12 +441,16 @@ class PluginInstallerTest extends TestCase ->will($this->returnCallback(function () { return array(); })); - + + /** @phpstan-ignore-next-line */ $this->assertNull($this->pm->getPluginCapability($plugin, $capabilityApi)); } /** * @dataProvider nonExistingOrInvalidImplementationClassTypes + * @param callable $wrongImplementationClassTypes + * + * @return void */ public function testQueryingWithNonExistingOrWrongCapabilityClassTypesThrows($wrongImplementationClassTypes) {