1
0
Fork 0
composer/tests/Composer/Test/Installer
jrfnl 7004e0d031 PHP 8.1/LibraryInstallerTest: add missing mock expectation
The `LibraryInstallerTest::testUninstall()` method mocks a `Package` object, but did not set an expectation for a call to `getName()`, while that method _is_ called in the `LibraryInstaller::uninstall()` method.

Without expectation, the mock returns `null`, which was subsequently being passed on to `strpos()` leading to the below error.

Fixes:
```
Deprecation triggered by Composer\Test\Installer\LibraryInstallerTest::testUninstall:
strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated

Stack trace:
0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 202)
1 src/Composer/Installer/LibraryInstaller.php(202): strpos(NULL, '...')
2 vendor/react/promise/src/FulfilledPromise.php(28): Composer\Installer\LibraryInstaller->Composer\Installer\{closure}(NULL)
3 src/Composer/Installer/LibraryInstaller.php(208): React\Promise\FulfilledPromise->then(Object(Closure))
4 tests/Composer/Test/Installer/LibraryInstallerTest.php(221): Composer\Installer\LibraryInstaller->uninstall(Object(Mock_InstalledRepositoryInterface_e3699f95), Object(Mock_Package_e4571076))
...
```
2021-08-12 03:38:56 +02:00
..
InstallationManagerTest.php Remove OperationInterface::getReason, closes #9230, closes #9263 2020-10-12 12:31:54 +02:00
InstallerEventTest.php Replace pre/post-dependencies-solving by a pre-operations-exec event happening only on install from lock 2020-02-12 14:35:31 +01:00
LibraryInstallerTest.php PHP 8.1/LibraryInstallerTest: add missing mock expectation 2021-08-12 03:38:56 +02:00
MetapackageInstallerTest.php use Symfony PHPUnit Bridge 2020-02-07 12:22:22 +08:00
SuggestedPackagesReporterTest.php Fix tests 2020-04-23 10:29:22 +02:00