Skip to content

Commit

Permalink
Don't ignore ref changes in packages with dev-branch versions
Browse files Browse the repository at this point in the history
  • Loading branch information
trakos committed Jun 21, 2021
1 parent a968372 commit be74acb
Show file tree
Hide file tree
Showing 7 changed files with 783 additions and 41 deletions.
2 changes: 1 addition & 1 deletion src/PackageDiff.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function getPackageDiff($from, $to, $dev, $withPlatform)

foreach ($targetPackages->getPackages() as $newPackage) {
if ($oldPackage = $oldPackages->findPackage($newPackage->getName(), '*')) {
if ($oldPackage->getUniqueName() !== $newPackage->getUniqueName()) {
if ($oldPackage->getFullPrettyVersion() !== $newPackage->getFullPrettyVersion()) {
$operations[] = new UpdateOperation($oldPackage, $newPackage);
}

Expand Down
64 changes: 34 additions & 30 deletions tests/Integration/DiffCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,15 @@ public function commandArgumentsDataProvider()
return array(
'with platform' => array(
<<<OUTPUT
| Prod Packages | Operation | Base | Target |
|------------------------------------|-----------|---------|---------|
| psr/event-dispatcher | New | - | 1.0.0 |
| symfony/deprecation-contracts | New | - | v2.1.2 |
| symfony/event-dispatcher | Upgraded | v2.8.52 | v5.1.2 |
| symfony/event-dispatcher-contracts | New | - | v2.1.2 |
| symfony/polyfill-php80 | New | - | v1.17.1 |
| php | New | - | >=5.3 |
| Prod Packages | Operation | Base | Target |
|------------------------------------|-----------|--------------------|--------------------|
| psr/event-dispatcher | New | - | 1.0.0 |
| roave/security-advisories | Changed | dev-master 3c97c13 | dev-master ac36586 |
| symfony/deprecation-contracts | New | - | v2.1.2 |
| symfony/event-dispatcher | Upgraded | v2.8.52 | v5.1.2 |
| symfony/event-dispatcher-contracts | New | - | v2.1.2 |
| symfony/polyfill-php80 | New | - | v1.17.1 |
| php | New | - | >=5.3 |
| Dev Packages | Operation | Base | Target |
|------------------------------------|------------|-------|--------|
Expand Down Expand Up @@ -102,13 +103,14 @@ public function commandArgumentsDataProvider()
),
'no-dev' => array(
<<<OUTPUT
| Prod Packages | Operation | Base | Target |
|------------------------------------|-----------|---------|---------|
| psr/event-dispatcher | New | - | 1.0.0 |
| symfony/deprecation-contracts | New | - | v2.1.2 |
| symfony/event-dispatcher | Upgraded | v2.8.52 | v5.1.2 |
| symfony/event-dispatcher-contracts | New | - | v2.1.2 |
| symfony/polyfill-php80 | New | - | v1.17.1 |
| Prod Packages | Operation | Base | Target |
|------------------------------------|-----------|--------------------|--------------------|
| psr/event-dispatcher | New | - | 1.0.0 |
| roave/security-advisories | Changed | dev-master 3c97c13 | dev-master ac36586 |
| symfony/deprecation-contracts | New | - | v2.1.2 |
| symfony/event-dispatcher | Upgraded | v2.8.52 | v5.1.2 |
| symfony/event-dispatcher-contracts | New | - | v2.1.2 |
| symfony/polyfill-php80 | New | - | v1.17.1 |
OUTPUT
Expand All @@ -121,13 +123,14 @@ public function commandArgumentsDataProvider()
),
'no-dev with arguments' => array(
<<<OUTPUT
| Prod Packages | Operation | Base | Target |
|------------------------------------|-----------|---------|---------|
| psr/event-dispatcher | New | - | 1.0.0 |
| symfony/deprecation-contracts | New | - | v2.1.2 |
| symfony/event-dispatcher | Upgraded | v2.8.52 | v5.1.2 |
| symfony/event-dispatcher-contracts | New | - | v2.1.2 |
| symfony/polyfill-php80 | New | - | v1.17.1 |
| Prod Packages | Operation | Base | Target |
|------------------------------------|-----------|--------------------|--------------------|
| psr/event-dispatcher | New | - | 1.0.0 |
| roave/security-advisories | Changed | dev-master 3c97c13 | dev-master ac36586 |
| symfony/deprecation-contracts | New | - | v2.1.2 |
| symfony/event-dispatcher | Upgraded | v2.8.52 | v5.1.2 |
| symfony/event-dispatcher-contracts | New | - | v2.1.2 |
| symfony/polyfill-php80 | New | - | v1.17.1 |
OUTPUT
Expand Down Expand Up @@ -174,14 +177,15 @@ public function commandArgumentsDataProvider()
),
'reversed, with platform' => array(
<<<OUTPUT
| Prod Packages | Operation | Base | Target |
|------------------------------------|------------|---------|---------|
| symfony/event-dispatcher | Downgraded | v5.1.2 | v2.8.52 |
| psr/event-dispatcher | Removed | 1.0.0 | - |
| symfony/deprecation-contracts | Removed | v2.1.2 | - |
| symfony/event-dispatcher-contracts | Removed | v2.1.2 | - |
| symfony/polyfill-php80 | Removed | v1.17.1 | - |
| php | Removed | >=5.3 | - |
| Prod Packages | Operation | Base | Target |
|------------------------------------|------------|--------------------|--------------------|
| roave/security-advisories | Changed | dev-master ac36586 | dev-master 3c97c13 |
| symfony/event-dispatcher | Downgraded | v5.1.2 | v2.8.52 |
| psr/event-dispatcher | Removed | 1.0.0 | - |
| symfony/deprecation-contracts | Removed | v2.1.2 | - |
| symfony/event-dispatcher-contracts | Removed | v2.1.2 | - |
| symfony/polyfill-php80 | Removed | v1.17.1 | - |
| php | Removed | >=5.3 | - |
| Dev Packages | Operation | Base | Target |
|------------------------------------|-----------|--------|--------|
Expand Down
2 changes: 2 additions & 0 deletions tests/PackageDiffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public function operationsProvider()
'prod, with platform' => array(
array(
'install psr/event-dispatcher 1.0.0',
'update roave/security-advisories from dev-master to dev-master',
'install symfony/deprecation-contracts v2.1.2',
'update symfony/event-dispatcher from v2.8.52 to v5.1.2',
'install symfony/event-dispatcher-contracts v2.1.2',
Expand All @@ -85,6 +86,7 @@ public function operationsProvider()
'prod, no platform' => array(
array(
'install psr/event-dispatcher 1.0.0',
'update roave/security-advisories from dev-master to dev-master',
'install symfony/deprecation-contracts v2.1.2',
'update symfony/event-dispatcher from v2.8.52 to v5.1.2',
'install symfony/event-dispatcher-contracts v2.1.2',
Expand Down
3 changes: 2 additions & 1 deletion tests/fixtures/base/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "test/test",
"require": {
"symfony/event-dispatcher": "^2.8",
"doctrine/dbal": "^2.10"
"doctrine/dbal": "^2.10",
"roave/security-advisories": "dev-master#3c97c13"
},
"require-dev": {
"phpunit/phpunit": "^9.2"
Expand Down
Loading

0 comments on commit be74acb

Please sign in to comment.