From f309573d973b4748fe0b5ff8fdd5a42a0ed722bf Mon Sep 17 00:00:00 2001 From: Konrad Oboza Date: Fri, 28 May 2021 12:58:35 +0200 Subject: [PATCH] IBX-385: Fixed error handling when composer files are corrupted (#94) --- Resources/translations/dashboard.en.xlf | 4 +- .../themes/admin/dashboard/block/ez.html.twig | 2 +- .../Collector/EzSystemInfoCollector.php | 3 +- .../JsonComposerLockSystemInfoCollector.php | 9 + .../ComposerFileValidationException.php | 19 + .../ComposerJsonFileNotFoundException.php | 2 +- .../ComposerLockFileNotFoundException.php | 2 +- SystemInfo/Exception/SystemInfoException.php | 11 + SystemInfo/Value/InvalidSystemInfo.php | 22 ++ ...sonComposerLockSystemInfoCollectorTest.php | 35 +- .../_fixtures/corrupted_composer.json | 147 +++++++ .../_fixtures/corrupted_composer.lock | 372 ++++++++++++++++++ View/SystemInfoViewBuilder.php | 11 +- 13 files changed, 629 insertions(+), 10 deletions(-) create mode 100644 SystemInfo/Exception/ComposerFileValidationException.php create mode 100644 SystemInfo/Exception/SystemInfoException.php create mode 100644 SystemInfo/Value/InvalidSystemInfo.php create mode 100644 Tests/SystemInfo/Collector/_fixtures/corrupted_composer.json create mode 100644 Tests/SystemInfo/Collector/_fixtures/corrupted_composer.lock diff --git a/Resources/translations/dashboard.en.xlf b/Resources/translations/dashboard.en.xlf index 1e5e8143..70018151 100644 --- a/Resources/translations/dashboard.en.xlf +++ b/Resources/translations/dashboard.en.xlf @@ -73,9 +73,9 @@ key: dashboard.ez_version.non_stable_ee - composer.lock file. It's needed to determine information about + composer.lock or composer.json file, or the files are invalid. They are needed to determine information about your eZ install, and recommended to be kept on project development to make sure same package versions are used across all environments.]]> - composer.lock file. It's needed to determine information about + composer.lock or composer.json file or it's not valid. It's needed to determine information about your eZ install, and recommended to be kept on project development to make sure same package versions are used across all environments.]]> key: dashboard.ez_version.release_not_determined diff --git a/Resources/views/themes/admin/dashboard/block/ez.html.twig b/Resources/views/themes/admin/dashboard/block/ez.html.twig index c9a4598f..7d8e6078 100644 --- a/Resources/views/themes/admin/dashboard/block/ez.html.twig +++ b/Resources/views/themes/admin/dashboard/block/ez.html.twig @@ -16,7 +16,7 @@ {% set severity = 1 %}