From: Gunnar Wrobel Date: Mon, 6 Sep 2010 06:38:58 +0000 (+0200) Subject: Element -> Components for the different classes. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=8ccc70ff19b1f0670baec9e42f1c22f0ee443bc8;p=horde.git Element -> Components for the different classes. --- diff --git a/components/lib/Components.php b/components/lib/Components.php index 70816d7d1..e96b5b21c 100644 --- a/components/lib/Components.php +++ b/components/lib/Components.php @@ -1,20 +1,20 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ /** - * The Horde_Element:: class is the entry point for the various Horde - * element actions provided by the package. + * The Components:: class is the entry point for the various component actions + * provided by the package. * * Copyright 2010 The Horde Project (http://www.horde.org/) * @@ -22,12 +22,12 @@ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @category Horde - * @package Element + * @package Components * @author Gunnar Wrobel * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ -class Horde_Element +class Components { /** * The main entry point for the application. @@ -47,7 +47,7 @@ class Horde_Element $config->handleModules($modules); try { self::_validateArguments($config); - } catch (Horde_Element_Exception $e) { + } catch (Components_Exception $e) { $parser->parserError($e->getMessage()); return; } @@ -72,9 +72,9 @@ class Horde_Element static private function _prepareConfig(Horde_Argv_Parser $parser) { - $config = new Horde_Element_Configs(); + $config = new Components_Configs(); $config->addConfigurationType( - new Horde_Element_Config_Cli( + new Components_Config_Cli( $parser ) ); @@ -83,24 +83,24 @@ class Horde_Element static private function _prepareModules() { - $modules = new Horde_Element_Modules(); - $modules->addModulesFromDirectory(dirname(__FILE__) . '/Element/Module'); + $modules = new Components_Modules(); + $modules->addModulesFromDirectory(dirname(__FILE__) . '/Components/Module'); return $modules; } - static private function _validateArguments(Horde_Element_Config $config) + static private function _validateArguments(Components_Config $config) { $arguments = $config->getArguments(); if (empty($arguments[0])) { - throw new Horde_Element_Exception('Please specify the path of the PEAR package!'); + throw new Components_Exception('Please specify the path of the PEAR package!'); } if (!is_dir($arguments[0])) { - throw new Horde_Element_Exception(sprintf('%s specifies no directory!', $arguments[0])); + throw new Components_Exception(sprintf('%s specifies no directory!', $arguments[0])); } if (!file_exists($arguments[0] . '/package.xml')) { - throw new Horde_Element_Exception(sprintf('There is no package.xml at %s!', $arguments[0])); + throw new Components_Exception(sprintf('There is no package.xml at %s!', $arguments[0])); } } } \ No newline at end of file diff --git a/components/lib/Components/Config.php b/components/lib/Components/Config.php index da22e4680..02c9dcfe3 100644 --- a/components/lib/Components/Config.php +++ b/components/lib/Components/Config.php @@ -1,19 +1,19 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ /** - * Horde_Element_Config:: interface represents a configuration type for the Horde + * Components_Config:: interface represents a configuration type for the Horde * element tool. * * Copyright 2009-2010 The Horde Project (http://www.horde.org/) @@ -22,20 +22,20 @@ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @category Horde - * @package Element + * @package Components * @author Gunnar Wrobel * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ -interface Horde_Element_Config +interface Components_Config { /** * Provide each configuration handler with the list of supported modules. * - * @param Horde_Element_Modules $modules A list of modules. + * @param Components_Modules $modules A list of modules. * @return NULL */ - public function handleModules(Horde_Element_Modules $modules); + public function handleModules(Components_Modules $modules); /** * Return the options provided by the configuration handlers. diff --git a/components/lib/Components/Config/Cli.php b/components/lib/Components/Config/Cli.php index 6f63f94a4..e5bec1003 100644 --- a/components/lib/Components/Config/Cli.php +++ b/components/lib/Components/Config/Cli.php @@ -1,19 +1,19 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ /** - * Horde_Element_Config_Cli:: class provides the command line interface for the Horde + * Components_Config_Cli:: class provides the command line interface for the Horde * element tool. * * Copyright 2009-2010 The Horde Project (http://www.horde.org/) @@ -22,13 +22,13 @@ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @category Horde - * @package Element + * @package Components * @author Gunnar Wrobel * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ -class Horde_Element_Config_Cli -implements Horde_Element_Config +class Components_Config_Cli +implements Components_Config { /** * The command line argument parser. @@ -64,10 +64,10 @@ implements Horde_Element_Config /** * Load the options for the list of supported modules. * - * @param Horde_Element_Modules $modules A list of modules. + * @param Components_Modules $modules A list of modules. * @return NULL */ - public function handleModules(Horde_Element_Modules $modules) + public function handleModules(Components_Modules $modules) { foreach ($modules as $module) { $this->_addOptionsFromModule($this->_parser, $module); @@ -100,7 +100,7 @@ implements Horde_Element_Config * Add an option group from the provided module to the parser. * * @param Horde_Argv_Parser $parser The parser. - * @param Horde_Element_Module $module The module providing the option group. + * @param Components_Module $module The module providing the option group. * * @return NULL */ diff --git a/components/lib/Components/Configs.php b/components/lib/Components/Configs.php index ee5a07203..c66d84f81 100644 --- a/components/lib/Components/Configs.php +++ b/components/lib/Components/Configs.php @@ -1,19 +1,19 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ /** - * Horde_Element_Configs:: class represents configuration for the + * Components_Configs:: class represents configuration for the * Horde element tool. * * Copyright 2009-2010 The Horde Project (http://www.horde.org/) @@ -22,13 +22,13 @@ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @category Horde - * @package Element + * @package Components * @author Gunnar Wrobel * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ -class Horde_Element_Configs -implements Horde_Element_Config +class Components_Configs +implements Components_Config { /** @@ -48,21 +48,21 @@ implements Horde_Element_Config /** * Add a configuration type to the configuration handler. * - * @param Horde_Element_Config $type The configuration type. + * @param Components_Config $type The configuration type. * * @return NULL */ - public function addConfigurationType(Horde_Element_Config $type) { + public function addConfigurationType(Components_Config $type) { $this->_configs[] = $type; } /** * Provide each configuration handler with the list of supported modules. * - * @param Horde_Element_Modules $modules A list of modules. + * @param Components_Modules $modules A list of modules. * @return NULL */ - public function handleModules(Horde_Element_Modules $modules) + public function handleModules(Components_Modules $modules) { foreach ($this->_configs as $config) { $config->handleModules($modules); diff --git a/components/lib/Components/Constants.php b/components/lib/Components/Constants.php index 42f8e9fa5..9cad1dc30 100644 --- a/components/lib/Components/Constants.php +++ b/components/lib/Components/Constants.php @@ -1,18 +1,18 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ /** - * Horde_Element_Constants:: provides the constants for this package. + * Components_Constants:: provides the constants for this package. * * Copyright 2010 The Horde Project (http://www.horde.org/) * @@ -20,12 +20,12 @@ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @category Horde - * @package Element + * @package Components * @author Gunnar Wrobel * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ -class Horde_Element_Constants +class Components_Constants { const DATA_DIR = '@data_dir@'; @@ -37,6 +37,6 @@ class Horde_Element_Constants array(dirname(__FILE__), '..', '..', '..', 'data') ); } - return self::DATA_DIR . DIRECTORY_SEPARATOR . 'Element'; + return self::DATA_DIR . DIRECTORY_SEPARATOR . 'Components'; } } diff --git a/components/lib/Components/Exception.php b/components/lib/Components/Exception.php index 115b70a88..f0a1043a2 100644 --- a/components/lib/Components/Exception.php +++ b/components/lib/Components/Exception.php @@ -1,18 +1,20 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ /** - * This class provides the standard error class for the Element package. + * This class provides the standard error class for the Components + * package. * * Copyright 2010 The Horde Project (http://www.horde.org/) * @@ -20,12 +22,12 @@ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @category Horde - * @package Element + * @package Components * @author Gunnar Wrobel * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ -class Horde_Element_Exception +class Components_Exception extends Exception { } diff --git a/components/lib/Components/Module.php b/components/lib/Components/Module.php index 43a98627d..b9ab72802 100644 --- a/components/lib/Components/Module.php +++ b/components/lib/Components/Module.php @@ -1,18 +1,18 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ /** - * Horde_Element_Module:: represents a task for a Horde element. + * Components_Module:: represents a task for a Horde component. * * Copyright 2010 The Horde Project (http://www.horde.org/) * @@ -20,12 +20,12 @@ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @category Horde - * @package Element + * @package Components * @author Gunnar Wrobel * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ -interface Horde_Element_Module +interface Components_Module { public function getOptionGroupTitle(); @@ -33,7 +33,7 @@ interface Horde_Element_Module public function getOptionGroupOptions(); - public function handle(Horde_Element_Config $config); + public function handle(Components_Config $config); - public function run(Horde_Element_Config $config); + public function run(Components_Config $config); } \ No newline at end of file diff --git a/components/lib/Components/Module/CiSetup.php b/components/lib/Components/Module/CiSetup.php index 786046675..e27d375ac 100644 --- a/components/lib/Components/Module/CiSetup.php +++ b/components/lib/Components/Module/CiSetup.php @@ -1,19 +1,19 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ /** - * Horde_Element_Module_CiSetup:: generates the configuration for Hudson based + * Components_Module_CiSetup:: generates the configuration for Hudson based * continuous integration of a Horde PEAR package. * * Copyright 2010 The Horde Project (http://www.horde.org/) @@ -22,13 +22,13 @@ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @category Horde - * @package Element + * @package Components * @author Gunnar Wrobel * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ -class Horde_Element_Module_CiSetup -implements Horde_Element_Module +class Components_Module_CiSetup +implements Components_Module { public function getOptionGroupTitle() { @@ -70,7 +70,7 @@ implements Horde_Element_Module ); } - public function handle(Horde_Element_Config $config) + public function handle(Components_Config $config) { $options = $config->getOptions(); if (!empty($options['cisetup']) | !empty($options['ciprebuild'])) { @@ -78,7 +78,7 @@ implements Horde_Element_Module } } - public function run(Horde_Element_Config $config) + public function run(Components_Config $config) { $options = $config->getOptions(); @@ -105,8 +105,8 @@ implements Horde_Element_Module if (!empty($options['cisetup'])) { $in = file_get_contents( - Horde_Element_Constants::getDataDirectory() - . DIRECTORY_SEPARATOR . 'hudson-element-config.xml.template', + Components_Constants::getDataDirectory() + . DIRECTORY_SEPARATOR . 'hudson-component-config.xml.template', 'r' ); file_put_contents( @@ -117,8 +117,8 @@ implements Horde_Element_Module if (!empty($options['ciprebuild'])) { $in = file_get_contents( - Horde_Element_Constants::getDataDirectory() - . DIRECTORY_SEPARATOR . 'hudson-element-build.xml.template', + Components_Constants::getDataDirectory() + . DIRECTORY_SEPARATOR . 'hudson-component-build.xml.template', 'r' ); file_put_contents( @@ -126,8 +126,8 @@ implements Horde_Element_Module sprintf($in, $options['toolsdir']) ); $in = file_get_contents( - Horde_Element_Constants::getDataDirectory() - . DIRECTORY_SEPARATOR . 'hudson-element-phpunit.xml.template', + Components_Constants::getDataDirectory() + . DIRECTORY_SEPARATOR . 'hudson-component-phpunit.xml.template', 'r' ); file_put_contents( diff --git a/components/lib/Components/Module/DevPackage.php b/components/lib/Components/Module/DevPackage.php index 259d5ea67..09f406faf 100644 --- a/components/lib/Components/Module/DevPackage.php +++ b/components/lib/Components/Module/DevPackage.php @@ -1,19 +1,19 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ /** - * Horde_Element_Module_DevPackage:: generates a development snapshot for the + * Components_Module_DevPackage:: generates a development snapshot for the * specified package. * * Copyright 2010 The Horde Project (http://www.horde.org/) @@ -22,13 +22,13 @@ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @category Horde - * @package Element + * @package Components * @author Gunnar Wrobel * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ -class Horde_Element_Module_DevPackage -implements Horde_Element_Module +class Components_Module_DevPackage +implements Components_Module { public function getOptionGroupTitle() { @@ -54,7 +54,7 @@ implements Horde_Element_Module ); } - public function handle(Horde_Element_Config $config) + public function handle(Components_Config $config) { $options = $config->getOptions(); if (!empty($options['devpackage'])) { @@ -62,7 +62,7 @@ implements Horde_Element_Module } } - public function run(Horde_Element_Config $config) + public function run(Components_Config $config) { $options = $config->getOptions(); diff --git a/components/lib/Components/Module/Installer.php b/components/lib/Components/Module/Installer.php index 2a425bcdd..b7f48a23d 100644 --- a/components/lib/Components/Module/Installer.php +++ b/components/lib/Components/Module/Installer.php @@ -1,19 +1,19 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ /** - * Horde_Element_Module_Installer:: installs a Horde element including + * Components_Module_Installer:: installs a Horde element including * its dependencies. * * Copyright 2010 The Horde Project (http://www.horde.org/) @@ -22,13 +22,13 @@ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @category Horde - * @package Element + * @package Components * @author Gunnar Wrobel * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ -class Horde_Element_Module_Installer -implements Horde_Element_Module +class Components_Module_Installer +implements Components_Module { private $_run; @@ -56,7 +56,7 @@ implements Horde_Element_Module ); } - public function handle(Horde_Element_Config $config) + public function handle(Components_Config $config) { $options = $config->getOptions(); if (!empty($options['install'])) { @@ -64,10 +64,9 @@ implements Horde_Element_Module } } - public function run(Horde_Element_Config $config) + public function run(Components_Config $config) { $options = $config->getOptions(); - $pear = new PEAR(); $pear->setErrorHandling(PEAR_ERROR_DIE); diff --git a/components/lib/Components/Module/PearPackageXml.php b/components/lib/Components/Module/PearPackageXml.php index 44395276a..b0e4f4079 100644 --- a/components/lib/Components/Module/PearPackageXml.php +++ b/components/lib/Components/Module/PearPackageXml.php @@ -1,19 +1,19 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ /** - * Horde_Element_Module_PearPackageXml:: can update the package.xml of + * Components_Module_PearPackageXml:: can update the package.xml of * a Horde element. * * Copyright 2010 The Horde Project (http://www.horde.org/) @@ -22,13 +22,13 @@ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @category Horde - * @package Element + * @package Components * @author Gunnar Wrobel * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ -class Horde_Element_Module_PearPackageXml -implements Horde_Element_Module +class Components_Module_PearPackageXml +implements Components_Module { public function getOptionGroupTitle() { @@ -63,7 +63,7 @@ implements Horde_Element_Module ); } - public function handle(Horde_Element_Config $config) + public function handle(Components_Config $config) { $options = $config->getOptions(); if (!empty($options['packagexml']) || @@ -72,7 +72,7 @@ implements Horde_Element_Module } } - public function run(Horde_Element_Config $config) + public function run(Components_Config $config) { $arguments = $config->getArguments(); $package_file = $arguments[0] . '/package.xml'; @@ -103,7 +103,7 @@ implements Horde_Element_Module ); if ($package instanceOf PEAR_Error) { - throw new Horde_Element_Exception($package->getMessage()); + throw new Components_Exception($package->getMessage()); } /** * @todo: Looks like this throws away any tags we have in diff --git a/components/lib/Components/Modules.php b/components/lib/Components/Modules.php index 9c188f4bb..023446d14 100644 --- a/components/lib/Components/Modules.php +++ b/components/lib/Components/Modules.php @@ -1,18 +1,18 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ /** - * The Horde_Element_Modules:: class handles a set of Element modules. + * The Components_Modules:: class handles a set of Components modules. * * Copyright 2010 The Horde Project (http://www.horde.org/) * @@ -20,12 +20,12 @@ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @category Horde - * @package Element + * @package Components * @author Gunnar Wrobel * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ -class Horde_Element_Modules +class Components_Modules implements Iterator, Countable { /** @@ -46,13 +46,13 @@ implements Iterator, Countable /** * Add all modules found in the specified directory. * - * @param string $module_directory Load the modules from this dirrectory. + * @param string $module_directory Load the modules from this directory. * * @return NULL */ public function addModulesFromDirectory( $module_directory, - $base = 'Horde_Element_Module_' + $base = 'Components_Module_' ) { foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($module_directory)) as $file) { if ($file->isFile() && preg_match('/.php$/', $file->getFilename())) { @@ -95,7 +95,7 @@ implements Iterator, Countable /** * Implementation of the Iterator next() method. Returns the next module. * - * @return Horde_Element_Module|null The next module or null if there are no more + * @return Components_Module|null The next module or null if there are no more * modules. */ public function next() diff --git a/components/package.xml b/components/package.xml index 6d1afd81d..ad5ebb76b 100644 --- a/components/package.xml +++ b/components/package.xml @@ -1,10 +1,10 @@ - Element + Components pear.horde.org - A package for handling Horde elements. + A package for handling Horde components. The package provides utility methods required - when preparing a new element release for Horde. It also includes + when preparing a new component release for Horde. It also includes quality control checks. Gunnar Wrobel @@ -41,22 +41,21 @@ - - - + + + - - + - + - + @@ -65,36 +64,33 @@ - - - + + - + - - + - - - + + + - - + + - + - - + @@ -119,6 +115,10 @@ Argv pear.horde.org + + Injector + pear.horde.org + @@ -129,30 +129,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/script/horde-components.php b/components/script/horde-components.php index f0ae98f0f..22e54b202 100755 --- a/components/script/horde-components.php +++ b/components/script/horde-components.php @@ -1,4 +1,4 @@ #!/usr/bin/env php * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ /** * Define the main method */ if (!defined('PHPUnit_MAIN_METHOD')) { - define('PHPUnit_MAIN_METHOD', 'Horde_Element_AllTests::main'); + define('PHPUnit_MAIN_METHOD', 'Components_AllTests::main'); } /** @@ -33,18 +33,18 @@ require_once 'Horde/Test/AllTests.php'; * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @category Horde - * @package Element + * @package Components * @subpackage UnitTests * @author Gunnar Wrobel * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ -class Horde_Element_AllTests extends Horde_Test_AllTests +class Components_AllTests extends Horde_Test_AllTests { } -Horde_Element_AllTests::init('Horde_Element', __FILE__); +Components_AllTests::init('Components', __FILE__); -if (PHPUnit_MAIN_METHOD == 'Horde_Element_AllTests::main') { - Horde_Element_AllTests::main(); +if (PHPUnit_MAIN_METHOD == 'Components_AllTests::main') { + Components_AllTests::main(); } diff --git a/components/test/Components/Autoload.php b/components/test/Components/Autoload.php index b0b1fb6ca..b347717c8 100644 --- a/components/test/Components/Autoload.php +++ b/components/test/Components/Autoload.php @@ -10,11 +10,11 @@ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @category Horde - * @package Element + * @package Components * @subpackage UnitTests * @author Gunnar Wrobel * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ if (!spl_autoload_functions()) { diff --git a/components/test/Components/Integration/ComponentsTest.php b/components/test/Components/Integration/ComponentsTest.php new file mode 100644 index 000000000..15c075272 --- /dev/null +++ b/components/test/Components/Integration/ComponentsTest.php @@ -0,0 +1,121 @@ + + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Components + */ + +/** + * Prepare the test setup. + */ +require_once dirname(__FILE__) . '/../Autoload.php'; + +/** + * Test the Components package. + * + * 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 + * @subpackage UnitTests + * @author Gunnar Wrobel + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Components + */ +class Components_Integration_ComponentsTest +extends Components_StoryTestCase +{ + /** + * @scenario + */ + public function theHelpOptionResultsInHelpOutput() + { + $this->given('the default Components setup') + ->when('calling the package with the help option') + ->then('the help will be displayed'); + } + + /** + * @scenario + */ + public function thePearpackagexmlModuleAddsThePOptionInTheHelpOutput() + { + $this->given('the default Components setup') + ->when('calling the package with the help option') + ->then('the help will contain the "p" option.'); + } + + /** + * @scenario + */ + public function thePearpackagexmlModuleAddsTheUOptionInTheHelpOutput() + { + $this->given('the default Components setup') + ->when('calling the package with the help option') + ->then('the help will contain the "u" option.'); + } + + /** + * @scenario + */ + public function theDevpackageModuleAddsTheDOptionInTheHelpOutput() + { + $this->given('the default Components setup') + ->when('calling the package with the help option') + ->then('the help will contain the "d" option.'); + } + + /** + * @scenario + */ + public function theThePOptionProvidesAnUpdatedPackageXml() + { + $this->given('the default Components setup') + ->when('calling the package with the packagexml option and a Horde element') + ->then('the new package.xml of the Horde element will be printed.'); + } + + /** + * @todo Test (and fix) the reactions to three more scenarios: + * - invalid XML in the package.xml (e.g. tag missing) + * - empty file list + * - file list with just one entry. + * + * All three scenarios yield errors which are still hard to + * understand. + */ + + /** + * @scenario + */ + public function theInstallerModuleAddsTheIOptionInTheHelpOutput() + { + $this->given('the default Components setup') + ->when('calling the package with the help option') + ->then('the help will contain the "i" option.'); + } + + /** + * @scenario + */ + public function theTheIOptionInstallsThePackageFromTheCurrentTree() + { + $this->given('the default Components setup') + ->when('calling the package with the install option and a Horde element') + ->then('a new PEAR configuration file will be installed') + ->and('the PEAR package will be installed') + ->and('the non-Horde dependencies of the Horde element will get installed from the network.') + ->and('the Horde dependencies of the Horde element will get installed from the current tree.') + ->and('the Horde element will be installed'); + } +} \ No newline at end of file diff --git a/components/test/Components/Integration/ElementTest.php b/components/test/Components/Integration/ElementTest.php deleted file mode 100644 index 9d461db63..000000000 --- a/components/test/Components/Integration/ElementTest.php +++ /dev/null @@ -1,121 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element - */ - -/** - * Prepare the test setup. - */ -require_once dirname(__FILE__) . '/../Autoload.php'; - -/** - * Test the Element package. - * - * 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 Element - * @subpackage UnitTests - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element - */ -class Horde_Element_Integration_ElementTest -extends Horde_Element_StoryTestCase -{ - /** - * @scenario - */ - public function theHelpOptionResultsInHelpOutput() - { - $this->given('the default Element setup') - ->when('calling the package with the help option') - ->then('the help will be displayed'); - } - - /** - * @scenario - */ - public function thePearpackagexmlModuleAddsThePOptionInTheHelpOutput() - { - $this->given('the default Element setup') - ->when('calling the package with the help option') - ->then('the help will contain the "p" option.'); - } - - /** - * @scenario - */ - public function thePearpackagexmlModuleAddsTheUOptionInTheHelpOutput() - { - $this->given('the default Element setup') - ->when('calling the package with the help option') - ->then('the help will contain the "u" option.'); - } - - /** - * @scenario - */ - public function theDevpackageModuleAddsTheDOptionInTheHelpOutput() - { - $this->given('the default Element setup') - ->when('calling the package with the help option') - ->then('the help will contain the "d" option.'); - } - - /** - * @scenario - */ - public function theThePOptionProvidesAnUpdatedPackageXml() - { - $this->given('the default Element setup') - ->when('calling the package with the packagexml option and a Horde element') - ->then('the new package.xml of the Horde element will be printed.'); - } - - /** - * @todo Test (and fix) the reactions to three more scenarios: - * - invalid XML in the package.xml (e.g. tag missing) - * - empty file list - * - file list with just one entry. - * - * All three scenarios yield errors which are still hard to - * understand. - */ - - /** - * @scenario - */ - public function theInstallerModuleAddsTheIOptionInTheHelpOutput() - { - $this->given('the default Element setup') - ->when('calling the package with the help option') - ->then('the help will contain the "i" option.'); - } - - /** - * @scenario - */ - public function theTheIOptionInstallsThePackageFromTheCurrentTree() - { - $this->given('the default Element setup') - ->when('calling the package with the install option and a Horde element') - ->then('a new PEAR configuration file will be installed') - ->and('the PEAR package will be installed') - ->and('the non-Horde dependencies of the Horde element will get installed from the network.') - ->and('the Horde dependencies of the Horde element will get installed from the current tree.') - ->and('the Horde element will be installed'); - } -} \ No newline at end of file diff --git a/components/test/Components/StoryTestCase.php b/components/test/Components/StoryTestCase.php index 4d05428ab..54f5dda73 100644 --- a/components/test/Components/StoryTestCase.php +++ b/components/test/Components/StoryTestCase.php @@ -5,11 +5,11 @@ * PHP version 5 * * @category Horde - * @package Element + * @package Components * @subpackage UnitTests * @author Gunnar Wrobel * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ /** @@ -21,13 +21,13 @@ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @category Horde - * @package Element + * @package Components * @subpackage UnitTests * @author Gunnar Wrobel * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Element + * @link http://pear.horde.org/index.php?package=Components */ -class Horde_Element_StoryTestCase +class Components_StoryTestCase extends PHPUnit_Extensions_Story_TestCase { public function tearDown() @@ -49,7 +49,7 @@ extends PHPUnit_Extensions_Story_TestCase public function runGiven(&$world, $action, $arguments) { switch($action) { - case 'the default Element setup': + case 'the default Components setup': break; default: return $this->notImplemented($action); @@ -70,43 +70,43 @@ extends PHPUnit_Extensions_Story_TestCase switch($action) { case 'calling the package with the help option': $_SERVER['argv'] = array( - 'horde-element', + 'horde-components', '--help', dirname(__FILE__) . '/fixture/empty' ); ob_start(); $parameters = array(); - $parameters['cli']['parser']['class'] = 'Horde_Element_Stub_Parser'; - Horde_Element::main($parameters); + $parameters['cli']['parser']['class'] = 'Components_Stub_Parser'; + Components::main($parameters); $world['output'] = ob_get_contents(); ob_end_clean(); break; case 'calling the package with the packagexml option and a Horde element': $_SERVER['argv'] = array( - 'horde-element', + 'horde-components', '--packagexml', dirname(__FILE__) . '/fixture/simple' ); ob_start(); $parameters = array(); - $parameters['cli']['parser']['class'] = 'Horde_Element_Stub_Parser'; + $parameters['cli']['parser']['class'] = 'Components_Stub_Parser'; $old_errorreporting = error_reporting(E_ALL & ~E_STRICT); - Horde_Element::main($parameters); + Components::main($parameters); error_reporting($old_errorreporting); $world['output'] = ob_get_contents(); ob_end_clean(); break; case 'calling the package with the install option and a Horde element': $_SERVER['argv'] = array( - 'horde-element', + 'horde-components', '--install=' . $this->_getTemporaryDirectory(), - dirname(__FILE__) . '/../../../' + dirname(__FILE__) . '/../../' ); ob_start(); $parameters = array(); - $parameters['cli']['parser']['class'] = 'Horde_Element_Stub_Parser'; + $parameters['cli']['parser']['class'] = 'Components_Stub_Parser'; $old_errorreporting = error_reporting(E_ALL & ~E_STRICT); - Horde_Element::main($parameters); + Components::main($parameters); error_reporting($old_errorreporting); $world['output'] = ob_get_contents(); ob_end_clean(); @@ -209,7 +209,7 @@ extends PHPUnit_Extensions_Story_TestCase . 'pear' . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'Horde' . DIRECTORY_SEPARATOR - . 'Element.php' + . 'Components.php' ) ); break; @@ -221,7 +221,7 @@ extends PHPUnit_Extensions_Story_TestCase private function _getTemporaryDirectory() { $this->_temp_dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR - . 'Horde_Element_' . mt_rand(); + . 'Components_' . mt_rand(); mkdir($this->_temp_dir); return $this->_temp_dir; } diff --git a/components/test/Components/Stub/Parser.php b/components/test/Components/Stub/Parser.php index e704661fa..082b79542 100644 --- a/components/test/Components/Stub/Parser.php +++ b/components/test/Components/Stub/Parser.php @@ -1,5 +1,5 @@ Fixture pear.horde.org Test fixture. - A dummy package.xml used for testing the Horde_Element package. + A dummy package.xml used for testing the Components package. Gunnar Wrobel wrobel