From 8930f1b8246ee6e79ec13d677e3ac7c3a29019d2 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 8 Apr 2020 15:18:28 +0200 Subject: [PATCH] Add color to lock operations and dry run output --- .../DependencyResolver/Operation/InstallOperation.php | 2 +- .../Operation/MarkAliasInstalledOperation.php | 2 +- .../Operation/MarkAliasUninstalledOperation.php | 2 +- .../Operation/UninstallOperation.php | 2 +- .../DependencyResolver/Operation/UpdateOperation.php | 2 +- tests/Composer/Test/Mock/InstallationManagerMock.php | 10 +++++----- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Composer/DependencyResolver/Operation/InstallOperation.php b/src/Composer/DependencyResolver/Operation/InstallOperation.php index b719f49f9..9ac6beabe 100644 --- a/src/Composer/DependencyResolver/Operation/InstallOperation.php +++ b/src/Composer/DependencyResolver/Operation/InstallOperation.php @@ -61,7 +61,7 @@ class InstallOperation extends SolverOperation */ public function show($lock) { - return ($lock ? 'Locking ' : 'Installing ').$this->package->getPrettyName().' ('.$this->package->getFullPrettyVersion().')'; + return ($lock ? 'Locking ' : 'Installing ').''.$this->package->getPrettyName().' ('.$this->package->getFullPrettyVersion().')'; } /** diff --git a/src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php b/src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php index e028b3079..e770d5b57 100644 --- a/src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php +++ b/src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php @@ -62,7 +62,7 @@ class MarkAliasInstalledOperation extends SolverOperation */ public function show($lock) { - return 'Marking '.$this->package->getPrettyName().' ('.$this->package->getFullPrettyVersion().') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->package->getAliasOf()->getFullPrettyVersion().')'; + return 'Marking '.$this->package->getPrettyName().' ('.$this->package->getFullPrettyVersion().') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->package->getAliasOf()->getFullPrettyVersion().')'; } /** diff --git a/src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.php b/src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.php index 0468f2daf..0803fbb86 100644 --- a/src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.php +++ b/src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.php @@ -62,7 +62,7 @@ class MarkAliasUninstalledOperation extends SolverOperation */ public function show($lock) { - return 'Marking '.$this->package->getPrettyName().' ('.$this->package->getFullPrettyVersion().') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->package->getAliasOf()->getFullPrettyVersion().')'; + return 'Marking '.$this->package->getPrettyName().' ('.$this->package->getFullPrettyVersion().') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->package->getAliasOf()->getFullPrettyVersion().')'; } /** diff --git a/src/Composer/DependencyResolver/Operation/UninstallOperation.php b/src/Composer/DependencyResolver/Operation/UninstallOperation.php index 2ddc2f169..4618e0722 100644 --- a/src/Composer/DependencyResolver/Operation/UninstallOperation.php +++ b/src/Composer/DependencyResolver/Operation/UninstallOperation.php @@ -61,7 +61,7 @@ class UninstallOperation extends SolverOperation */ public function show($lock) { - return 'Removing '.$this->package->getPrettyName().' ('.$this->package->getFullPrettyVersion().')'; + return 'Removing '.$this->package->getPrettyName().' ('.$this->package->getFullPrettyVersion().')'; } /** diff --git a/src/Composer/DependencyResolver/Operation/UpdateOperation.php b/src/Composer/DependencyResolver/Operation/UpdateOperation.php index 61bcd7f5b..528efdd14 100644 --- a/src/Composer/DependencyResolver/Operation/UpdateOperation.php +++ b/src/Composer/DependencyResolver/Operation/UpdateOperation.php @@ -88,7 +88,7 @@ class UpdateOperation extends SolverOperation $actionName = VersionParser::isUpgrade($this->initialPackage->getVersion(), $this->targetPackage->getVersion()) ? 'Upgrading' : 'Downgrading'; - return $actionName.' '.$this->initialPackage->getPrettyName().' ('.$fromVersion.' => '.$toVersion.')'; + return $actionName.' '.$this->initialPackage->getPrettyName().' ('.$fromVersion.' => '.$toVersion.')'; } /** diff --git a/tests/Composer/Test/Mock/InstallationManagerMock.php b/tests/Composer/Test/Mock/InstallationManagerMock.php index 220313daa..2d4a8781b 100644 --- a/tests/Composer/Test/Mock/InstallationManagerMock.php +++ b/tests/Composer/Test/Mock/InstallationManagerMock.php @@ -57,14 +57,14 @@ class InstallationManagerMock extends InstallationManager public function install(RepositoryInterface $repo, InstallOperation $operation) { $this->installed[] = $operation->getPackage(); - $this->trace[] = (string) $operation; + $this->trace[] = strip_tags((string) $operation); $repo->addPackage(clone $operation->getPackage()); } public function update(RepositoryInterface $repo, UpdateOperation $operation) { $this->updated[] = array($operation->getInitialPackage(), $operation->getTargetPackage()); - $this->trace[] = (string) $operation; + $this->trace[] = strip_tags((string) $operation); $repo->removePackage($operation->getInitialPackage()); $repo->addPackage(clone $operation->getTargetPackage()); } @@ -72,7 +72,7 @@ class InstallationManagerMock extends InstallationManager public function uninstall(RepositoryInterface $repo, UninstallOperation $operation) { $this->uninstalled[] = $operation->getPackage(); - $this->trace[] = (string) $operation; + $this->trace[] = strip_tags((string) $operation); $repo->removePackage($operation->getPackage()); } @@ -81,7 +81,7 @@ class InstallationManagerMock extends InstallationManager $package = $operation->getPackage(); $this->installed[] = $package; - $this->trace[] = (string) $operation; + $this->trace[] = strip_tags((string) $operation); parent::markAliasInstalled($repo, $operation); } @@ -89,7 +89,7 @@ class InstallationManagerMock extends InstallationManager public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation) { $this->uninstalled[] = $operation->getPackage(); - $this->trace[] = (string) $operation; + $this->trace[] = strip_tags((string) $operation); parent::markAliasUninstalled($repo, $operation); }