From c9f2797a68bca589a5b8cc4a5f684107d80e9102 Mon Sep 17 00:00:00 2001 From: Matias Montes Date: Sun, 11 Jun 2017 13:38:22 -0300 Subject: [PATCH 1/2] Handling CLI error as a failure when validating composer.json file --- .../testsuite/Magento/Test/Integrity/ComposerTest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php index e6a036487fc5a..18a27eb1a81f6 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php @@ -99,7 +99,12 @@ private function validateComposerJsonFile($path) /** @var \Magento\Framework\Composer\MagentoComposerApplicationFactory $appFactory */ $appFactory = self::$objectManager->get(\Magento\Framework\Composer\MagentoComposerApplicationFactory::class); $app = $appFactory->create(); - $app->runComposerCommand(['command' => 'validate'], $path); + + try { + $app->runComposerCommand(['command' => 'validate'], $path); + } catch (\RuntimeException $exception) { + $this->fail("Failed validation of {$path}"); + } } /** From 729cedf10ca0dc662cb72ec4363b743087abc636 Mon Sep 17 00:00:00 2001 From: Matias Montes Date: Sun, 11 Jun 2017 15:55:44 -0300 Subject: [PATCH 2/2] Using Command output as message which actually provides more information for debugging than just the path --- .../static/testsuite/Magento/Test/Integrity/ComposerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php index 18a27eb1a81f6..04e440154e96c 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php @@ -103,7 +103,7 @@ private function validateComposerJsonFile($path) try { $app->runComposerCommand(['command' => 'validate'], $path); } catch (\RuntimeException $exception) { - $this->fail("Failed validation of {$path}"); + $this->fail($exception->getMessage()); } }