commit php5-pear-Horde_Test for openSUSE:Factory
Hello community, here is the log from the commit of package php5-pear-Horde_Test for openSUSE:Factory checked in at Tue Aug 16 11:47:04 CEST 2011. -------- --- php5-pear-Horde_Test/php5-pear-Horde_Test.changes 2011-06-15 16:06:54.000000000 +0200 +++ /mounts/work_src_done/STABLE/php5-pear-Horde_Test/php5-pear-Horde_Test.changes 2011-08-15 00:19:39.000000000 +0200 @@ -1,0 +2,7 @@ +Sun Aug 14 22:19:55 UTC 2011 - lang@b1-systems.de + +- version 1.1.2 +- [gwr] Improve detection of the lib directory. +- [gwr] Extract the setup pieces we do in the AllTests helper and heed the Autoload.php file of a test suite. + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- Horde_Test-1.1.1.tgz New: ---- Horde_Test-1.1.2.tgz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ php5-pear-Horde_Test.spec ++++++ --- /var/tmp/diff_new_pack.YwIuL2/_old 2011-08-16 11:46:17.000000000 +0200 +++ /var/tmp/diff_new_pack.YwIuL2/_new 2011-08-16 11:46:17.000000000 +0200 @@ -22,9 +22,9 @@ Summary: PEAR: Horde testing base classes Name: php5-pear-Horde_Test -Version: 1.1.1 +Version: 1.1.2 Release: 1 -License: LGPL-3.0+ +License: LGPLv2.1 Group: Development/Libraries/PHP Source0: http://pear.horde.org/get/Horde_Test-%{version}.tgz BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ Horde_Test-1.1.1.tgz -> Horde_Test-1.1.2.tgz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Horde_Test-1.1.1/lib/Horde/Test/AllTests.php new/Horde_Test-1.1.1/lib/Horde/Test/AllTests.php --- old/Horde_Test-1.1.1/lib/Horde/Test/AllTests.php 2011-06-14 14:55:55.000000000 +0200 +++ new/Horde_Test-1.1.1/lib/Horde/Test/AllTests.php 1970-01-01 01:00:00.000000000 +0100 @@ -1,99 +0,0 @@ -<?php -/** - * Horde base test suite - * - * @author Jan Schneider <jan@horde.org> - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @category Horde - * @package Test - * @subpackage UnitTests - */ - -if (!defined('PHPUnit_MAIN_METHOD')) { - define('PHPUnit_MAIN_METHOD', 'Horde_Test_AllTests::main'); -} - -require_once 'PHPUnit/Autoload.php'; - -/** - * @package Test - * @subpackage UnitTests - */ -class Horde_Test_AllTests -{ - /** @todo: Use protected properties and LSB with PHP 5.3. */ - private static $_file = __FILE__; - private static $_package = 'Horde_Test'; - - /** - * Main entry point for running the suite. - */ - public static function main($package = null, $file = null) - { - if ($package) { - self::$_package = $package; - } - if ($file) { - self::$_file = $file; - } - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - /** - * Initialize the test suite class. - * - * @param string $package The name of the package tested by this suite. - * @param string $file The path of the AllTests class. - * - * @return NULL - */ - public static function init($package, $file) - { - self::$_package = $package; - self::$_file = $file; - } - - /** - * Collect the unit tests of this directory into a new suite. - * - * @return PHPUnit_Framework_TestSuite The test suite. - */ - public static function suite() - { - // Catch strict standards - error_reporting(E_ALL | E_STRICT); - - // Set up autoload - $basedir = dirname(self::$_file); - set_include_path($basedir . '/../../../lib' . PATH_SEPARATOR . get_include_path()); - require_once 'Horde/Test/Autoload.php'; - - $suite = new PHPUnit_Framework_TestSuite('Horde Framework - ' . self::$_package); - $baseregexp = preg_quote($basedir . DIRECTORY_SEPARATOR, '/'); - - foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($basedir)) as $file) { - if ($file->isFile() && preg_match('/Test.php$/', $file->getFilename())) { - $pathname = $file->getPathname(); - if (require $pathname) { - $class = str_replace(DIRECTORY_SEPARATOR, '_', - preg_replace("/^$baseregexp(.*)\.php/", '\\1', $pathname)); - try { - $suite->addTestSuite(self::$_package . '_' . $class); - } catch (InvalidArgumentException $e) { - throw new Horde_Test_Exception( - sprintf( - 'Failed adding test suite "%s" from file "%s": %s', - self::$_package . '_' . $class, - $pathname, - $e->getMessage() - ) - ); - } - } - } - } - - return $suite; - } - -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Horde_Test-1.1.1/lib/Horde/Test/Application.php new/Horde_Test-1.1.1/lib/Horde/Test/Application.php --- old/Horde_Test-1.1.1/lib/Horde/Test/Application.php 2011-06-14 14:55:55.000000000 +0200 +++ new/Horde_Test-1.1.1/lib/Horde/Test/Application.php 1970-01-01 01:00:00.000000000 +0100 @@ -1,25 +0,0 @@ -<?php -/** - * A test helper for unit testing Horde applications. - * - * PHP version 5 - * - * @category Horde - * @package Test - * @author Gunnar Wrobel <wrobel@pardus.de> - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Test - */ - -/** - * A test helper for unit testing Horde applications. - * - * @category Horde - * @package Test - * @author Gunnar Wrobel <wrobel@pardus.de> - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Test - */ -class Horde_Test_Application extends Horde_Test_Case -{ -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Horde_Test-1.1.1/lib/Horde/Test/Autoload.php new/Horde_Test-1.1.1/lib/Horde/Test/Autoload.php --- old/Horde_Test-1.1.1/lib/Horde/Test/Autoload.php 2011-06-14 14:55:55.000000000 +0200 +++ new/Horde_Test-1.1.1/lib/Horde/Test/Autoload.php 1970-01-01 01:00:00.000000000 +0100 @@ -1,47 +0,0 @@ -<?php -/** - * Reduced Horde Autoloader for test suites. - * - * @author Jan Schneider <jan@horde.org> - * @author Gunnar Wrobel <wrobel@pardus.de> - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @category Horde - * @package Test - * @subpackage UnitTests - */ -$autoloaders = spl_autoload_functions(); -if (!empty($autoloaders)) { - /** - * Ignore autoloaders which are incapable of loading Horde - * classes (e.g. PHPUnit >= 3.5.0) - */ - $autoloaders = array_diff($autoloaders, array('phpunit_autoload')); -} -if (empty($autoloaders)) { - $mapping = ''; - if (!empty($mappings)) { - foreach ($mappings as $prefix => $path) { - $mapping .= 'if ($filename == "' . $prefix . '") {' - . ' $filename = "' . $path . '$filename";' - . '}'; - $mapping .= 'if (substr($filename, 0, ' . strlen($prefix) . ') == "' . $prefix . '") {' - . ' $filename = substr($filename, ' . strlen($prefix) . ');' - . ' $filename = "' . $path . '$filename";' - . '}'; - } - unset($mappings); - } - spl_autoload_register( - create_function( - '$class', - '$filename = str_replace(array(\'::\', \'_\'), \'/\', $class);' - . $mapping - . '$err_mask = error_reporting() & ~E_WARNING;' - . '$oldErrorReporting = error_reporting($err_mask);' - . 'include "$filename.php";' - . 'error_reporting($oldErrorReporting);' - ) - ); -} - -unset($autoloaders, $mapping); \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Horde_Test-1.1.1/lib/Horde/Test/Case.php new/Horde_Test-1.1.1/lib/Horde/Test/Case.php --- old/Horde_Test-1.1.1/lib/Horde/Test/Case.php 2011-06-14 14:55:55.000000000 +0200 +++ new/Horde_Test-1.1.1/lib/Horde/Test/Case.php 1970-01-01 01:00:00.000000000 +0100 @@ -1,52 +0,0 @@ -<?php -class Horde_Test_Case extends PHPUnit_Framework_TestCase -{ - /** - * Useful shorthand if you are mocking a class with a private constructor - */ - public function getMockSkipConstructor($className, array $methods = array(), array $arguments = array(), $mockClassName = '') - { - return $this->getMock($className, $methods, $arguments, $mockClassName, /* $callOriginalConstructor */ false); - } - - /** - * Helper method for loading test configuration from a file. - * - * The configuration can be specified by an environment variable. If the - * variable content is a file name, the configuration is loaded from the - * file. Otherwise it's assumed to be a json encoded configuration hash. If - * the environment variable is not set, the method tries to load a conf.php - * file from the same directory as the test case. - * - * @param string $env An environment variable name. - * @param array $default Some default values that are merged into the - * configuration if specified as a json hash. - * - * @return mixed The value of the configuration file's $conf variable, or - * null. - */ - static public function getConfig($env, $path = null, $default = array()) - { - $config = getenv($env); - if ($config) { - $json = json_decode($config, true); - if ($json) { - return Horde_Array::replaceRecursive($default, $json); - } - } else { - if (!$path) { - $backtrace = new Horde_Support_Backtrace(); - $caller = $backtrace->getCurrentContext(); - $path = dirname($caller['file']); - } - $config = $path . '/conf.php'; - } - - if (file_exists($config)) { - require $config; - return $conf; - } - - return null; - } -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Horde_Test-1.1.1/lib/Horde/Test/Exception.php new/Horde_Test-1.1.1/lib/Horde/Test/Exception.php --- old/Horde_Test-1.1.1/lib/Horde/Test/Exception.php 2011-06-14 14:55:55.000000000 +0200 +++ new/Horde_Test-1.1.1/lib/Horde/Test/Exception.php 1970-01-01 01:00:00.000000000 +0100 @@ -1,25 +0,0 @@ -<?php -/** - * The exception specific to this package. - * - * PHP version 5 - * - * @category Horde - * @package Test - * @author Gunnar Wrobel <wrobel@pardus.de> - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Test - */ - -/** - * The exception specific to this package. - * - * @category Horde - * @package Test - * @author Gunnar Wrobel <wrobel@pardus.de> - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Test - */ -class Horde_Test_Exception extends Horde_Exception_Wrapped -{ -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Horde_Test-1.1.1/lib/Horde/Test/Functional.php new/Horde_Test-1.1.1/lib/Horde/Test/Functional.php --- old/Horde_Test-1.1.1/lib/Horde/Test/Functional.php 2011-06-14 14:55:55.000000000 +0200 +++ new/Horde_Test-1.1.1/lib/Horde/Test/Functional.php 1970-01-01 01:00:00.000000000 +0100 @@ -1,33 +0,0 @@ -<?php -class Horde_Test_Functional extends Horde_Test_Case -{ - /** - * Test two XML strings for equivalency (e.g., identical up to reordering of - * attributes). - */ - public function assertDomEquals($expected, $actual, $message = null) - { - $expectedDom = new DOMDocument(); - $expectedDom->loadXML($expected); - - $actualDom = new DOMDocument(); - $actualDom->loadXML($actual); - - $this->assertEquals($expectedDom->saveXML(), $actualDom->saveXML(), $message); - } - - /** - * Test two HTML strings for equivalency (e.g., identical up to reordering - * of attributes). - */ - public function assertHtmlDomEquals($expected, $actual, $message = null) - { - $expectedDom = new DOMDocument(); - $expectedDom->loadHTML($expected); - - $actualDom = new DOMDocument(); - $actualDom->loadHTML($actual); - - $this->assertEquals($expectedDom->saveHTML(), $actualDom->saveHTML(), $message); - } -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Horde_Test-1.1.1/lib/Horde/Test/Log.php new/Horde_Test-1.1.1/lib/Horde/Test/Log.php --- old/Horde_Test-1.1.1/lib/Horde/Test/Log.php 2011-06-14 14:55:55.000000000 +0200 +++ new/Horde_Test-1.1.1/lib/Horde/Test/Log.php 1970-01-01 01:00:00.000000000 +0100 @@ -1,118 +0,0 @@ -<?php -/** - * Provides utilities to test for log output. - * - * PHP version 5 - * - * @category Horde - * @package Test - * @author Gunnar Wrobel <wrobel@pardus.de> - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Test - */ - -/** - * Provides utilities to test for log output. - * - * Copyright 2011 The Horde Project (http://www.horde.org/) - * - * See the enclosed file COPYING for license instorageion (LGPL). If you - * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. - * - * @since Horde_Test 1.1.0 - * - * @category Horde - * @package Test - * @author Gunnar Wrobel <wrobel@pardus.de> - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Test - */ -class Horde_Test_Log extends Horde_Test_Case -{ - /** - * The log handler. - * - * @var Horde_Log_Handler_Base - */ - private $_logHandler; - - /** - * Returns a log handler. - * - * @return Horde_Log_Logger - */ - public function getLogger() - { - if (!class_exists('Horde_Log_Logger')) { - $this->markTestSkipped('The "Horde_Log" package is missing!'); - } - $this->_logHandler = new Horde_Log_Handler_Mock(); - return new Horde_Log_Logger($this->_logHandler); - } - - /** - * Asserts that the log contains the given number of messages. - * - * You *MUST* fetch the logger via $this->getLogger() before using this - * method. This will store a reference to an internal mock log handler that - * will later be used to analyze the log events. - * - * @param int $count The expected number of messages. - * - * @return Horde_Log_Logger - */ - public function assertLogCount($count) - { - $this->assertEquals(count($this->_logHandler->events), $count); - } - - /** - * Asserts that the log contains at least one message matching the provided string. - * - * You *MUST* fetch the logger via $this->getLogger() before using this - * method. This will store a reference to an internal mock log handler that - * will later be used to analyze the log events. - * - * @param string $message The expected log message. - * - * @return Horde_Log_Logger - */ - public function assertLogContains($message) - { - $messages = array(); - $found = false; - foreach ($this->_logHandler->events as $event) { - if (strstr($event['message'], $message) !== false) { - $found = true; - break; - } - $messages[] = $event['message']; - } - $this->assertTrue($found, sprintf("Did not find \"%s\" in [\n%s\n]", $message, join("\n", $messages))); - } - - /** - * Asserts that the log contains at least one message matching the provided regular_expression. - * - * You *MUST* fetch the logger via $this->getLogger() before using this - * method. This will store a reference to an internal mock log handler that - * will later be used to analyze the log events. - * - * @param string $regular_expression The expected regular expression. - * - * @return Horde_Log_Logger - */ - public function assertLogRegExp($regular_expression) - { - $messages = array(); - $found = false; - foreach ($this->_logHandler->events as $event) { - if (preg_match($regular_expression, $event['message'], $matches) !== false) { - $found = true; - break; - } - $messages[] = $event['message']; - } - $this->assertTrue($found, sprintf("Did not find \"%s\" in [\n%s\n]", $message, join("\n", $messages))); - } -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Horde_Test-1.1.1/lib/Horde/Test/Stub/Cli.php new/Horde_Test-1.1.1/lib/Horde/Test/Stub/Cli.php --- old/Horde_Test-1.1.1/lib/Horde/Test/Stub/Cli.php 2011-06-14 14:55:55.000000000 +0200 +++ new/Horde_Test-1.1.1/lib/Horde/Test/Stub/Cli.php 1970-01-01 01:00:00.000000000 +0100 @@ -1,29 +0,0 @@ -<?php -class Horde_Test_Stub_Cli extends Horde_Cli -{ - /** - * Displays a fatal error message. - * - * @param mixed $error The error text to display, an exception or an - * object with a getMessage() method. - */ - public function fatal($error) - { - if ($error instanceof Exception) { - $trace = $error; - } else { - $trace = debug_backtrace(); - } - $backtrace = new Horde_Support_Backtrace($trace); - if (is_object($error) && method_exists($error, 'getMessage')) { - $error = $error->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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Horde_Test-1.1.1/lib/Horde/Test/Stub/Parser.php new/Horde_Test-1.1.1/lib/Horde/Test/Stub/Parser.php --- old/Horde_Test-1.1.1/lib/Horde/Test/Stub/Parser.php 2011-06-14 14:55:55.000000000 +0200 +++ new/Horde_Test-1.1.1/lib/Horde/Test/Stub/Parser.php 1970-01-01 01:00:00.000000000 +0100 @@ -1,24 +0,0 @@ -<?php -class Horde_Test_Stub_Parser -extends Horde_Argv_Parser -{ - /** - * Print a usage message incorporating $msg to stderr and exit. - * If you override this in a subclass, it should not return -- it - * should either exit or raise an exception. - * - * @param string $msg - */ - public function parserError($msg) - { - $this->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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Horde_Test-1.1.2/lib/Horde/Test/AllTests.php new/Horde_Test-1.1.2/lib/Horde/Test/AllTests.php --- old/Horde_Test-1.1.2/lib/Horde/Test/AllTests.php 1970-01-01 01:00:00.000000000 +0100 +++ new/Horde_Test-1.1.2/lib/Horde/Test/AllTests.php 2011-07-05 14:57:19.000000000 +0200 @@ -0,0 +1,137 @@ +<?php +/** + * Horde base test suite + * + * @author Jan Schneider <jan@horde.org> + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @category Horde + * @package Test + * @subpackage UnitTests + */ + +if (!defined('PHPUnit_MAIN_METHOD')) { + define('PHPUnit_MAIN_METHOD', 'Horde_Test_AllTests::main'); +} + +require_once 'PHPUnit/Autoload.php'; + +/** + * @package Test + * @subpackage UnitTests + */ +class Horde_Test_AllTests +{ + /** @todo: Use protected properties and LSB with PHP 5.3. */ + private static $_file = __FILE__; + private static $_package = 'Horde_Test'; + + /** + * Main entry point for running the suite. + */ + public static function main($package = null, $file = null) + { + if ($package) { + self::$_package = $package; + } + if ($file) { + self::$_file = $file; + } + PHPUnit_TextUI_TestRunner::run(self::suite()); + } + + /** + * Initialize the test suite class. + * + * @param string $package The name of the package tested by this suite. + * @param string $file The path of the AllTests class. + * + * @return NULL + */ + public static function init($package, $file) + { + self::$_package = $package; + self::$_file = $file; + } + + /** + * Collect the unit tests of this directory into a new suite. + * + * @return PHPUnit_Framework_TestSuite The test suite. + */ + public static function suite() + { + self::setup(); + + $suite = new PHPUnit_Framework_TestSuite('Horde Framework - ' . self::$_package); + + $basedir = dirname(self::$_file); + $baseregexp = preg_quote($basedir . DIRECTORY_SEPARATOR, '/'); + + foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($basedir)) as $file) { + if ($file->isFile() && preg_match('/Test.php$/', $file->getFilename())) { + $pathname = $file->getPathname(); + if (include $pathname) { + $class = str_replace(DIRECTORY_SEPARATOR, '_', + preg_replace("/^$baseregexp(.*)\.php/", '\\1', $pathname)); + try { + $suite->addTestSuite(self::$_package . '_' . $class); + } catch (InvalidArgumentException $e) { + throw new Horde_Test_Exception( + sprintf( + 'Failed adding test suite "%s" from file "%s": %s', + self::$_package . '_' . $class, + $pathname, + $e->getMessage() + ) + ); + } + } + } + } + + return $suite; + } + + /** + * Basic test suite setup. This includes error checking and autoloading. + * + * In the default situation this will set the error reporting to E_ALL | + * E_STRICT and pull in Horde/Test/Autoload.php as autoloading + * definition. If there is an Autoload.php alongside the AllTests.php + * represented by self::$_file, then only this file will be used. + * + * In addition the setup() call will attempt to detect the "lib" directory + * of the component currently under test and add it to the + * include_path. This ensures that the component code from the checkout is + * preferred over whatever else might be available in the default + * include_path. + * + * @return NULL + */ + public static function setup() + { + // Detect component root and add "lib" to the include path. + for ($dirname = self::$_file, $i = 0; + $dirname != '/', $i < 5; + $dirname = dirname($dirname), $i++) { + if (basename($dirname) == 'test' && + file_exists(dirname($dirname) . '/lib')) { + set_include_path( + dirname($dirname) . '/lib' . PATH_SEPARATOR . get_include_path() + ); + break; + } + } + + $autoload = dirname(self::$_file) . '/Autoload.php'; + if (!file_exists($autoload)) { + // Catch strict standards + error_reporting(E_ALL | E_STRICT); + + // Set up autoload + require_once 'Horde/Test/Autoload.php'; + } else { + require_once $autoload; + } + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Horde_Test-1.1.2/lib/Horde/Test/Application.php new/Horde_Test-1.1.2/lib/Horde/Test/Application.php --- old/Horde_Test-1.1.2/lib/Horde/Test/Application.php 1970-01-01 01:00:00.000000000 +0100 +++ new/Horde_Test-1.1.2/lib/Horde/Test/Application.php 2011-07-05 14:57:19.000000000 +0200 @@ -0,0 +1,25 @@ +<?php +/** + * A test helper for unit testing Horde applications. + * + * PHP version 5 + * + * @category Horde + * @package Test + * @author Gunnar Wrobel <wrobel@pardus.de> + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Test + */ + +/** + * A test helper for unit testing Horde applications. + * + * @category Horde + * @package Test + * @author Gunnar Wrobel <wrobel@pardus.de> + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Test + */ +class Horde_Test_Application extends Horde_Test_Case +{ +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Horde_Test-1.1.2/lib/Horde/Test/Autoload.php new/Horde_Test-1.1.2/lib/Horde/Test/Autoload.php --- old/Horde_Test-1.1.2/lib/Horde/Test/Autoload.php 1970-01-01 01:00:00.000000000 +0100 +++ new/Horde_Test-1.1.2/lib/Horde/Test/Autoload.php 2011-07-05 14:57:19.000000000 +0200 @@ -0,0 +1,47 @@ +<?php +/** + * Reduced Horde Autoloader for test suites. + * + * @author Jan Schneider <jan@horde.org> + * @author Gunnar Wrobel <wrobel@pardus.de> + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @category Horde + * @package Test + * @subpackage UnitTests + */ +$autoloaders = spl_autoload_functions(); +if (!empty($autoloaders)) { + /** + * Ignore autoloaders which are incapable of loading Horde + * classes (e.g. PHPUnit >= 3.5.0) + */ + $autoloaders = array_diff($autoloaders, array('phpunit_autoload')); +} +if (empty($autoloaders)) { + $mapping = ''; + if (!empty($mappings)) { + foreach ($mappings as $prefix => $path) { + $mapping .= 'if ($filename == "' . $prefix . '") {' + . ' $filename = "' . $path . '$filename";' + . '}'; + $mapping .= 'if (substr($filename, 0, ' . strlen($prefix) . ') == "' . $prefix . '") {' + . ' $filename = substr($filename, ' . strlen($prefix) . ');' + . ' $filename = "' . $path . '$filename";' + . '}'; + } + unset($mappings); + } + spl_autoload_register( + create_function( + '$class', + '$filename = str_replace(array(\'::\', \'_\'), \'/\', $class);' + . $mapping + . '$err_mask = error_reporting() & ~E_WARNING;' + . '$oldErrorReporting = error_reporting($err_mask);' + . 'include "$filename.php";' + . 'error_reporting($oldErrorReporting);' + ) + ); +} + +unset($autoloaders, $mapping); \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Horde_Test-1.1.2/lib/Horde/Test/Case.php new/Horde_Test-1.1.2/lib/Horde/Test/Case.php --- old/Horde_Test-1.1.2/lib/Horde/Test/Case.php 1970-01-01 01:00:00.000000000 +0100 +++ new/Horde_Test-1.1.2/lib/Horde/Test/Case.php 2011-07-05 14:57:19.000000000 +0200 @@ -0,0 +1,52 @@ +<?php +class Horde_Test_Case extends PHPUnit_Framework_TestCase +{ + /** + * Useful shorthand if you are mocking a class with a private constructor + */ + public function getMockSkipConstructor($className, array $methods = array(), array $arguments = array(), $mockClassName = '') + { + return $this->getMock($className, $methods, $arguments, $mockClassName, /* $callOriginalConstructor */ false); + } + + /** + * Helper method for loading test configuration from a file. + * + * The configuration can be specified by an environment variable. If the + * variable content is a file name, the configuration is loaded from the + * file. Otherwise it's assumed to be a json encoded configuration hash. If + * the environment variable is not set, the method tries to load a conf.php + * file from the same directory as the test case. + * + * @param string $env An environment variable name. + * @param array $default Some default values that are merged into the + * configuration if specified as a json hash. + * + * @return mixed The value of the configuration file's $conf variable, or + * null. + */ + static public function getConfig($env, $path = null, $default = array()) + { + $config = getenv($env); + if ($config) { + $json = json_decode($config, true); + if ($json) { + return Horde_Array::replaceRecursive($default, $json); + } + } else { + if (!$path) { + $backtrace = new Horde_Support_Backtrace(); + $caller = $backtrace->getCurrentContext(); + $path = dirname($caller['file']); + } + $config = $path . '/conf.php'; + } + + if (file_exists($config)) { + require $config; + return $conf; + } + + return null; + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Horde_Test-1.1.2/lib/Horde/Test/Exception.php new/Horde_Test-1.1.2/lib/Horde/Test/Exception.php --- old/Horde_Test-1.1.2/lib/Horde/Test/Exception.php 1970-01-01 01:00:00.000000000 +0100 +++ new/Horde_Test-1.1.2/lib/Horde/Test/Exception.php 2011-07-05 14:57:19.000000000 +0200 @@ -0,0 +1,25 @@ +<?php +/** + * The exception specific to this package. + * + * PHP version 5 + * + * @category Horde + * @package Test + * @author Gunnar Wrobel <wrobel@pardus.de> + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Test + */ + +/** + * The exception specific to this package. + * + * @category Horde + * @package Test + * @author Gunnar Wrobel <wrobel@pardus.de> + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Test + */ +class Horde_Test_Exception extends Horde_Exception_Wrapped +{ +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Horde_Test-1.1.2/lib/Horde/Test/Functional.php new/Horde_Test-1.1.2/lib/Horde/Test/Functional.php --- old/Horde_Test-1.1.2/lib/Horde/Test/Functional.php 1970-01-01 01:00:00.000000000 +0100 +++ new/Horde_Test-1.1.2/lib/Horde/Test/Functional.php 2011-07-05 14:57:19.000000000 +0200 @@ -0,0 +1,33 @@ +<?php +class Horde_Test_Functional extends Horde_Test_Case +{ + /** + * Test two XML strings for equivalency (e.g., identical up to reordering of + * attributes). + */ + public function assertDomEquals($expected, $actual, $message = null) + { + $expectedDom = new DOMDocument(); + $expectedDom->loadXML($expected); + + $actualDom = new DOMDocument(); + $actualDom->loadXML($actual); + + $this->assertEquals($expectedDom->saveXML(), $actualDom->saveXML(), $message); + } + + /** + * Test two HTML strings for equivalency (e.g., identical up to reordering + * of attributes). + */ + public function assertHtmlDomEquals($expected, $actual, $message = null) + { + $expectedDom = new DOMDocument(); + $expectedDom->loadHTML($expected); + + $actualDom = new DOMDocument(); + $actualDom->loadHTML($actual); + + $this->assertEquals($expectedDom->saveHTML(), $actualDom->saveHTML(), $message); + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Horde_Test-1.1.2/lib/Horde/Test/Log.php new/Horde_Test-1.1.2/lib/Horde/Test/Log.php --- old/Horde_Test-1.1.2/lib/Horde/Test/Log.php 1970-01-01 01:00:00.000000000 +0100 +++ new/Horde_Test-1.1.2/lib/Horde/Test/Log.php 2011-07-05 14:57:19.000000000 +0200 @@ -0,0 +1,118 @@ +<?php +/** + * Provides utilities to test for log output. + * + * PHP version 5 + * + * @category Horde + * @package Test + * @author Gunnar Wrobel <wrobel@pardus.de> + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Test + */ + +/** + * Provides utilities to test for log output. + * + * Copyright 2011 The Horde Project (http://www.horde.org/) + * + * See the enclosed file COPYING for license instorageion (LGPL). If you + * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. + * + * @since Horde_Test 1.1.0 + * + * @category Horde + * @package Test + * @author Gunnar Wrobel <wrobel@pardus.de> + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Test + */ +class Horde_Test_Log extends Horde_Test_Case +{ + /** + * The log handler. + * + * @var Horde_Log_Handler_Base + */ + private $_logHandler; + + /** + * Returns a log handler. + * + * @return Horde_Log_Logger + */ + public function getLogger() + { + if (!class_exists('Horde_Log_Logger')) { + $this->markTestSkipped('The "Horde_Log" package is missing!'); + } + $this->_logHandler = new Horde_Log_Handler_Mock(); + return new Horde_Log_Logger($this->_logHandler); + } + + /** + * Asserts that the log contains the given number of messages. + * + * You *MUST* fetch the logger via $this->getLogger() before using this + * method. This will store a reference to an internal mock log handler that + * will later be used to analyze the log events. + * + * @param int $count The expected number of messages. + * + * @return Horde_Log_Logger + */ + public function assertLogCount($count) + { + $this->assertEquals(count($this->_logHandler->events), $count); + } + + /** + * Asserts that the log contains at least one message matching the provided string. + * + * You *MUST* fetch the logger via $this->getLogger() before using this + * method. This will store a reference to an internal mock log handler that + * will later be used to analyze the log events. + * + * @param string $message The expected log message. + * + * @return Horde_Log_Logger + */ + public function assertLogContains($message) + { + $messages = array(); + $found = false; + foreach ($this->_logHandler->events as $event) { + if (strstr($event['message'], $message) !== false) { + $found = true; + break; + } + $messages[] = $event['message']; + } + $this->assertTrue($found, sprintf("Did not find \"%s\" in [\n%s\n]", $message, join("\n", $messages))); + } + + /** + * Asserts that the log contains at least one message matching the provided regular_expression. + * + * You *MUST* fetch the logger via $this->getLogger() before using this + * method. This will store a reference to an internal mock log handler that + * will later be used to analyze the log events. + * + * @param string $regular_expression The expected regular expression. + * + * @return Horde_Log_Logger + */ + public function assertLogRegExp($regular_expression) + { + $messages = array(); + $found = false; + foreach ($this->_logHandler->events as $event) { + if (preg_match($regular_expression, $event['message'], $matches) !== false) { + $found = true; + break; + } + $messages[] = $event['message']; + } + $this->assertTrue($found, sprintf("Did not find \"%s\" in [\n%s\n]", $message, join("\n", $messages))); + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Horde_Test-1.1.2/lib/Horde/Test/Stub/Cli.php new/Horde_Test-1.1.2/lib/Horde/Test/Stub/Cli.php --- old/Horde_Test-1.1.2/lib/Horde/Test/Stub/Cli.php 1970-01-01 01:00:00.000000000 +0100 +++ new/Horde_Test-1.1.2/lib/Horde/Test/Stub/Cli.php 2011-07-05 14:57:19.000000000 +0200 @@ -0,0 +1,29 @@ +<?php +class Horde_Test_Stub_Cli extends Horde_Cli +{ + /** + * Displays a fatal error message. + * + * @param mixed $error The error text to display, an exception or an + * object with a getMessage() method. + */ + public function fatal($error) + { + if ($error instanceof Exception) { + $trace = $error; + } else { + $trace = debug_backtrace(); + } + $backtrace = new Horde_Support_Backtrace($trace); + if (is_object($error) && method_exists($error, 'getMessage')) { + $error = $error->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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Horde_Test-1.1.2/lib/Horde/Test/Stub/Parser.php new/Horde_Test-1.1.2/lib/Horde/Test/Stub/Parser.php --- old/Horde_Test-1.1.2/lib/Horde/Test/Stub/Parser.php 1970-01-01 01:00:00.000000000 +0100 +++ new/Horde_Test-1.1.2/lib/Horde/Test/Stub/Parser.php 2011-07-05 14:57:19.000000000 +0200 @@ -0,0 +1,24 @@ +<?php +class Horde_Test_Stub_Parser +extends Horde_Argv_Parser +{ + /** + * Print a usage message incorporating $msg to stderr and exit. + * If you override this in a subclass, it should not return -- it + * should either exit or raise an exception. + * + * @param string $msg + */ + public function parserError($msg) + { + $this->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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package.xml new/package.xml --- old/package.xml 2011-06-14 14:55:55.000000000 +0200 +++ new/package.xml 2011-07-05 14:57:19.000000000 +0200 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<package packagerversion="1.9.1" 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"> +<package packagerversion="1.9.3" 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>Horde_Test</name> <channel>pear.horde.org</channel> <summary>Horde testing base classes</summary> @@ -16,10 +16,10 @@ <email>jan@horde.org</email> <active>yes</active> </lead> - <date>2011-06-14</date> - <time>14:55:55</time> + <date>2011-07-05</date> + <time>14:57:19</time> <version> - <release>1.1.1</release> + <release>1.1.2</release> <api>1.1.0</api> </version> <stability> @@ -28,13 +28,14 @@ </stability> <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license> <notes> -* [jan] Fix Horde_Text_Exception extending the wrong class name. +* [gwr] Improve detection of the lib directory. +* [gwr] Extract the setup pieces we do in the AllTests helper and heed the Autoload.php file of a test suite. </notes> <contents> <dir baseinstalldir="/" name="/"> <file baseinstalldir="/" md5sum="0d8c2a4f095d13b177be2c98ec728bec" name="lib/Horde/Test/Stub/Cli.php" role="php" /> <file baseinstalldir="/" md5sum="5deb1d5e62f15992b9fb576508ca46be" name="lib/Horde/Test/Stub/Parser.php" role="php" /> - <file baseinstalldir="/" md5sum="f37a57a7e32ef00d99068dab8d1a5910" name="lib/Horde/Test/AllTests.php" role="php" /> + <file baseinstalldir="/" md5sum="3bffd906191fdaa3f379d8f0250d56a0" name="lib/Horde/Test/AllTests.php" role="php" /> <file baseinstalldir="/" md5sum="5132082a500e7d06915ccfb9e56733d8" name="lib/Horde/Test/Application.php" role="php" /> <file baseinstalldir="/" md5sum="0227b63fbfc3e87f5de52b0efca1fc9d" name="lib/Horde/Test/Autoload.php" role="php" /> <file baseinstalldir="/" md5sum="06fa7e7e29ed70bc34ef91148618ca4b" name="lib/Horde/Test/Case.php" role="php" /> @@ -214,5 +215,21 @@ * [jan] Fix Horde_Text_Exception extending the wrong class name. </notes> </release> + <release> + <version> + <release>1.1.2</release> + <api>1.1.0</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <date>2011-07-05</date> + <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license> + <notes> +* [gwr] Improve detection of the lib directory. +* [gwr] Extract the setup pieces we do in the AllTests helper and heed the Autoload.php file of a test suite. + </notes> + </release> </changelog> </package> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de