);
$pkg->setLicense('REPLACE', 'REPLACE');
$pkg->setNotes('* Initial release.');
- $pkg->clearContents();
+ $pkg->clearContents(true);
$pkg->clearDeps();
$pkg->setPhpDep('5.2.0');
$pkg->setPearinstallerDep('1.9.0');
$pkg->setPackageType('php');
+ $pkg->addFile('', 'something', array('role' => 'php'));
new PEAR_Validate();
return Components_Exception_Pear::catchError(
$pkg->getDefaultGenerator()
$updated = $package->getContents();
$updated = $updated['dir']['file'];
foreach ($updated as $file) {
+ if (!isset($file['attribs'])) {
+ continue;
+ }
if (isset($taskfiles[$file['attribs']['name']])) {
foreach ($taskfiles[$file['attribs']['name']] as $tag => $raw) {
$taskname = $package->getTask($tag) . '_rw';
$horde_role = false;
foreach ($files as $file) {
+ if (!isset($file['attribs'])) {
+ continue;
+ }
$components = explode('/', $file['attribs']['name'], 2);
switch ($components[0]) {
case 'doc':
/**
* @scenario
*/
+ public function theUOptionWillCreateANewPackageXmlInCaseItIsMissing()
+ {
+ $this->given('the default Components setup')
+ ->when('calling the package with the updatexml option and a path without package.xml')
+ ->then('a new package.xml will be created.');
+ }
+
+ /**
+ * @scenario
+ */
public function thePOptionFailsWithoutAValidDirectoryPath()
{
$this->given('the default Components setup')
);
$world['output'] = $this->_callUnstrictComponents();
break;
+ case 'calling the package with the updatexml option and a path without package.xml':
+ $temp = $this->_getTemporaryDirectory();
+ mkdir($temp . DIRECTORY_SEPARATOR . 'test');
+ file_put_contents(
+ $temp . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'test.php',
+ '<?php'
+ );
+ $_SERVER['argv'] = array(
+ 'horde-components',
+ '--updatexml',
+ $temp
+ );
+ $world['output'] = $this->_callUnstrictComponents();
+ break;
case 'calling the package with the pearrc, the packagexml option, and a Horde component':
$_SERVER['argv'] = array(
'horde-components',
$world['output']
);
break;
+ case 'a new package.xml will be created.':
+ $this->assertTrue(
+ file_exists($this->_temp_dir . DIRECTORY_SEPARATOR . 'package.xml')
+ );
+ break;
case 'a new PEAR configuration file will be installed':
$this->assertTrue(
file_exists($this->_temp_dir . DIRECTORY_SEPARATOR . '.pearrc')