1
0
Fork 0

Fix transaction order

pull/8811/head
Jordi Boggiano 2020-04-20 22:02:07 +02:00
parent 17ed09be2e
commit ba9d4793bc
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
8 changed files with 9 additions and 9 deletions

View File

@ -295,7 +295,7 @@ class Transaction
{ {
$uninstOps = array(); $uninstOps = array();
foreach ($operations as $idx => $op) { foreach ($operations as $idx => $op) {
if ($op instanceof Operation\UninstallOperation) { if ($op instanceof Operation\UninstallOperation || $op instanceof Operation\MarkAliasUninstalledOperation) {
$uninstOps[] = $op; $uninstOps[] = $op;
unset($operations[$idx]); unset($operations[$idx]);
} }

View File

@ -53,6 +53,7 @@ class TransactionTest extends TestCase
$expectedOperations = array( $expectedOperations = array(
array('job' => 'uninstall', 'package' => $packageC), array('job' => 'uninstall', 'package' => $packageC),
array('job' => 'uninstall', 'package' => $packageE), array('job' => 'uninstall', 'package' => $packageE),
array('job' => 'markAliasUninstalled', 'package' => $packageEalias),
array('job' => 'install', 'package' => $packageA0first), array('job' => 'install', 'package' => $packageA0first),
array('job' => 'update', 'from' => $packageB, 'to' => $packageBnew), array('job' => 'update', 'from' => $packageB, 'to' => $packageBnew),
array('job' => 'install', 'package' => $packageG), array('job' => 'install', 'package' => $packageG),
@ -60,7 +61,6 @@ class TransactionTest extends TestCase
array('job' => 'markAliasInstalled', 'package' => $packageFalias1), array('job' => 'markAliasInstalled', 'package' => $packageFalias1),
array('job' => 'markAliasInstalled', 'package' => $packageFalias2), array('job' => 'markAliasInstalled', 'package' => $packageFalias2),
array('job' => 'install', 'package' => $packageD), array('job' => 'install', 'package' => $packageD),
array('job' => 'markAliasUninstalled', 'package' => $packageEalias),
); );
$transaction = new Transaction($presentPackages, $resultPackages); $transaction = new Transaction($presentPackages, $resultPackages);

View File

@ -97,9 +97,9 @@ update b/b
"platform-dev": [] "platform-dev": []
} }
--EXPECT-- --EXPECT--
Marking a/a (2.1.x-dev oldmaster-a) as uninstalled, alias of a/a (dev-master oldmaster-a)
Marking b/b (2.1.x-dev oldmaster-b) as uninstalled, alias of b/b (dev-master oldmaster-b)
Upgrading a/a (dev-master oldmaster-a => dev-master newmaster-a) Upgrading a/a (dev-master oldmaster-a => dev-master newmaster-a)
Marking a/a (2.2.x-dev newmaster-a) as installed, alias of a/a (dev-master newmaster-a) Marking a/a (2.2.x-dev newmaster-a) as installed, alias of a/a (dev-master newmaster-a)
Upgrading b/b (dev-master oldmaster-b => dev-master newmaster-b2) Upgrading b/b (dev-master oldmaster-b => dev-master newmaster-b2)
Marking b/b (2.3.x-dev newmaster-b2) as installed, alias of b/b (dev-master newmaster-b2) Marking b/b (2.3.x-dev newmaster-b2) as installed, alias of b/b (dev-master newmaster-b2)
Marking a/a (2.1.x-dev oldmaster-a) as uninstalled, alias of a/a (dev-master oldmaster-a)
Marking b/b (2.1.x-dev oldmaster-b) as uninstalled, alias of b/b (dev-master oldmaster-b)

View File

@ -33,5 +33,5 @@ Update aliased package to non-aliased version
--RUN-- --RUN--
update update
--EXPECT-- --EXPECT--
Upgrading a/a (dev-master master => dev-foo foo)
Marking a/a (1.0.x-dev master) as uninstalled, alias of a/a (dev-master master) Marking a/a (1.0.x-dev master) as uninstalled, alias of a/a (dev-master master)
Upgrading a/a (dev-master master => dev-foo foo)

View File

@ -91,9 +91,9 @@ update new/pkg --with-all-dependencies
"platform-dev": [] "platform-dev": []
} }
--EXPECT-- --EXPECT--
Marking current/dep2 (1.0.x-dev) as uninstalled, alias of current/dep2 (dev-foo)
Marking current/dep (1.1.0) as installed, alias of current/dep (dev-master) Marking current/dep (1.1.0) as installed, alias of current/dep (dev-master)
Upgrading current/dep2 (dev-foo => dev-master) Upgrading current/dep2 (dev-foo => dev-master)
Marking current/dep2 (1.1.2) as installed, alias of current/dep2 (dev-master) Marking current/dep2 (1.1.2) as installed, alias of current/dep2 (dev-master)
Marking current/dep2 (2.x-dev) as installed, alias of current/dep2 (dev-master) Marking current/dep2 (2.x-dev) as installed, alias of current/dep2 (dev-master)
Installing new/pkg (1.0.0) Installing new/pkg (1.0.0)
Marking current/dep2 (1.0.x-dev) as uninstalled, alias of current/dep2 (dev-foo)

View File

@ -46,5 +46,5 @@ Downgrading from unstable to more stable package should work even if already ins
--RUN-- --RUN--
update update
--EXPECT-- --EXPECT--
Downgrading a/a (dev-master abcd => 1.0.0)
Marking a/a (9999999-dev abcd) as uninstalled, alias of a/a (dev-master abcd) Marking a/a (9999999-dev abcd) as uninstalled, alias of a/a (dev-master abcd)
Downgrading a/a (dev-master abcd => 1.0.0)

View File

@ -61,8 +61,8 @@ Updates with --no-dev but we still end up with a complete lock file including de
update --no-dev update --no-dev
--EXPECT-- --EXPECT--
Removing a/b (1.0.0) Removing a/b (1.0.0)
Marking dev/pkg (1.0.x-dev old) as uninstalled, alias of dev/pkg (dev-master old)
Upgrading a/a (1.0.0 => 1.0.1) Upgrading a/a (1.0.0 => 1.0.1)
Installing a/c (1.0.0) Installing a/c (1.0.0)
Upgrading dev/pkg (dev-master old => dev-master new) Upgrading dev/pkg (dev-master old => dev-master new)
Marking dev/pkg (1.1.x-dev new) as installed, alias of dev/pkg (dev-master new) Marking dev/pkg (1.1.x-dev new) as installed, alias of dev/pkg (dev-master new)
Marking dev/pkg (1.0.x-dev old) as uninstalled, alias of dev/pkg (dev-master old)

View File

@ -42,5 +42,5 @@ Installing locked dev packages should remove old dependencies
install install
--EXPECT-- --EXPECT--
Removing a/dependency (dev-master ref) Removing a/dependency (dev-master ref)
Upgrading a/devpackage (dev-master oldref => dev-master newref)
Marking a/dependency (9999999-dev ref) as uninstalled, alias of a/dependency (dev-master ref) Marking a/dependency (9999999-dev ref) as uninstalled, alias of a/dependency (dev-master ref)
Upgrading a/devpackage (dev-master oldref => dev-master newref)