1<?php
2/**
3 * PHPUnit
4 *
5 * Copyright (c) 2001-2012, Sebastian Bergmann <sebastian@phpunit.de>.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 *   * Redistributions of source code must retain the above copyright
13 *     notice, this list of conditions and the following disclaimer.
14 *
15 *   * Redistributions in binary form must reproduce the above copyright
16 *     notice, this list of conditions and the following disclaimer in
17 *     the documentation and/or other materials provided with the
18 *     distribution.
19 *
20 *   * Neither the name of Sebastian Bergmann nor the names of his
21 *     contributors may be used to endorse or promote products derived
22 *     from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 *
37 * @package    PHPUnit
38 * @author     Sebastian Bergmann <sebastian@phpunit.de>
39 * @copyright  2001-2012 Sebastian Bergmann <sebastian@phpunit.de>
40 * @license    http://www.opensource.org/licenses/BSD-3-Clause  The BSD 3-Clause License
41 * @link       http://www.phpunit.de/
42 * @since      File available since Release 3.5.0
43 */
44
45require_once 'File/Iterator/Autoload.php';
46require_once 'PHP/CodeCoverage/Autoload.php';
47require_once 'PHP/Timer/Autoload.php';
48require_once 'PHPUnit/Framework/MockObject/Autoload.php';
49require_once 'Text/Template/Autoload.php';
50
51function phpunit_autoload($class = NULL)
52{
53    static $classes = NULL;
54    static $path    = NULL;
55
56    if ($classes === NULL) {
57        $classes = array(
58          'phpunit_extensions_grouptestsuite' => '/Extensions/GroupTestSuite.php',
59          'phpunit_extensions_phpttestcase' => '/Extensions/PhptTestCase.php',
60          'phpunit_extensions_phpttestcase_logger' => '/Extensions/PhptTestCase/Logger.php',
61          'phpunit_extensions_phpttestsuite' => '/Extensions/PhptTestSuite.php',
62          'phpunit_extensions_repeatedtest' => '/Extensions/RepeatedTest.php',
63          'phpunit_extensions_testdecorator' => '/Extensions/TestDecorator.php',
64          'phpunit_extensions_ticketlistener' => '/Extensions/TicketListener.php',
65          'phpunit_framework_assert' => '/Framework/Assert.php',
66          'phpunit_framework_assertionfailederror' => '/Framework/AssertionFailedError.php',
67          'phpunit_framework_comparator' => '/Framework/Comparator.php',
68          'phpunit_framework_comparator_array' => '/Framework/Comparator/Array.php',
69          'phpunit_framework_comparator_domdocument' => '/Framework/Comparator/DOMDocument.php',
70          'phpunit_framework_comparator_double' => '/Framework/Comparator/Double.php',
71          'phpunit_framework_comparator_exception' => '/Framework/Comparator/Exception.php',
72          'phpunit_framework_comparator_mockobject' => '/Framework/Comparator/MockObject.php',
73          'phpunit_framework_comparator_numeric' => '/Framework/Comparator/Numeric.php',
74          'phpunit_framework_comparator_object' => '/Framework/Comparator/Object.php',
75          'phpunit_framework_comparator_resource' => '/Framework/Comparator/Resource.php',
76          'phpunit_framework_comparator_scalar' => '/Framework/Comparator/Scalar.php',
77          'phpunit_framework_comparator_splobjectstorage' => '/Framework/Comparator/SplObjectStorage.php',
78          'phpunit_framework_comparator_type' => '/Framework/Comparator/Type.php',
79          'phpunit_framework_comparatorfactory' => '/Framework/ComparatorFactory.php',
80          'phpunit_framework_comparisonfailure' => '/Framework/ComparisonFailure.php',
81          'phpunit_framework_constraint' => '/Framework/Constraint.php',
82          'phpunit_framework_constraint_and' => '/Framework/Constraint/And.php',
83          'phpunit_framework_constraint_arrayhaskey' => '/Framework/Constraint/ArrayHasKey.php',
84          'phpunit_framework_constraint_attribute' => '/Framework/Constraint/Attribute.php',
85          'phpunit_framework_constraint_callback' => '/Framework/Constraint/Callback.php',
86          'phpunit_framework_constraint_classhasattribute' => '/Framework/Constraint/ClassHasAttribute.php',
87          'phpunit_framework_constraint_classhasstaticattribute' => '/Framework/Constraint/ClassHasStaticAttribute.php',
88          'phpunit_framework_constraint_composite' => '/Framework/Constraint/Composite.php',
89          'phpunit_framework_constraint_count' => '/Framework/Constraint/Count.php',
90          'phpunit_framework_constraint_exception' => '/Framework/Constraint/Exception.php',
91          'phpunit_framework_constraint_exceptioncode' => '/Framework/Constraint/ExceptionCode.php',
92          'phpunit_framework_constraint_exceptionmessage' => '/Framework/Constraint/ExceptionMessage.php',
93          'phpunit_framework_constraint_fileexists' => '/Framework/Constraint/FileExists.php',
94          'phpunit_framework_constraint_greaterthan' => '/Framework/Constraint/GreaterThan.php',
95          'phpunit_framework_constraint_isanything' => '/Framework/Constraint/IsAnything.php',
96          'phpunit_framework_constraint_isempty' => '/Framework/Constraint/IsEmpty.php',
97          'phpunit_framework_constraint_isequal' => '/Framework/Constraint/IsEqual.php',
98          'phpunit_framework_constraint_isfalse' => '/Framework/Constraint/IsFalse.php',
99          'phpunit_framework_constraint_isidentical' => '/Framework/Constraint/IsIdentical.php',
100          'phpunit_framework_constraint_isinstanceof' => '/Framework/Constraint/IsInstanceOf.php',
101          'phpunit_framework_constraint_isnull' => '/Framework/Constraint/IsNull.php',
102          'phpunit_framework_constraint_istrue' => '/Framework/Constraint/IsTrue.php',
103          'phpunit_framework_constraint_istype' => '/Framework/Constraint/IsType.php',
104          'phpunit_framework_constraint_jsonmatches' => '/Framework/Constraint/JsonMatches.php',
105          'phpunit_framework_constraint_jsonmatches_errormessageprovider' => '/Framework/Constraint/JsonMatches/ErrorMessageProvider.php',
106          'phpunit_framework_constraint_lessthan' => '/Framework/Constraint/LessThan.php',
107          'phpunit_framework_constraint_not' => '/Framework/Constraint/Not.php',
108          'phpunit_framework_constraint_objecthasattribute' => '/Framework/Constraint/ObjectHasAttribute.php',
109          'phpunit_framework_constraint_or' => '/Framework/Constraint/Or.php',
110          'phpunit_framework_constraint_pcrematch' => '/Framework/Constraint/PCREMatch.php',
111          'phpunit_framework_constraint_samesize' => '/Framework/Constraint/SameSize.php',
112          'phpunit_framework_constraint_stringcontains' => '/Framework/Constraint/StringContains.php',
113          'phpunit_framework_constraint_stringendswith' => '/Framework/Constraint/StringEndsWith.php',
114          'phpunit_framework_constraint_stringmatches' => '/Framework/Constraint/StringMatches.php',
115          'phpunit_framework_constraint_stringstartswith' => '/Framework/Constraint/StringStartsWith.php',
116          'phpunit_framework_constraint_traversablecontains' => '/Framework/Constraint/TraversableContains.php',
117          'phpunit_framework_constraint_traversablecontainsonly' => '/Framework/Constraint/TraversableContainsOnly.php',
118          'phpunit_framework_constraint_xor' => '/Framework/Constraint/Xor.php',
119          'phpunit_framework_error' => '/Framework/Error.php',
120          'phpunit_framework_error_deprecated' => '/Framework/Error/Deprecated.php',
121          'phpunit_framework_error_notice' => '/Framework/Error/Notice.php',
122          'phpunit_framework_error_warning' => '/Framework/Error/Warning.php',
123          'phpunit_framework_exception' => '/Framework/Exception.php',
124          'phpunit_framework_expectationfailedexception' => '/Framework/ExpectationFailedException.php',
125          'phpunit_framework_incompletetest' => '/Framework/IncompleteTest.php',
126          'phpunit_framework_incompletetesterror' => '/Framework/IncompleteTestError.php',
127          'phpunit_framework_outputerror' => '/Framework/OutputError.php',
128          'phpunit_framework_selfdescribing' => '/Framework/SelfDescribing.php',
129          'phpunit_framework_skippedtest' => '/Framework/SkippedTest.php',
130          'phpunit_framework_skippedtesterror' => '/Framework/SkippedTestError.php',
131          'phpunit_framework_skippedtestsuiteerror' => '/Framework/SkippedTestSuiteError.php',
132          'phpunit_framework_syntheticerror' => '/Framework/SyntheticError.php',
133          'phpunit_framework_test' => '/Framework/Test.php',
134          'phpunit_framework_testcase' => '/Framework/TestCase.php',
135          'phpunit_framework_testfailure' => '/Framework/TestFailure.php',
136          'phpunit_framework_testlistener' => '/Framework/TestListener.php',
137          'phpunit_framework_testresult' => '/Framework/TestResult.php',
138          'phpunit_framework_testsuite' => '/Framework/TestSuite.php',
139          'phpunit_framework_testsuite_dataprovider' => '/Framework/TestSuite/DataProvider.php',
140          'phpunit_framework_warning' => '/Framework/Warning.php',
141          'phpunit_runner_basetestrunner' => '/Runner/BaseTestRunner.php',
142          'phpunit_runner_standardtestsuiteloader' => '/Runner/StandardTestSuiteLoader.php',
143          'phpunit_runner_testsuiteloader' => '/Runner/TestSuiteLoader.php',
144          'phpunit_runner_version' => '/Runner/Version.php',
145          'phpunit_textui_command' => '/TextUI/Command.php',
146          'phpunit_textui_resultprinter' => '/TextUI/ResultPrinter.php',
147          'phpunit_textui_testrunner' => '/TextUI/TestRunner.php',
148          'phpunit_util_class' => '/Util/Class.php',
149          'phpunit_util_configuration' => '/Util/Configuration.php',
150          'phpunit_util_deprecatedfeature' => '/Util/DeprecatedFeature.php',
151          'phpunit_util_deprecatedfeature_logger' => '/Util/DeprecatedFeature/Logger.php',
152          'phpunit_util_diff' => '/Util/Diff.php',
153          'phpunit_util_errorhandler' => '/Util/ErrorHandler.php',
154          'phpunit_util_fileloader' => '/Util/Fileloader.php',
155          'phpunit_util_filesystem' => '/Util/Filesystem.php',
156          'phpunit_util_filter' => '/Util/Filter.php',
157          'phpunit_util_getopt' => '/Util/Getopt.php',
158          'phpunit_util_globalstate' => '/Util/GlobalState.php',
159          'phpunit_util_invalidargumenthelper' => '/Util/InvalidArgumentHelper.php',
160          'phpunit_util_log_json' => '/Util/Log/JSON.php',
161          'phpunit_util_log_junit' => '/Util/Log/JUnit.php',
162          'phpunit_util_log_tap' => '/Util/Log/TAP.php',
163          'phpunit_util_php' => '/Util/PHP.php',
164          'phpunit_util_php_default' => '/Util/PHP/Default.php',
165          'phpunit_util_php_windows' => '/Util/PHP/Windows.php',
166          'phpunit_util_printer' => '/Util/Printer.php',
167          'phpunit_util_string' => '/Util/String.php',
168          'phpunit_util_test' => '/Util/Test.php',
169          'phpunit_util_testdox_nameprettifier' => '/Util/TestDox/NamePrettifier.php',
170          'phpunit_util_testdox_resultprinter' => '/Util/TestDox/ResultPrinter.php',
171          'phpunit_util_testdox_resultprinter_html' => '/Util/TestDox/ResultPrinter/HTML.php',
172          'phpunit_util_testdox_resultprinter_text' => '/Util/TestDox/ResultPrinter/Text.php',
173          'phpunit_util_testsuiteiterator' => '/Util/TestSuiteIterator.php',
174          'phpunit_util_type' => '/Util/Type.php',
175          'phpunit_util_xml' => '/Util/XML.php'
176        );
177
178        $path = dirname(__FILE__);
179    }
180
181    if ($class === NULL) {
182        $result = array(__FILE__);
183
184        if (isset($_SERVER['_']) &&
185            strpos($_SERVER['_'], 'phpunit') !== FALSE) {
186            $result[] = $_SERVER['_'];
187        }
188
189        foreach ($classes as $file) {
190            $result[] = $path . $file;
191        }
192
193        return $result;
194    }
195
196    $cn = strtolower($class);
197
198    if (isset($classes[$cn])) {
199        $file = $path . $classes[$cn];
200
201        require $file;
202    }
203}
204
205spl_autoload_register('phpunit_autoload');
206
207if (stream_resolve_include_path('PHP/Invoker/Autoload.php')) {
208    require_once 'PHP/Invoker/Autoload.php';
209}
210
211if (stream_resolve_include_path('PHPUnit/Extensions/Database/Autoload.php')) {
212    require_once 'PHPUnit/Extensions/Database/Autoload.php';
213}
214
215if (stream_resolve_include_path('PHPUnit/Extensions/SeleniumCommon/Autoload.php')) {
216    require_once 'PHPUnit/Extensions/SeleniumCommon/Autoload.php';
217}
218
219else if (stream_resolve_include_path('PHPUnit/Extensions/SeleniumTestCase/Autoload.php')) {
220    require_once 'PHPUnit/Extensions/SeleniumTestCase/Autoload.php';
221}
222
223if (stream_resolve_include_path('PHPUnit/Extensions/Story/Autoload.php')) {
224    require_once 'PHPUnit/Extensions/Story/Autoload.php';
225}
226