diff --git a/src/Composer/Plugin.php b/src/Composer/Plugin.php index a59cf95..b08c522 100644 --- a/src/Composer/Plugin.php +++ b/src/Composer/Plugin.php @@ -66,7 +66,7 @@ class Plugin implements PluginInterface, EventSubscriberInterface 'kriswallsmith/buzz:^1' => [], ], 'psr/http-message-implementation' => [ - 'psr/http-factory-implementation' => [], + 'php-http/discovery' => ['psr/http-factory-implementation'], ], 'psr/http-factory-implementation' => [ 'nyholm/psr7' => [], diff --git a/tests/Composer/PluginTest.php b/tests/Composer/PluginTest.php index a992fe5..13e9d4b 100644 --- a/tests/Composer/PluginTest.php +++ b/tests/Composer/PluginTest.php @@ -27,15 +27,19 @@ public function testMissingRequires(array $expected, InstalledArrayRepository $r public static function provideMissingRequires() { $link = new Link('source', 'target', new Constraint(Constraint::STR_OP_GE, '1')); - $repo = new InstalledArrayRepository([]); + $repo = new InstalledArrayRepository([ + 'php-http/discovery' => new Package('php-http/discovery', '1.0.0.0', '1.0'), + ]); yield 'empty' => [[[], [], []], $repo, [], []]; $rootRequires = [ 'php-http/discovery' => $link, 'php-http/async-client-implementation' => $link, + 'psr/http-message-implementation' => $link, ]; $expected = [[ + 'psr/http-message-implementation' => [], 'php-http/async-client-implementation' => [ 'symfony/http-client', 'guzzlehttp/promises', @@ -49,15 +53,30 @@ public static function provideMissingRequires() yield 'async-httplug' => [$expected, $repo, $rootRequires, []]; $repo = new InstalledArrayRepository([ + 'php-http/discovery' => new Package('php-http/discovery', '1.0.0.0', '1.0'), 'nyholm/psr7' => new Package('nyholm/psr7', '1.0.0.0', '1.0'), ]); $repo->setDevPackageNames(['nyholm/psr7']); - $expected[2] = [ + $rootRequires = [ + 'php-http/discovery' => $link, + 'php-http/async-client-implementation' => $link, + ]; + + $expected = [[ + 'php-http/async-client-implementation' => [ + 'symfony/http-client', + 'guzzlehttp/promises', + 'php-http/message-factory', + ], 'psr/http-factory-implementation' => [ 'nyholm/psr7', ], - ]; + ], [], [ + 'psr/http-factory-implementation' => [ + 'nyholm/psr7', + ], + ]]; yield 'move-to-require' => [$expected, $repo, $rootRequires, []]; } diff --git a/tests/install.sh b/tests/install.sh index 01da882..33caeb4 100755 --- a/tests/install.sh +++ b/tests/install.sh @@ -17,7 +17,8 @@ echo "Using directory: ${BUILD_DIR}" mkdir -p $BUILD_DIR # Init composer -composer req --working-dir $BUILD_DIR php-http/discovery --no-update +composer req --working-dir $BUILD_DIR php-http/discovery --no-update --no-plugins +composer config --working-dir $BUILD_DIR --no-plugins allow-plugins.php-http/discovery false # Argument 3 installs additional composer packages composer req --working-dir $BUILD_DIR $3