gunnar: server/kolab-webadmin/kolab-webadmin/test/KolabAdmin AllTests.php, NONE, 1.1 TestInit.php, NONE, 1.1

cvs at kolab.org cvs at kolab.org
Wed Feb 17 08:34:28 CET 2010


Author: gunnar

Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/test/KolabAdmin
In directory doto:/tmp/cvs-serv22963/test/KolabAdmin

Added Files:
	AllTests.php TestInit.php 
Log Message:
Start adding the standard unit test suite.

--- NEW FILE: AllTests.php ---
<?php
/**
 * All tests for the KolabAdmin application.
 *
 * PHP version 5
 *
 * @category Kolab
 * @package  KolabAdmin
 * @author   Gunnar Wrobel <wrobel at pardus.de>
 * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
 * @link     http://pear.horde.org/index.php?package=KolabAdmin
 */

if (!defined('PHPUnit_MAIN_METHOD')) {
    define('PHPUnit_MAIN_METHOD', 'KolabAdmin_AllTests::main');
}

/**
 * Initialize testing for this application.
 */
require_once 'TestInit.php';

/**
 * Combine the tests for this package.
 *
 * Copyright 2007-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 Kolab
 * @package  KolabAdmin
 * @author   Gunnar Wrobel <wrobel at pardus.de>
 * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
 * @link     http://pear.horde.org/index.php?package=KolabAdmin
 */
class KolabAdmin_AllTests
{
    /**
     * Main entry point for running the suite.
     *
     * @return NULL
     */
    public static function main()
    {
        PHPUnit_TextUI_TestRunner::run(self::suite());
    }

    /**
     * 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);

        // Build the suite
        $suite = new PHPUnit_Framework_TestSuite('KolabAdmin');

        $basedir = dirname(__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();
                require $pathname;

                $class = str_replace(DIRECTORY_SEPARATOR, '_',
                                     preg_replace("/^$baseregexp(.*)\.php/", '\\1', $pathname));
                $suite->addTestSuite('KolabAdmin_' . $class);
            }
        }

        return $suite;
    }

}

if (PHPUnit_MAIN_METHOD == 'KolabAdmin_AllTests::main') {
    KolabAdmin_AllTests::main();
}

--- NEW FILE: TestInit.php ---
<?php
/**
 * Initialize testing for this application.
 *
 * PHP version 5
 *
 * @category Kolab
 * @package  KolabAdmin
 * @author   Gunnar Wrobel <wrobel at pardus.de>
 * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
 * @link     http://pear.horde.org/index.php?package=KolabAdmin
 */

/**
 * The Autoloader allows us to omit "require/include" statements.
 */
require_once 'Horde/Autoloader.php';

if (!defined('KOWARD_BASE')) {
    define('KOWARD_BASE', dirname(__FILE__) . '/../');
}

/* Set up the application class and controller loading */
Horde_Autoloader::addClassPattern('/^KolabAdmin_/', KOWARD_BASE . '/lib/');
Horde_Autoloader::addClassPattern('/^KolabAdmin_/', KOWARD_BASE . '/app/controllers/');





More information about the commits mailing list