From 18922c173577a3e2413507c793c46ae5c20a609b Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel
Date: Tue, 16 Nov 2010 23:09:35 +0100
Subject: [PATCH] Bug #9364: Components notices and fatal error
---
.../lib/Components/Pear/Package/Contents.php | 5 ++-
.../Components/Module/PearPackageXmlTest.php | 10 +++++
components/test/Components/StoryTestCase.php | 15 +++++++
.../test/Components/fixture/changelog/lib/Some.php | 1 +
.../test/Components/fixture/changelog/package.xml | 50 ++++++++++++++++++++++
5 files changed, 80 insertions(+), 1 deletion(-)
create mode 100644 components/test/Components/fixture/changelog/lib/Some.php
create mode 100644 components/test/Components/fixture/changelog/package.xml
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 @@
+
+