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