Skip to content

Commit

Permalink
Improve logs by showing original and updated versions of modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Quetzacoalt91 committed Sep 4, 2024
1 parent 02f23b8 commit 43fe833
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion classes/UpgradeTools/Module/ModuleDownloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ private function attemptDownload(ModuleDownloaderContext $moduleDownloaderContex
$this->assertDownloadedContentsIsValid($destinationPath);
$moduleDownloaderContext->setPathToModuleUpdate($destinationPath);

$this->logger->notice($this->translator->trans('Module %s update files have been fetched from %s.', [$moduleDownloaderContext->getModuleName(), $moduleSource->getPath()]));
$this->logger->notice($this->translator->trans('Module %s update files (%s => %s) have been fetched from %s.', [
$moduleDownloaderContext->getModuleName(),
$moduleDownloaderContext->getReferenceVersion(),
$moduleSource->getNewVersion(),
$moduleSource->getPath(),
]));
}

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/UpgradeTools/Module/ModuleDownloaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function testModuleDownloaderSucceedsOnFirstTryWithLocalFile()

$this->logger->expects($this->once())
->method('notice')
->with('Module mymodule update files have been fetched from ' . realpath(__DIR__ . '/../../../fixtures/mymodule') . '.');
->with('Module mymodule update files (1.0.0 => 2.0.0) have been fetched from ' . realpath(__DIR__ . '/../../../fixtures/mymodule') . '.');

$this->moduleDownloader->downloadModule($moduleContext);

Expand All @@ -93,7 +93,7 @@ public function testModuleDownloaderSucceedsOnFirstTryWithRemoteFile()

$this->logger->expects($this->once())
->method('notice')
->with('Module autoupgrade update files have been fetched from https://github.com/PrestaShop/autoupgrade/releases/download/v6.0.0/autoupgrade-v6.0.0.zip.');
->with('Module autoupgrade update files (1.0.0 => 6.0.0) have been fetched from https://github.com/PrestaShop/autoupgrade/releases/download/v6.0.0/autoupgrade-v6.0.0.zip.');

$this->moduleDownloader->downloadModule($moduleContext);
}
Expand Down Expand Up @@ -143,7 +143,7 @@ public function testModuleDownloaderHandlesFallbacks()
);
$this->logger->expects($this->once())
->method('notice')
->with('Module mymodule update files have been fetched from ' . realpath(__DIR__ . '/../../../fixtures/mymodule') . '.');
->with('Module mymodule update files (1.0.0 => 2.0.0) have been fetched from ' . realpath(__DIR__ . '/../../../fixtures/mymodule') . '.');

$this->moduleDownloader->downloadModule($moduleContext);
}
Expand Down

0 comments on commit 43fe833

Please sign in to comment.