summaryrefslogtreecommitdiffstats
path: root/Autoload.php.in
blob: 83fd1fbfc1e8c193e5482e7502e815e4ceaf77d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
/* Inspipred from Autoload from version 3.7 */

/* Required */
require_once 'File/Iterator/Autoload.php';
require_once 'PHP/CodeCoverage/Autoload.php';
require_once 'PHP/Timer/Autoload.php';
require_once 'PHPUnit/Framework/MockObject/Autoload.php';
require_once 'Text/Template/Autoload.php';
require_once 'PHP/Invoker/Autoload.php';
require_once 'SebastianBergmann/Diff/autoload.php';
require_once 'SebastianBergmann/Environment/autoload.php';
require_once 'SebastianBergmann/Exporter/autoload.php';
require_once 'SebastianBergmann/Version/autoload.php';

spl_autoload_register(
  function ($class)
  {
      static $classes = NULL;
      static $path    = NULL;

      if ($classes === NULL) {
          $classes = array(
            ___CLASSLIST___
          );

          $path = dirname(__FILE__);
      }

      $cn = strtolower($class);

      if (isset($classes[$cn])) {
          require $path . $classes[$cn];
      }
  }
);

// Symfony Yaml autoloader
spl_autoload_register(
  function ($class) {
      if (0 === strpos(ltrim($class, '/'), 'Symfony\Component\Yaml')) {
          $file = sprintf(
            'Symfony/Component/Yaml%s.php',

            substr(
              str_replace('\\', '/', $class),
              strlen('Symfony\Component\Yaml')
            )
          );

          if (stream_resolve_include_path($file)) {
              require_once $file;
          }
      }
  }
);

/* Optional */

if (stream_resolve_include_path('PHPUnit/Extensions/Database/Autoload.php')) {
    require_once 'PHPUnit/Extensions/Database/Autoload.php';
}

if (stream_resolve_include_path('PHPUnit/Extensions/SeleniumCommon/Autoload.php')) {
    require_once 'PHPUnit/Extensions/SeleniumCommon/Autoload.php';
}

else if (stream_resolve_include_path('PHPUnit/Extensions/SeleniumTestCase/Autoload.php')) {
    require_once 'PHPUnit/Extensions/SeleniumTestCase/Autoload.php';
}

if (stream_resolve_include_path('PHPUnit/Extensions/Story/Autoload.php')) {
    require_once 'PHPUnit/Extensions/Story/Autoload.php';
}