Overview

Packages

  • Horde
    • Icalendar
      • UnitTests
  • Ingo
    • UnitTests
  • None

Classes

  • Ingo_AllTests
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Copyright 2009-2012 Horde LLC (http://www.horde.org/)
 4:  *
 5:  * @category   Horde
 6:  * @package    Ingo
 7:  * @subpackage UnitTests
 8:  * @license    http://www.horde.org/licenses/lgpl21
 9:  */
10: 
11: /**
12:  * Define the main method
13:  */
14: if (!defined('PHPUnit_MAIN_METHOD')) {
15:     define('PHPUnit_MAIN_METHOD', 'Ingo_AllTests::main');
16: }
17: 
18: /**
19:  * Prepare the test setup.
20:  */
21: @define('INGO_BASE', dirname(__FILE__) . '/../..');
22: require_once 'Horde/Autoloader/Default.php';
23: date_default_timezone_set('Europe/Berlin');
24: 
25: /**
26:  * @package    Horde_Icalendar
27:  * @subpackage UnitTests
28:  */
29: class Ingo_AllTests extends Horde_Test_AllTests
30: {
31:    /**
32:     * Collect the unit tests of this directory into a new suite.
33:     *
34:     * @return PHPUnit_Framework_TestSuite The test suite.
35:     */
36:     public static function suite()
37:     {
38:         // Catch strict standards
39:         error_reporting(E_ALL);
40: 
41:         // Set up autoload
42:         $basedir = dirname(__FILE__);
43:         $GLOBALS['__autoloader']->addClassPathMapper(new Horde_Autoloader_ClassPathMapper_Prefix('/^Ingo(?:$|_)/', $basedir . '/../'));
44: 
45:         $suite = new PHPUnit_Framework_TestSuite('Ingo');
46:         $baseregexp = preg_quote($basedir . DIRECTORY_SEPARATOR, '/');
47: 
48:         foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($basedir)) as $file) {
49:             if ($file->isFile() && preg_match('/Test.php$/', $file->getFilename())) {
50:                 $pathname = $file->getPathname();
51:                 require $pathname;
52: 
53:                 $class = str_replace(DIRECTORY_SEPARATOR, '_',
54:                                      preg_replace("/^$baseregexp(.*)\.php/", '\\1', $pathname));
55:                 $suite->addTestSuite('Ingo_' . $class);
56:             }
57:         }
58: 
59:         return $suite;
60:     }
61: }
62: 
63: if (PHPUnit_MAIN_METHOD == 'Ingo_AllTests::main') {
64:     Ingo_AllTests::main('Ingo', __FILE__);
65: }
66: 
API documentation generated by ApiGen