PageRenderTime 49ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/libs/PHPUnit/Autoload.php

https://bitbucket.org/AndreasLoew/piecrust
PHP | 220 lines | 162 code | 16 blank | 42 comment | 8 complexity | 8417f14aa6c32d383cc516475c8d382a MD5 | raw file
Possible License(s): GPL-3.0, BSD-3-Clause, Apache-2.0
  1. <?php
  2. /**
  3. * PHPUnit
  4. *
  5. * Copyright (c) 2002-2011, 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 2002-2011 Sebastian Bergmann <sebastian@phpunit.de>
  40. * @license http://www.opensource.org/licenses/bsd-license.php BSD License
  41. * @link http://www.phpunit.de/
  42. * @since File available since Release 3.5.0
  43. */
  44. require_once 'File/Iterator/Autoload.php';
  45. require_once 'PHP/CodeCoverage/Autoload.php';
  46. require_once 'PHP/Timer/Autoload.php';
  47. require_once 'PHPUnit/Framework/MockObject/Autoload.php';
  48. require_once 'Text/Template/Autoload.php';
  49. function phpunit_autoload($class = NULL)
  50. {
  51. static $classes = NULL;
  52. static $path = NULL;
  53. if ($classes === NULL) {
  54. $classes = array(
  55. 'phpunit_extensions_grouptestsuite' => '/Extensions/GroupTestSuite.php',
  56. 'phpunit_extensions_outputtestcase' => '/Extensions/OutputTestCase.php',
  57. 'phpunit_extensions_phpttestcase' => '/Extensions/PhptTestCase.php',
  58. 'phpunit_extensions_phpttestcase_logger' => '/Extensions/PhptTestCase/Logger.php',
  59. 'phpunit_extensions_phpttestsuite' => '/Extensions/PhptTestSuite.php',
  60. 'phpunit_extensions_repeatedtest' => '/Extensions/RepeatedTest.php',
  61. 'phpunit_extensions_testdecorator' => '/Extensions/TestDecorator.php',
  62. 'phpunit_extensions_ticketlistener' => '/Extensions/TicketListener.php',
  63. 'phpunit_framework_assert' => '/Framework/Assert.php',
  64. 'phpunit_framework_assertionfailederror' => '/Framework/AssertionFailedError.php',
  65. 'phpunit_framework_comparator' => '/Framework/Comparator.php',
  66. 'phpunit_framework_comparator_array' => '/Framework/Comparator/Array.php',
  67. 'phpunit_framework_comparator_domdocument' => '/Framework/Comparator/DOMDocument.php',
  68. 'phpunit_framework_comparator_double' => '/Framework/Comparator/Double.php',
  69. 'phpunit_framework_comparator_exception' => '/Framework/Comparator/Exception.php',
  70. 'phpunit_framework_comparator_mockobject' => '/Framework/Comparator/MockObject.php',
  71. 'phpunit_framework_comparator_numeric' => '/Framework/Comparator/Numeric.php',
  72. 'phpunit_framework_comparator_object' => '/Framework/Comparator/Object.php',
  73. 'phpunit_framework_comparator_resource' => '/Framework/Comparator/Resource.php',
  74. 'phpunit_framework_comparator_scalar' => '/Framework/Comparator/Scalar.php',
  75. 'phpunit_framework_comparator_splobjectstorage' => '/Framework/Comparator/SplObjectStorage.php',
  76. 'phpunit_framework_comparator_type' => '/Framework/Comparator/Type.php',
  77. 'phpunit_framework_comparatorfactory' => '/Framework/ComparatorFactory.php',
  78. 'phpunit_framework_comparisonfailure' => '/Framework/ComparisonFailure.php',
  79. 'phpunit_framework_constraint' => '/Framework/Constraint.php',
  80. 'phpunit_framework_constraint_and' => '/Framework/Constraint/And.php',
  81. 'phpunit_framework_constraint_arrayhaskey' => '/Framework/Constraint/ArrayHasKey.php',
  82. 'phpunit_framework_constraint_attribute' => '/Framework/Constraint/Attribute.php',
  83. 'phpunit_framework_constraint_classhasattribute' => '/Framework/Constraint/ClassHasAttribute.php',
  84. 'phpunit_framework_constraint_classhasstaticattribute' => '/Framework/Constraint/ClassHasStaticAttribute.php',
  85. 'phpunit_framework_constraint_composite' => '/Framework/Constraint/Composite.php',
  86. 'phpunit_framework_constraint_count' => '/Framework/Constraint/Count.php',
  87. 'phpunit_framework_constraint_fileexists' => '/Framework/Constraint/FileExists.php',
  88. 'phpunit_framework_constraint_greaterthan' => '/Framework/Constraint/GreaterThan.php',
  89. 'phpunit_framework_constraint_isanything' => '/Framework/Constraint/IsAnything.php',
  90. 'phpunit_framework_constraint_isempty' => '/Framework/Constraint/IsEmpty.php',
  91. 'phpunit_framework_constraint_isequal' => '/Framework/Constraint/IsEqual.php',
  92. 'phpunit_framework_constraint_isfalse' => '/Framework/Constraint/IsFalse.php',
  93. 'phpunit_framework_constraint_isidentical' => '/Framework/Constraint/IsIdentical.php',
  94. 'phpunit_framework_constraint_isinstanceof' => '/Framework/Constraint/IsInstanceOf.php',
  95. 'phpunit_framework_constraint_isnull' => '/Framework/Constraint/IsNull.php',
  96. 'phpunit_framework_constraint_istrue' => '/Framework/Constraint/IsTrue.php',
  97. 'phpunit_framework_constraint_istype' => '/Framework/Constraint/IsType.php',
  98. 'phpunit_framework_constraint_lessthan' => '/Framework/Constraint/LessThan.php',
  99. 'phpunit_framework_constraint_not' => '/Framework/Constraint/Not.php',
  100. 'phpunit_framework_constraint_objecthasattribute' => '/Framework/Constraint/ObjectHasAttribute.php',
  101. 'phpunit_framework_constraint_or' => '/Framework/Constraint/Or.php',
  102. 'phpunit_framework_constraint_pcrematch' => '/Framework/Constraint/PCREMatch.php',
  103. 'phpunit_framework_constraint_samesize' => '/Framework/Constraint/SameSize.php',
  104. 'phpunit_framework_constraint_stringcontains' => '/Framework/Constraint/StringContains.php',
  105. 'phpunit_framework_constraint_stringendswith' => '/Framework/Constraint/StringEndsWith.php',
  106. 'phpunit_framework_constraint_stringmatches' => '/Framework/Constraint/StringMatches.php',
  107. 'phpunit_framework_constraint_stringstartswith' => '/Framework/Constraint/StringStartsWith.php',
  108. 'phpunit_framework_constraint_traversablecontains' => '/Framework/Constraint/TraversableContains.php',
  109. 'phpunit_framework_constraint_traversablecontainsonly' => '/Framework/Constraint/TraversableContainsOnly.php',
  110. 'phpunit_framework_constraint_xor' => '/Framework/Constraint/Xor.php',
  111. 'phpunit_framework_error' => '/Framework/Error.php',
  112. 'phpunit_framework_error_deprecated' => '/Framework/Error/Deprecated.php',
  113. 'phpunit_framework_error_notice' => '/Framework/Error/Notice.php',
  114. 'phpunit_framework_error_warning' => '/Framework/Error/Warning.php',
  115. 'phpunit_framework_exception' => '/Framework/Exception.php',
  116. 'phpunit_framework_expectationfailedexception' => '/Framework/ExpectationFailedException.php',
  117. 'phpunit_framework_incompletetest' => '/Framework/IncompleteTest.php',
  118. 'phpunit_framework_incompletetesterror' => '/Framework/IncompleteTestError.php',
  119. 'phpunit_framework_outputerror' => '/Framework/OutputError.php',
  120. 'phpunit_framework_selfdescribing' => '/Framework/SelfDescribing.php',
  121. 'phpunit_framework_skippedtest' => '/Framework/SkippedTest.php',
  122. 'phpunit_framework_skippedtesterror' => '/Framework/SkippedTestError.php',
  123. 'phpunit_framework_skippedtestsuiteerror' => '/Framework/SkippedTestSuiteError.php',
  124. 'phpunit_framework_syntheticerror' => '/Framework/SyntheticError.php',
  125. 'phpunit_framework_test' => '/Framework/Test.php',
  126. 'phpunit_framework_testcase' => '/Framework/TestCase.php',
  127. 'phpunit_framework_testfailure' => '/Framework/TestFailure.php',
  128. 'phpunit_framework_testlistener' => '/Framework/TestListener.php',
  129. 'phpunit_framework_testresult' => '/Framework/TestResult.php',
  130. 'phpunit_framework_testsuite' => '/Framework/TestSuite.php',
  131. 'phpunit_framework_testsuite_dataprovider' => '/Framework/TestSuite/DataProvider.php',
  132. 'phpunit_framework_warning' => '/Framework/Warning.php',
  133. 'phpunit_runner_basetestrunner' => '/Runner/BaseTestRunner.php',
  134. 'phpunit_runner_standardtestsuiteloader' => '/Runner/StandardTestSuiteLoader.php',
  135. 'phpunit_runner_testsuiteloader' => '/Runner/TestSuiteLoader.php',
  136. 'phpunit_runner_version' => '/Runner/Version.php',
  137. 'phpunit_textui_command' => '/TextUI/Command.php',
  138. 'phpunit_textui_resultprinter' => '/TextUI/ResultPrinter.php',
  139. 'phpunit_textui_testrunner' => '/TextUI/TestRunner.php',
  140. 'phpunit_util_class' => '/Util/Class.php',
  141. 'phpunit_util_configuration' => '/Util/Configuration.php',
  142. 'phpunit_util_deprecatedfeature' => '/Util/DeprecatedFeature.php',
  143. 'phpunit_util_deprecatedfeature_logger' => '/Util/DeprecatedFeature/Logger.php',
  144. 'phpunit_util_diff' => '/Util/Diff.php',
  145. 'phpunit_util_errorhandler' => '/Util/ErrorHandler.php',
  146. 'phpunit_util_file' => '/Util/File.php',
  147. 'phpunit_util_fileloader' => '/Util/Fileloader.php',
  148. 'phpunit_util_filesystem' => '/Util/Filesystem.php',
  149. 'phpunit_util_filter' => '/Util/Filter.php',
  150. 'phpunit_util_getopt' => '/Util/Getopt.php',
  151. 'phpunit_util_globalstate' => '/Util/GlobalState.php',
  152. 'phpunit_util_invalidargumenthelper' => '/Util/InvalidArgumentHelper.php',
  153. 'phpunit_util_log_json' => '/Util/Log/JSON.php',
  154. 'phpunit_util_log_junit' => '/Util/Log/JUnit.php',
  155. 'phpunit_util_log_tap' => '/Util/Log/TAP.php',
  156. 'phpunit_util_php' => '/Util/PHP.php',
  157. 'phpunit_util_php_default' => '/Util/PHP/Default.php',
  158. 'phpunit_util_php_windows' => '/Util/PHP/Windows.php',
  159. 'phpunit_util_printer' => '/Util/Printer.php',
  160. 'phpunit_util_skeleton' => '/Util/Skeleton.php',
  161. 'phpunit_util_skeleton_class' => '/Util/Skeleton/Class.php',
  162. 'phpunit_util_skeleton_test' => '/Util/Skeleton/Test.php',
  163. 'phpunit_util_string' => '/Util/String.php',
  164. 'phpunit_util_test' => '/Util/Test.php',
  165. 'phpunit_util_testdox_nameprettifier' => '/Util/TestDox/NamePrettifier.php',
  166. 'phpunit_util_testdox_resultprinter' => '/Util/TestDox/ResultPrinter.php',
  167. 'phpunit_util_testdox_resultprinter_html' => '/Util/TestDox/ResultPrinter/HTML.php',
  168. 'phpunit_util_testdox_resultprinter_text' => '/Util/TestDox/ResultPrinter/Text.php',
  169. 'phpunit_util_testsuiteiterator' => '/Util/TestSuiteIterator.php',
  170. 'phpunit_util_type' => '/Util/Type.php',
  171. 'phpunit_util_xml' => '/Util/XML.php'
  172. );
  173. $path = dirname(__FILE__);
  174. }
  175. if ($class === NULL) {
  176. $result = array(__FILE__);
  177. if (isset($_SERVER['_']) &&
  178. strpos($_SERVER['_'], 'phpunit') !== FALSE) {
  179. $result[] = $_SERVER['_'];
  180. }
  181. foreach ($classes as $file) {
  182. $result[] = $path . $file;
  183. }
  184. return $result;
  185. }
  186. $cn = strtolower($class);
  187. if (isset($classes[$cn])) {
  188. $file = $path . $classes[$cn];
  189. require $file;
  190. }
  191. }
  192. spl_autoload_register('phpunit_autoload');
  193. if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('PHP/Invoker/Autoload.php')) {
  194. require_once 'PHP/Invoker/Autoload.php';
  195. }
  196. if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('PHPUnit/Extensions/Database/Autoload.php')) {
  197. require_once 'PHPUnit/Extensions/Database/Autoload.php';
  198. }
  199. if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('PHPUnit/Extensions/SeleniumTestCase/Autoload.php')) {
  200. require_once 'PHPUnit/Extensions/SeleniumTestCase/Autoload.php';
  201. }
  202. if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('PHPUnit/Extensions/Story/Autoload.php')) {
  203. require_once 'PHPUnit/Extensions/Story/Autoload.php';
  204. }