From 2fed8c7f93292613f5bab40f1169d76de8655cd0 Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel Date: Thu, 25 Nov 2010 15:24:41 +0100 Subject: [PATCH] Ensure we get a decent display about the package.xml problems. --- components/lib/Components/Pear/Package.php | 25 +++++++++++++++++----- .../Components/Module/DevPackageTest.php | 3 ++- components/test/Components/StoryTestCase.php | 10 ++++++++- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/components/lib/Components/Pear/Package.php b/components/lib/Components/Pear/Package.php index de24a01de..b99b23670 100644 --- a/components/lib/Components/Pear/Package.php +++ b/components/lib/Components/Pear/Package.php @@ -357,16 +357,31 @@ class Components_Pear_Package $pkg->_packageInfo['version']['release'] = $version; $pkg->setDate(date('Y-m-d')); $pkg->setTime(date('H:i:s')); + $errors = array(); ob_start(); $old_dir = getcwd(); chdir($archive_dir); - $result = Components_Exception_Pear::catchError( - $pkg->getDefaultGenerator() - ->toTgz(new PEAR_Common()) - ); + try { + $result = Components_Exception_Pear::catchError( + $pkg->getDefaultGenerator()->toTgz(new PEAR_Common()) + ); + } catch (Components_Exception_Pear $e) { + $errors[] = $e->getMessage(); + $errors[] = ''; + $result = false; + foreach ($pkg->getValidationWarnings() as $error) { + $errors[] = isset($error['message']) ? $error['message'] : 'Unknown Error'; + } + } chdir($old_dir); $this->_output->pear(ob_get_clean()); - $this->_output->ok('Generated snapshot ' . $result); + if ($result) { + $this->_output->ok('Generated snapshot ' . $result); + } else { + $this->_output->fail( + 'Generating snapshot failed with:'. "\n\n" . join("\n", $errors) + ); + } return $result; } diff --git a/components/test/Components/Integration/Components/Module/DevPackageTest.php b/components/test/Components/Integration/Components/Module/DevPackageTest.php index 4380eb2fb..f75e2466c 100644 --- a/components/test/Components/Integration/Components/Module/DevPackageTest.php +++ b/components/test/Components/Integration/Components/Module/DevPackageTest.php @@ -62,6 +62,7 @@ extends Components_StoryTestCase { $this->given('the default Components setup') ->when('calling the package with the devpackage option, the archive directory option and a path to an invalid Horde framework component') - ->then('the output should indicate an invalid package.xml'); + ->then('the output should indicate an invalid package.xml') + ->and('indicate the specific problem of the package.xml'); } } \ No newline at end of file diff --git a/components/test/Components/StoryTestCase.php b/components/test/Components/StoryTestCase.php index 3706d2fc2..9ba58e5a7 100644 --- a/components/test/Components/StoryTestCase.php +++ b/components/test/Components/StoryTestCase.php @@ -621,6 +621,12 @@ extends PHPUnit_Extensions_Story_TestCase $world['output'] ); break; + case 'indicate the specific problem of the package.xml': + $this->assertContains( + 'Old.php" in package.xml does not exist', + $world['output'] + ); + break; default: return $this->notImplemented($action); } @@ -679,7 +685,8 @@ extends PHPUnit_Extensions_Story_TestCase private function _callUnstrict(array $parameters) { - $old_errorreporting = error_reporting(E_ALL & ~E_STRICT); + $old_errorreporting = error_reporting(E_ALL & ~(E_STRICT | E_DEPRECATED)); + error_reporting(E_ALL & ~(E_STRICT | E_DEPRECATED)); $this->_callStrict($parameters); error_reporting($old_errorreporting); } @@ -695,5 +702,6 @@ extends PHPUnit_Extensions_Story_TestCase '*' => false, ); $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER'] = false; + $GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'] = array(); } } \ No newline at end of file -- 2.11.0