Skip to content

Commit

Permalink
Bug #9364: Components notices and fatal error
Browse files Browse the repository at this point in the history
  • Loading branch information
wrobel committed Nov 16, 2010
1 parent a662d52 commit 18922c1
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/lib/Components/Pear/Package/Contents.php
Expand Up @@ -114,7 +114,10 @@ public function update()
$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();
}
}
Expand Up @@ -143,6 +143,16 @@ public function thePOptionHeedsTheGitIgnoreFile()
->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:
Expand Down
15 changes: 15 additions & 0 deletions components/test/Components/StoryTestCase.php
Expand Up @@ -107,6 +107,15 @@ public function runWhen(&$world, $action, $arguments)
);
$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',
Expand Down Expand Up @@ -393,6 +402,12 @@ public function runThen(&$world, $action, $arguments)
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(
'#</changelog>#',
$world['output']
);
break;
case 'a new PEAR configuration file will be installed':
$this->assertTrue(
file_exists($this->_temp_dir . DIRECTORY_SEPARATOR . '.pearrc')
Expand Down
1 change: 1 addition & 0 deletions components/test/Components/fixture/changelog/lib/Some.php
@@ -0,0 +1 @@
<?php
50 changes: 50 additions & 0 deletions components/test/Components/fixture/changelog/package.xml
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<package packagerversion="1.9.0" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
<name>Fixture</name>
<channel>pear.php.net</channel>
<summary>Test fixture.</summary>
<description>A dummy package.xml used for testing the Components package.</description>
<lead>
<name>Gunnar Wrobel</name>
<user>wrobel</user>
<email>p@rdus.de</email>
<active>yes</active>
</lead>
<date>2010-08-22</date>
<time>21:12:03</time>
<version>
<release>0.0.1</release>
<api>0.0.1</api>
</version>
<stability>
<release>alpha</release>
<api>alpha</api>
</stability>
<license uri="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html">LGPL</license>
<notes>
* Initial release
</notes>
<contents>
<dir baseinstalldir="/" name="/">
<dir name="lib">
<file name="Some.php" role="php" />
</dir> <!-- /lib -->
</dir> <!-- / -->
</contents>
<dependencies>
<required>
<php>
<min>5.0.0</min>
</php>
<pearinstaller>
<min>1.7.0</min>
</pearinstaller>
</required>
</dependencies>
<phprelease>
<filelist>
<install as="Some.php" name="lib/Some.php" />
</filelist>
</phprelease>
<changelog/>
</package>

0 comments on commit 18922c1

Please sign in to comment.