1
0
Fork 0

Add tests for edge cases of packages providing names which exist as real packages

pull/9172/head
Nils Adermann 2020-08-28 14:50:28 +02:00
parent 140665eadd
commit 43093d0eeb
3 changed files with 156 additions and 0 deletions

View File

@ -0,0 +1,56 @@
--TEST--
A root requirement for a name exists as well as a dependency's requirement for the same name but in a different version.
Since the root requirement does not allow the dependency's requirement to be installed, this conflicts.
The difference between this test and the one which does not conflict is that here the root requirement could only be
satisfied with the provided package but would conflict with the actual package by the given name.
--COMPOSER--
{
"repositories": [
{
"type": "package",
"package": [
{
"name": "foo/provider",
"provide": {
"foo/original": "3.0.0"
},
"version": "1.0.0"
},
{
"name": "foo/original",
"version": "1.0.0"
},
{
"name": "foo/requirer",
"require": {
"foo/original": "1.0.0"
},
"version": "1.0.0"
}
]
}
],
"require": {
"foo/original": "3.0.0",
"foo/provider": "1.0.0",
"foo/requirer": "1.0.0"
}
}
--RUN--
update
--EXPECT-EXIT-CODE--
2
--EXPECT-OUTPUT--
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires foo/requirer 1.0.0 -> satisfiable by foo/requirer[1.0.0].
- foo/requirer 1.0.0 requires foo/original 1.0.0 -> found foo/original[1.0.0] but it conflicts with your root composer.json require (3.0.0).
--EXPECT--

View File

@ -0,0 +1,54 @@
--TEST--
This is a variant of the test provider-gets-picked-together-with-other-version-of-provided-conflict.test which differs
in so far as that the root requirements were all moved into a package which now allows the combination to succeed.
Only root requirements strictly limit compatibility with versions if a package by a provided name also actually exists.
--COMPOSER--
{
"repositories": [
{
"type": "package",
"package": [
{
"name": "foo/root",
"require": {
"foo/original": "3.0.0",
"foo/provider": "1.0.0",
"foo/requirer": "1.0.0"
},
"version": "1.0.0"
},
{
"name": "foo/provider",
"provide": {
"foo/original": "3.0.0"
},
"version": "1.0.0"
},
{
"name": "foo/original",
"version": "1.0.0"
},
{
"name": "foo/requirer",
"require": {
"foo/original": "1.0.0"
},
"version": "1.0.0"
}
]
}
],
"require": {
"foo/root": "1.0.0"
}
}
--RUN--
update
--EXPECT--
Installing foo/original (1.0.0)
Installing foo/provider (1.0.0)
Installing foo/requirer (1.0.0)
Installing foo/root (1.0.0)

View File

@ -0,0 +1,46 @@
--TEST--
A root requirement for a name exists as well as a dependency's requirement for the same name but in a different version.
The root requirement is satisfied by the actual package by that name in that version. The dependency's requirement can
be satisfied by another package which provides the name in the other version. This will result in all packages being
installed as the provider does not conflict with the actual package and all requirements can be met.
--COMPOSER--
{
"repositories": [
{
"type": "package",
"package": [
{
"name": "foo/provider",
"provide": {
"foo/original": "3.0.0"
},
"version": "1.0.0"
},
{
"name": "foo/original",
"version": "1.0.0"
},
{
"name": "foo/requirer",
"require": {
"foo/original": "3.0.0"
},
"version": "1.0.0"
}
]
}
],
"require": {
"foo/original": "1.0.0",
"foo/provider": "1.0.0",
"foo/requirer": "1.0.0"
}
}
--RUN--
update
--EXPECT--
Installing foo/original (1.0.0)
Installing foo/provider (1.0.0)
Installing foo/requirer (1.0.0)