Skip to content

Fix resolving deps for psr/http-message-implementation #214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Composer/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [],
Expand Down
25 changes: 22 additions & 3 deletions tests/Composer/PluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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, []];
}
Expand Down
3 changes: 2 additions & 1 deletion tests/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down