From: Gunnar Wrobel Date: Tue, 12 Oct 2010 07:16:42 +0000 (+0200) Subject: Started refactoring the PearPackageXml handler. Refactored how PEAR element handlers... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=73bd4607f545d156457e50114cb9f743ce0a1547;p=horde.git Started refactoring the PearPackageXml handler. Refactored how PEAR element handlers are generated. Adapted testing. --- diff --git a/components/lib/Components/Dependencies.php b/components/lib/Components/Dependencies.php index 6e8797b13..c926bc3f5 100644 --- a/components/lib/Components/Dependencies.php +++ b/components/lib/Components/Dependencies.php @@ -67,6 +67,13 @@ interface Components_Dependencies public function getRunnerInstaller(); /** + * Returns the package XML handler for a package. + * + * @return Components_Runner_PearPackageXml The package XML handler. + */ + public function getRunnerPearPackageXml(); + + /** * Returns the output handler. * * @return Components_Output The output handler. diff --git a/components/lib/Components/Dependencies/Injector.php b/components/lib/Components/Dependencies/Injector.php index 0437ead89..69580593f 100644 --- a/components/lib/Components/Dependencies/Injector.php +++ b/components/lib/Components/Dependencies/Injector.php @@ -37,6 +37,7 @@ implements Components_Dependencies public function __construct() { parent::__construct(new Horde_Injector_TopLevel()); + $this->setInstance('Components_Dependencies', $this); } /** @@ -92,6 +93,16 @@ implements Components_Dependencies } /** + * Returns the package XML handler for a package. + * + * @return Components_Runner_PearPackageXml The package XML handler. + */ + public function getRunnerPearPackageXml() + { + return $this->getInstance('Components_Runner_PearPackageXml'); + } + + /** * Returns the output handler. * * @return Components_Output The output handler. diff --git a/components/lib/Components/Module/PearPackageXml.php b/components/lib/Components/Module/PearPackageXml.php index 4fab5bcd0..3480dc998 100644 --- a/components/lib/Components/Module/PearPackageXml.php +++ b/components/lib/Components/Module/PearPackageXml.php @@ -28,7 +28,7 @@ * @link http://pear.horde.org/index.php?package=Components */ class Components_Module_PearPackageXml -implements Components_Module +extends Components_Module_Base { public function getOptionGroupTitle() { @@ -68,106 +68,7 @@ implements Components_Module $options = $config->getOptions(); if (!empty($options['packagexml']) || !empty($options['updatexml'])) { - $this->run($config); + $this->_dependencies->getRunnerPearPackageXml()->run(); } } - - public function run(Components_Config $config) - { - $arguments = $config->getArguments(); - $package_file = $arguments[0] . '/package.xml'; - - $pear = new PEAR(); - $pear->setErrorHandling(PEAR_ERROR_DIE); - - if (!isset($GLOBALS['_PEAR_Config_instance'])) { - $GLOBALS['_PEAR_Config_instance'] = false; - } - - $package = PEAR_PackageFileManager2::importOptions( - $package_file, - array( - 'packagedirectory' => $arguments[0], - 'filelistgenerator' => 'file', - 'clearcontents' => false, - 'clearchangelog' => false, - 'simpleoutput' => true, - 'ignore' => array('*~', 'conf.php', 'CVS/*'), - 'include' => '*', - 'dir_roles' => - array( - 'doc' => 'doc', - 'example' => 'doc', - 'js' => 'horde', - 'lib' => 'php', - 'migration' => 'data', - 'script' => 'script', - 'test' => 'test', - ), - ) - ); - - if ($package instanceOf PEAR_Error) { - throw new Components_Exception($package->getMessage()); - } - /** - * @todo: Looks like this throws away any tags we have in - * the content list. Needs to be fixed. - */ - $package->generateContents(); - - /** - * This is required to clear the - * section. - */ - $package->setPackageType('php'); - - $contents = $package->getContents(); - $files = $contents['dir']['file']; - - foreach ($files as $file) { - $components = explode('/', $file['attribs']['name'], 2); - switch ($components[0]) { - case 'doc': - case 'example': - case 'lib': - case 'test': - case 'data': - $package->addInstallAs( - $file['attribs']['name'], $components[1] - ); - break; - case 'js': - $package->addInstallAs( - $file['attribs']['name'], $file['attribs']['name'] - ); - break; - case 'migration': - $components = explode('/', $components[1]); - array_splice($components, count($components) - 1, 0, 'migration'); - $package->addInstallAs( - $file['attribs']['name'], implode('/', $components) - ); - break; - case 'script': - $filename = basename($file['attribs']['name']); - if (substr($filename, strlen($filename) - 4)) { - $filename = substr($filename, 0, strlen($filename) - 4); - } - $package->addInstallAs( - $file['attribs']['name'], $filename - ); - break; - } - } - - $options = $config->getOptions(); - if (!empty($options['packagexml'])) { - $package->debugPackageFile(); - } - if (!empty($options['updatexml'])) { - $package->writePackageFile(); - } - - } } diff --git a/components/lib/Components/Pear/Factory.php b/components/lib/Components/Pear/Factory.php new file mode 100644 index 000000000..6fed6c7eb --- /dev/null +++ b/components/lib/Components/Pear/Factory.php @@ -0,0 +1,81 @@ + + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Components + */ + +/** + * Components_Pear_Factory:: generates PEAR specific handlers. + * + * Copyright 2010 The Horde Project (http://www.horde.org/) + * + * See the enclosed file COPYING for license information (LGPL). If you + * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. + * + * @category Horde + * @package Components + * @author Gunnar Wrobel + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Components + */ +class Components_Pear_Factory +{ + /** + * The dependency broker. + * + * @param Component_Dependencies + */ + private $_dependencies; + + /** + * Constructor. + * + * @param Component_Dependencies $dependencies The dependency broker. + */ + public function __construct(Components_Dependencies $dependencies) + { + $this->_dependencies = $dependencies; + } + + /** + * Create a representation for a PEAR environment. + * + * @param string $config_file The path to the configuration file. + * + * @return NULL + */ + public function createInstallLocation($config_file) + { + $install_location = $this->_dependencies->getInstance('Components_Pear_InstallLocation'); + $install_location->setLocation( + dirname($config_file), + basename($config_file) + ); + return $install_location; + } + + /** + * Create a package representation for a specific PEAR environment. + * + * @param string $package_file The path of the package XML file. + * @param string $config_file The path to the configuration file. + * + * @return NULL + */ + public function createPackageForInstallLocation($package_file, $config_file) + { + $package = $this->_dependencies->getInstance('Components_Pear_Package'); + $package->setEnvironment($this->createInstallLocation($config_file)); + $package->setPackageXml($package_file); + return $package; + } + + +} \ No newline at end of file diff --git a/components/lib/Components/Pear/InstallLocation.php b/components/lib/Components/Pear/InstallLocation.php index 7b7b85049..d5ef10456 100644 --- a/components/lib/Components/Pear/InstallLocation.php +++ b/components/lib/Components/Pear/InstallLocation.php @@ -138,6 +138,11 @@ class Components_Pear_InstallLocation public function createPearConfig() { + if (empty($this->_config_file)) { + throw new Components_Exception( + 'Set the path to the PEAR environment first!' + ); + } if (file_exists($this->_config_file)) { throw new Components_Exception( sprintf( @@ -162,17 +167,21 @@ class Components_Pear_InstallLocation public function getPearConfig() { + if (!isset($GLOBALS['_PEAR_Config_instance'])) { + $GLOBALS['_PEAR_Config_instance'] = false; + } if (empty($this->_config_file)) { - throw new Components_Exception( - 'Set the path to the install location first!' - ); + $config = PEAR_Config::singleton(); + if (!$config->validConfiguration()) { + throw new Components_Exception( + 'Set the path to the PEAR environment first!' + ); + } + return $config; } if (!file_exists($this->_config_file)) { $this->createPearConfig(); } - if (!isset($GLOBALS['_PEAR_Config_instance'])) { - $GLOBALS['_PEAR_Config_instance'] = false; - } return PEAR_Config::singleton($this->_config_file); } diff --git a/components/lib/Components/Pear/Package.php b/components/lib/Components/Pear/Package.php index b14541403..cadd58074 100644 --- a/components/lib/Components/Pear/Package.php +++ b/components/lib/Components/Pear/Package.php @@ -42,6 +42,13 @@ class Components_Pear_Package private $_environment; /** + * The path to the package XML file. + * + * @param string + */ + private $_package_xml_path; + + /** * The package representation. * * @param PEAR_PackageFile_v2 @@ -86,18 +93,13 @@ class Components_Pear_Package /** * Define the package to work on. * - * @param string $package_xml_patch Path to the package.xml file. + * @param string $package_xml_path Path to the package.xml file. * * @return NULL */ - public function setPackage($package_xml_path) + public function setPackageXml($package_xml_path) { - $config = $this->getEnvironment()->getPearConfig(); - $pkg = new PEAR_PackageFile($config); - $this->_package_file = $pkg->fromPackageFile($package_xml_path, PEAR_VALIDATE_NORMAL); - if ($this->_package_file instanceOf PEAR_Error) { - throw new Components_Exception($this->_package_file->getMessage()); - } + $this->_package_xml_path = $package_xml_path; } /** @@ -107,10 +109,27 @@ class Components_Pear_Package */ public function getPackageFile() { - if ($this->_environment === null || $this->_package_file === null) { + if ($this->_environment === null || $this->_package_xml_path === null) { throw new Components_Exception('You need to set the environment and the path to the package file first!'); } + if ($this->_package_file === null) { + $config = $this->getEnvironment()->getPearConfig(); + $pkg = new PEAR_PackageFile($config); + $this->_package_file = $pkg->fromPackageFile($this->_package_xml_path, PEAR_VALIDATE_NORMAL); + if ($this->_package_file instanceOf PEAR_Error) { + throw new Components_Exception($this->_package_file->getMessage()); + } + } return $this->_package_file; } + /** + * Return the description for this package. + * + * @return string The package description. + */ + public function getDescription() + { + return $this->getPackageFile()->getDescription(); + } } diff --git a/components/lib/Components/Runner/CiPrebuild.php b/components/lib/Components/Runner/CiPrebuild.php index b805f8313..88025d1d3 100644 --- a/components/lib/Components/Runner/CiPrebuild.php +++ b/components/lib/Components/Runner/CiPrebuild.php @@ -44,83 +44,66 @@ class Components_Runner_CiPrebuild private $_config_application; /** - * The package handler. + * The factory for PEAR handlers. * - * @var Components_Pear_Package + * @var Components_Factory */ - private $_package; + private $_factory; /** * Constructor. * - * @param Components_Config $config The configuration for the - * current job. - * @param Components_Config_Application $cfgapp The application - * configuration. - * @param Components_Pear_InstallLocation $location Represents the install - * location and its - * corresponding configuration. - * @param Components_Pear_Package $package Package handler. + * @param Components_Config $config The configuration for the + * current job. + * @param Components_Config_Application $cfgapp The application + * configuration. + * @param Components_Pear_Factory $factory Generator for all + * required PEAR components. */ public function __construct( Components_Config $config, Components_Config_Application $cfgapp, - Components_Pear_InstallLocation $location, - Components_Pear_Package $package + Components_Pear_Factory $factory ) { $this->_config = $config; $this->_config_application = $cfgapp; - $this->_location = $location; - $this->_package = $package; + $this->_factory = $factory; } public function run() { $options = $this->_config->getOptions(); $arguments = $this->_config->getArguments(); - $pkgfile = $arguments[0] . DIRECTORY_SEPARATOR . 'package.xml'; - $name = basename($arguments[0]); - if (basename(dirname($arguments[0])) == 'framework') { - $origin = 'framework' . DIRECTORY_SEPARATOR . $name; - } else { - $origin = $name; - } - $test_path = strtr($name, '_', '/'); if (!isset($options['toolsdir'])) { - $options['toolsdir'] = 'php-hudson-tools/workspace/pear/pear'; - } - if (!isset($options['pearrc'])) { throw new Components_Exception( - 'You are required to set the path to a PEAR environment for this package' + 'You are required to set the path to a PEAR tool environment.' ); } - $this->_location->setLocation( - dirname($options['pearrc']), - basename($options['pearrc']) - ); - $this->_package->setEnvironment($this->_location); - $this->_package->setPackage($pkgfile); - $description = $this->_package->getPackageFile()->getDescription(); - - $in = file_get_contents( - $this->_config_application->getTemplateDirectory() - . DIRECTORY_SEPARATOR . 'hudson-component-build.xml.template', - 'r' - ); file_put_contents( $options['ciprebuild'] . DIRECTORY_SEPARATOR . 'build.xml', - sprintf($in, $options['toolsdir']) - ); - $in = file_get_contents( - $this->_config_application->getTemplateDirectory() - . DIRECTORY_SEPARATOR . 'hudson-component-phpunit.xml.template', - 'r' + sprintf( + file_get_contents( + $this->_config_application->getTemplateDirectory() + . DIRECTORY_SEPARATOR . 'hudson-component-build.xml.template', + 'r' + ), + $options['toolsdir'] + ) ); + file_put_contents( $options['ciprebuild'] . DIRECTORY_SEPARATOR . 'phpunit.xml', - sprintf($in, $name, $test_path) + sprintf( + file_get_contents( + $this->_config_application->getTemplateDirectory() + . DIRECTORY_SEPARATOR . 'hudson-component-phpunit.xml.template', + 'r' + ), + basename($arguments[0]), + strtr(basename($arguments[0]), '_', '/') + ) ); } } diff --git a/components/lib/Components/Runner/CiSetup.php b/components/lib/Components/Runner/CiSetup.php index 190c822af..732f493e1 100644 --- a/components/lib/Components/Runner/CiSetup.php +++ b/components/lib/Components/Runner/CiSetup.php @@ -44,51 +44,41 @@ class Components_Runner_CiSetup private $_config_application; /** - * The package handler. + * The factory for PEAR handlers. * - * @var Components_Pear_Package + * @var Components_Factory */ - private $_package; + private $_factory; /** * Constructor. * - * @param Components_Config $config The configuration for the - * current job. - * @param Components_Config_Application $cfgapp The application - * configuration. - * @param Components_Pear_InstallLocation $location Represents the install - * location and its - * corresponding configuration. - * @param Components_Pear_Package $package Package handler. + * @param Components_Config $config The configuration for the + * current job. + * @param Components_Config_Application $cfgapp The application + * configuration. + * @param Components_Pear_Factory $factory Generator for all + * required PEAR components. */ public function __construct( Components_Config $config, Components_Config_Application $cfgapp, - Components_Pear_InstallLocation $location, - Components_Pear_Package $package + Components_Pear_Factory $factory ) { $this->_config = $config; $this->_config_application = $cfgapp; - $this->_location = $location; - $this->_package = $package; + $this->_factory = $factory; } public function run() { $options = $this->_config->getOptions(); $arguments = $this->_config->getArguments(); - $pkgfile = $arguments[0] . DIRECTORY_SEPARATOR . 'package.xml'; - $name = basename($arguments[0]); - if (basename(dirname($arguments[0])) == 'framework') { - $origin = 'framework' . DIRECTORY_SEPARATOR . $name; - } else { - $origin = $name; - } - $test_path = strtr($name, '_', '/'); if (!isset($options['toolsdir'])) { - $options['toolsdir'] = 'php-hudson-tools/workspace/pear/pear'; + throw new Components_Exception( + 'You are required to set the path to a PEAR tool environment.' + ); } if (!isset($options['pearrc'])) { throw new Components_Exception( @@ -96,22 +86,28 @@ class Components_Runner_CiSetup ); } - $this->_location->setLocation( - dirname($options['pearrc']), - basename($options['pearrc']) - ); - $this->_package->setEnvironment($this->_location); - $this->_package->setPackage($pkgfile); - $description = $this->_package->getPackageFile()->getDescription(); + if (basename(dirname($arguments[0])) == 'framework') { + $origin = 'framework' . DIRECTORY_SEPARATOR . basename($arguments[0]); + } else { + $origin = basename($arguments[0]); + } - $in = file_get_contents( - $this->_config_application->getTemplateDirectory() - . DIRECTORY_SEPARATOR . 'hudson-component-config.xml.template', - 'r' - ); file_put_contents( $options['cisetup'] . DIRECTORY_SEPARATOR . 'config.xml', - sprintf($in, $origin, 'horde', $options['toolsdir'], $description) + sprintf( + file_get_contents( + $this->_config_application->getTemplateDirectory() + . DIRECTORY_SEPARATOR . 'hudson-component-config.xml.template', + 'r' + ), + $origin, + 'horde', + $options['toolsdir'], + $this->_factory->createPackageForInstallLocation( + $arguments[0] . DIRECTORY_SEPARATOR . 'package.xml', + $options['pearrc'] + )->getDescription() + ) ); } } diff --git a/components/lib/Components/Runner/PearPackageXml.php b/components/lib/Components/Runner/PearPackageXml.php new file mode 100644 index 000000000..036d782b0 --- /dev/null +++ b/components/lib/Components/Runner/PearPackageXml.php @@ -0,0 +1,158 @@ + + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Components + */ + +/** + * Components_Runner_PearPackageXml:: updates the package.xml of a Horde + * component. + * + * Copyright 2010 The Horde Project (http://www.horde.org/) + * + * See the enclosed file COPYING for license information (LGPL). If you + * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. + * + * @category Horde + * @package Components + * @author Gunnar Wrobel + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Components + */ +class Components_Runner_PearPackageXml +{ + /** + * The configuration for the current job. + * + * @var Components_Config + */ + private $_config; + + /** + * The package handler. + * + * @var Components_Pear_Package + */ + private $_package; + + /** + * Constructor. + * + * @param Components_Config $config The configuration for the current job. + * @param Components_Pear_Package $package Package handler. + */ + public function __construct( + Components_Config $config, + Components_Pear_Package $package + ) { + $this->_config = $config; + $this->_package = $package; + } + + public function run() + { + $arguments = $this->_config->getArguments(); + $package_file = $arguments[0] . '/package.xml'; + + $pear = new PEAR(); + $pear->setErrorHandling(PEAR_ERROR_DIE); + + if (!isset($GLOBALS['_PEAR_Config_instance'])) { + $GLOBALS['_PEAR_Config_instance'] = false; + } + + $package = PEAR_PackageFileManager2::importOptions( + $package_file, + array( + 'packagedirectory' => $arguments[0], + 'filelistgenerator' => 'file', + 'clearcontents' => false, + 'clearchangelog' => false, + 'simpleoutput' => true, + 'ignore' => array('*~', 'conf.php', 'CVS/*'), + 'include' => '*', + 'dir_roles' => + array( + 'doc' => 'doc', + 'example' => 'doc', + 'js' => 'horde', + 'lib' => 'php', + 'migration' => 'data', + 'script' => 'script', + 'test' => 'test', + ), + ) + ); + + if ($package instanceOf PEAR_Error) { + throw new Components_Exception($package->getMessage()); + } + /** + * @todo: Looks like this throws away any tags we have in + * the content list. Needs to be fixed. + */ + $package->generateContents(); + + /** + * This is required to clear the + * section. + */ + $package->setPackageType('php'); + + $contents = $package->getContents(); + $files = $contents['dir']['file']; + + foreach ($files as $file) { + $components = explode('/', $file['attribs']['name'], 2); + switch ($components[0]) { + case 'doc': + case 'example': + case 'lib': + case 'test': + case 'data': + $package->addInstallAs( + $file['attribs']['name'], $components[1] + ); + break; + case 'js': + $package->addInstallAs( + $file['attribs']['name'], $file['attribs']['name'] + ); + break; + case 'migration': + $components = explode('/', $components[1]); + array_splice($components, count($components) - 1, 0, 'migration'); + $package->addInstallAs( + $file['attribs']['name'], implode('/', $components) + ); + break; + case 'script': + $filename = basename($file['attribs']['name']); + if (substr($filename, strlen($filename) - 4)) { + $filename = substr($filename, 0, strlen($filename) - 4); + } + $package->addInstallAs( + $file['attribs']['name'], $filename + ); + break; + } + } + + $options = $this->_config->getOptions(); + if (!empty($options['packagexml'])) { + $package->debugPackageFile(); + } + if (!empty($options['updatexml'])) { + $package->writePackageFile(); + } + + } +} diff --git a/components/test/Components/Integration/Components/Module/CiSetupTest.php b/components/test/Components/Integration/Components/Module/CiSetupTest.php index 9f292ffed..596093124 100644 --- a/components/test/Components/Integration/Components/Module/CiSetupTest.php +++ b/components/test/Components/Integration/Components/Module/CiSetupTest.php @@ -58,7 +58,7 @@ extends Components_StoryTestCase /** * @scenario */ - public function theCisetupOptionsFailsWithoutAValidPearrcOption() + public function theCisetupOptionsFailsWithoutAValidToolsdirOption() { $this->given('the default Components setup') ->when( @@ -66,6 +66,20 @@ extends Components_StoryTestCase 'test', dirname(dirname(dirname(dirname(__FILE__)))) . '/fixture/simple' ) + ->then('the call will fail with', 'You are required to set the path to a PEAR tool environment.'); + } + + /** + * @scenario + */ + public function theCisetupOptionsFailsWithoutAValidPearrcOption() + { + $this->given('the default Components setup') + ->when( + 'calling the package with the cisetup, toolsdir options and path', + 'test', + dirname(dirname(dirname(dirname(__FILE__)))) . '/fixture/simple' + ) ->then('the call will fail with', 'You are required to set the path to a PEAR environment for this package'); } @@ -76,7 +90,7 @@ extends Components_StoryTestCase { $this->given('the default Components setup') ->when( - 'calling the package with the cisetup, pearrc options and path', + 'calling the package with the cisetup, toolsdir, pearrc options and path', dirname(dirname(dirname(dirname(__FILE__)))) . '/fixture/simple' ) ->then('the CI configuration will be installed.'); @@ -85,11 +99,24 @@ extends Components_StoryTestCase /** * @scenario */ - public function theCisetupOptionCreatesATemplateBaseCiBuildScriptForAComponent() + public function theCiprebuildOptionsFailsWithoutAValidToolsdirOption() + { + $this->given('the default Components setup') + ->when( + 'calling the package with the ciprebuild option and path', + dirname(dirname(dirname(dirname(__FILE__)))) . '/fixture/simple' + ) + ->then('the call will fail with', 'You are required to set the path to a PEAR tool environment.'); + } + + /** + * @scenario + */ + public function theCiprebuildOptionCreatesATemplateBaseCiBuildScriptForAComponent() { $this->given('the default Components setup') ->when( - 'calling the package with the ciprebuild, pearrc options and path', + 'calling the package with the ciprebuild, toolsdir option and path', dirname(dirname(dirname(dirname(__FILE__)))) . '/fixture/simple' ) ->then('the CI build script will be installed.'); @@ -102,7 +129,7 @@ extends Components_StoryTestCase { $this->given('the default Components setup') ->when( - 'calling the package with the cisetup, pearrc, template options and path', + 'calling the package with the cisetup, toolsdir, pearrc, template options and path', dirname(dirname(dirname(dirname(__FILE__)))) . '/fixture/simple' ) ->then('the CI configuration will be installed according to the specified template.'); @@ -115,7 +142,7 @@ extends Components_StoryTestCase { $this->given('the default Components setup') ->when( - 'calling the package with the ciprebuild, pearrc, template options and path', + 'calling the package with the ciprebuild, toolsdir, template options and path', dirname(dirname(dirname(dirname(__FILE__)))) . '/fixture/simple' ) ->then('the CI build script will be installed according to the specified template.'); diff --git a/components/test/Components/StoryTestCase.php b/components/test/Components/StoryTestCase.php index 6d8484052..6fab17d5b 100644 --- a/components/test/Components/StoryTestCase.php +++ b/components/test/Components/StoryTestCase.php @@ -100,43 +100,64 @@ extends PHPUnit_Extensions_Story_TestCase ); $world['output'] = $this->_callStrictComponents(); break; - case 'calling the package with the cisetup, pearrc options and path': + case 'calling the package with the cisetup, toolsdir options and path': + $tmp = $this->_getTemporaryDirectory(); + $_SERVER['argv'] = array( + 'horde-components', + '--toolsdir=/DUMMY_TOOLS', + '--cisetup=' . $arguments[0], + $arguments[1] + ); + $world['output'] = $this->_callUnstrictComponents(); + break; + case 'calling the package with the cisetup, toolsdir, pearrc options and path': $tmp = $this->_getTemporaryDirectory(); $_SERVER['argv'] = array( 'horde-components', '--cisetup=' . $tmp, + '--toolsdir=/DUMMY_TOOLS', '--pearrc=' . $tmp . DIRECTORY_SEPARATOR . '.pearrc', $arguments[0] ); $world['output'] = $this->_callUnstrictComponents(); break; - case 'calling the package with the ciprebuild, pearrc options and path': + case 'calling the package with the ciprebuild option and path': $tmp = $this->_getTemporaryDirectory(); $_SERVER['argv'] = array( 'horde-components', '--ciprebuild=' . $tmp, - '--pearrc=' . $tmp . DIRECTORY_SEPARATOR . '.pearrc', $arguments[0] ); $world['output'] = $this->_callUnstrictComponents(); break; - case 'calling the package with the cisetup, pearrc, template options and path': + case 'calling the package with the ciprebuild, toolsdir option and path': + $tmp = $this->_getTemporaryDirectory(); + $_SERVER['argv'] = array( + 'horde-components', + '--ciprebuild=' . $tmp, + '--toolsdir=/DUMMY_TOOLS', + $arguments[0] + ); + $world['output'] = $this->_callUnstrictComponents(); + break; + case 'calling the package with the cisetup, toolsdir, pearrc, template options and path': $tmp = $this->_getTemporaryDirectory(); $_SERVER['argv'] = array( 'horde-components', '--cisetup=' . $tmp, + '--toolsdir=/DUMMY_TOOLS', '--pearrc=' . $tmp . DIRECTORY_SEPARATOR . '.pearrc', '--templatedir=' . dirname(__FILE__) . '/fixture/templates', $arguments[0] ); $world['output'] = $this->_callUnstrictComponents(); break; - case 'calling the package with the ciprebuild, pearrc, template options and path': + case 'calling the package with the ciprebuild, toolsdir, template options and path': $tmp = $this->_getTemporaryDirectory(); $_SERVER['argv'] = array( 'horde-components', '--ciprebuild=' . $tmp, - '--pearrc=' . $tmp . DIRECTORY_SEPARATOR . '.pearrc', + '--toolsdir=/DUMMY_TOOLS', '--templatedir=' . dirname(__FILE__) . '/fixture/templates', $arguments[0] );