From: Gunnar Wrobel Date: Fri, 10 Dec 2010 05:02:16 +0000 (+0100) Subject: Start collecting stubs of general use in the Horde_Test package. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=7206d212166a660a53fb6e4edb5a2a01695fd4f6;p=horde.git Start collecting stubs of general use in the Horde_Test package. Added test stubs for testing command line tools (Argv, Cli). Both classes tend to exit unconditionally in certain situations. The stubs disable this. --- diff --git a/components/package.xml b/components/package.xml index a201f9017..7d195d9f6 100644 --- a/components/package.xml +++ b/components/package.xml @@ -1,5 +1,5 @@ - + Components pear.horde.org A package for handling Horde components. @@ -24,8 +24,8 @@ jan@horde.org yes - 2010-11-15 - + 2010-12-10 + 0.0.1 0.0.1 @@ -124,6 +124,11 @@ + + + + + @@ -209,10 +214,6 @@ - - - - @@ -333,6 +334,7 @@ + @@ -365,8 +367,6 @@ - - @@ -382,7 +382,7 @@ alpha alpha - 2010-11-15 + 2010-12-10 LGPL * Initial release diff --git a/components/test/Components/Autoload.php b/components/test/Components/Autoload.php index 6ec989618..10cdc35a9 100644 --- a/components/test/Components/Autoload.php +++ b/components/test/Components/Autoload.php @@ -27,8 +27,4 @@ if (!class_exists('Components')) { error_reporting(E_ALL | E_STRICT); /** Load the basic test definition */ -require_once dirname(__FILE__) . '/StoryTestCase.php'; - -/** Load stubs */ -require_once dirname(__FILE__) . '/Stub/Cli.php'; -require_once dirname(__FILE__) . '/Stub/Parser.php'; +require_once dirname(__FILE__) . '/StoryTestCase.php'; \ No newline at end of file diff --git a/components/test/Components/StoryTestCase.php b/components/test/Components/StoryTestCase.php index 9ba58e5a7..2b35925f1 100644 --- a/components/test/Components/StoryTestCase.php +++ b/components/test/Components/StoryTestCase.php @@ -671,11 +671,11 @@ extends PHPUnit_Extensions_Story_TestCase private function _callComponents(array $parameters, $callback) { ob_start(); - $parameters['cli']['parser']['class'] = 'Components_Stub_Parser'; + $parameters['cli']['parser']['class'] = 'Horde_Test_Stub_Parser'; $parameters['dependencies'] = new Components_Dependencies_Injector(); $parameters['dependencies']->setInstance( 'Horde_Cli', - new Components_Stub_Cli() + new Horde_Test_Stub_Cli() ); call_user_func_array($callback, array($parameters)); $output = ob_get_contents(); diff --git a/components/test/Components/Stub/Cli.php b/components/test/Components/Stub/Cli.php deleted file mode 100644 index f6564d189..000000000 --- a/components/test/Components/Stub/Cli.php +++ /dev/null @@ -1,30 +0,0 @@ -getMessage(); - } - $this->writeln($this->red('====================')); - $this->writeln(); - $this->writeln($this->red(_("Fatal Error:"))); - $this->writeln($this->red($error)); - $this->writeln(); - $this->writeln((string)$backtrace); - $this->writeln($this->red('====================')); - } -} \ No newline at end of file diff --git a/components/test/Components/Stub/Parser.php b/components/test/Components/Stub/Parser.php deleted file mode 100644 index b8efead9f..000000000 --- a/components/test/Components/Stub/Parser.php +++ /dev/null @@ -1,23 +0,0 @@ -printUsage(); - $this->parserExit(2, sprintf("%s: error: %s\n", $this->getProgName(), $msg)); - } - - public function parserExit($status = 0, $msg = null) - { - if ($msg) - echo $msg; - } -} \ No newline at end of file diff --git a/framework/Test/lib/Horde/Test/Stub/Cli.php b/framework/Test/lib/Horde/Test/Stub/Cli.php new file mode 100644 index 000000000..ce394af2b --- /dev/null +++ b/framework/Test/lib/Horde/Test/Stub/Cli.php @@ -0,0 +1,30 @@ +getMessage(); + } + $this->writeln($this->red('====================')); + $this->writeln(); + $this->writeln($this->red(_("Fatal Error:"))); + $this->writeln($this->red($error)); + $this->writeln(); + $this->writeln((string)$backtrace); + $this->writeln($this->red('====================')); + } +} \ No newline at end of file diff --git a/framework/Test/lib/Horde/Test/Stub/Parser.php b/framework/Test/lib/Horde/Test/Stub/Parser.php new file mode 100644 index 000000000..3527b09b6 --- /dev/null +++ b/framework/Test/lib/Horde/Test/Stub/Parser.php @@ -0,0 +1,24 @@ +printUsage(); + $this->parserExit(2, sprintf("%s: error: %s\n", $this->getProgName(), $msg)); + } + + public function parserExit($status = 0, $msg = null) + { + if ($msg) { + echo $msg; + } + } +} \ No newline at end of file diff --git a/framework/Test/package.xml b/framework/Test/package.xml index 43c451700..98767aa34 100644 --- a/framework/Test/package.xml +++ b/framework/Test/package.xml @@ -1,5 +1,5 @@ - + Test pear.horde.org Horde testing base classes @@ -10,8 +10,8 @@ chuck@horde.org yes - 2010-02-11 - + 2010-12-10 + 0.1.0 0.1.0 @@ -29,6 +29,10 @@ + + + + @@ -59,6 +63,8 @@ + + @@ -71,7 +77,7 @@ alpha alpha - 2010-02-11 + 2010-12-10 LGPL * Initial testing package.