From: Gunnar Wrobel Date: Tue, 16 Nov 2010 22:09:35 +0000 (+0100) Subject: Bug #9364: Components notices and fatal error X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=18922c173577a3e2413507c793c46ae5c20a609b;p=horde.git Bug #9364: Components notices and fatal error --- diff --git a/components/lib/Components/Pear/Package/Contents.php b/components/lib/Components/Pear/Package/Contents.php index 2c03805b8..9131a6334 100644 --- a/components/lib/Components/Pear/Package/Contents.php +++ b/components/lib/Components/Pear/Package/Contents.php @@ -114,7 +114,10 @@ class Components_Pear_Package_Contents $this->getPackage()->_getSimpleDirTag($this->getPackage()->_struc); $this->_tasks->annotate($this->getPackage(), $taskfiles); - + // Workaround for [#9364] Components notices and fatal error + if ($this->getPackage()->_packageInfo['changelog'] == '') { + unset($this->getPackage()->_packageInfo['changelog']); + } $this->_filelist_factory->create($this->getPackage())->update(); } } \ No newline at end of file diff --git a/components/test/Components/Integration/Components/Module/PearPackageXmlTest.php b/components/test/Components/Integration/Components/Module/PearPackageXmlTest.php index 8e334bbf8..b90ac671e 100644 --- a/components/test/Components/Integration/Components/Module/PearPackageXmlTest.php +++ b/components/test/Components/Integration/Components/Module/PearPackageXmlTest.php @@ -143,6 +143,16 @@ extends Components_StoryTestCase ->and('the new package.xml of the Horde component will contain the file', 'test2'); } + /** + * @scenario + */ + public function testEmptyChangelog() + { + $this->given('the default Components setup') + ->when('calling the package with the packagexml option and a component with empty changelog') + ->then('the new package.xml of the Horde component will have a changelog entry'); + } + /** * @todo Test (and fix) the reactions to three more scenarios: diff --git a/components/test/Components/StoryTestCase.php b/components/test/Components/StoryTestCase.php index a92fabdbd..3706d2fc2 100644 --- a/components/test/Components/StoryTestCase.php +++ b/components/test/Components/StoryTestCase.php @@ -107,6 +107,15 @@ extends PHPUnit_Extensions_Story_TestCase ); $world['output'] = $this->_callUnstrictComponents(); break; + case 'calling the package with the packagexml option and a component with empty changelog': + $_SERVER['argv'] = array( + 'horde-components', + '--pearrc=' . $this->_getTemporaryDirectory() . DIRECTORY_SEPARATOR . '.pearrc', + '--packagexml', + dirname(__FILE__) . '/fixture/changelog' + ); + $world['output'] = $this->_callUnstrictComponents(); + break; case 'calling the package with the packagexml option and the path': $_SERVER['argv'] = array( 'horde-components', @@ -393,6 +402,12 @@ extends PHPUnit_Extensions_Story_TestCase file_exists($this->_temp_dir . DIRECTORY_SEPARATOR . 'package.xml') ); break; + case 'the new package.xml of the Horde component will have a changelog entry': + $this->assertRegExp( + '##', + $world['output'] + ); + break; case 'a new PEAR configuration file will be installed': $this->assertTrue( file_exists($this->_temp_dir . DIRECTORY_SEPARATOR . '.pearrc') diff --git a/components/test/Components/fixture/changelog/lib/Some.php b/components/test/Components/fixture/changelog/lib/Some.php new file mode 100644 index 000000000..a81436628 --- /dev/null +++ b/components/test/Components/fixture/changelog/lib/Some.php @@ -0,0 +1 @@ + + + Fixture + pear.php.net + Test fixture. + A dummy package.xml used for testing the Components package. + + Gunnar Wrobel + wrobel + p@rdus.de + yes + + 2010-08-22 + + + 0.0.1 + 0.0.1 + + + alpha + alpha + + LGPL + +* Initial release + + + + + + + + + + + + 5.0.0 + + + 1.7.0 + + + + + + + + + +