]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - tests/PHPUnit/PHPUnit/Framework/MockObject/Autoload.php
Merge branch 'master' of github.com:sugarcrm/sugarcrm_dev
[Github/sugarcrm.git] / tests / PHPUnit / PHPUnit / Framework / MockObject / Autoload.php
1 <?php
2 /**
3  * PHPUnit
4  *
5  * Copyright (c) 2002-2011, Sebastian Bergmann <sb@sebastian-bergmann.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_MockObject
38  * @author     Sebastian Bergmann <sb@sebastian-bergmann.de>
39  * @copyright  2002-2011 Sebastian Bergmann <sb@sebastian-bergmann.de>
40  * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
41  * @link       http://github.com/sebastianbergmann/phpunit-mock-objects
42  * @since      File available since Release 1.1.0
43  */
44
45 function phpunit_mockobject_autoload($class = NULL) {
46     static $classes = NULL;
47     static $path = NULL;
48
49     if ($classes === NULL) {
50         $classes = array(
51           'phpunit_framework_mockobject_builder_identity' => '/Framework/MockObject/Builder/Identity.php',
52           'phpunit_framework_mockobject_builder_invocationmocker' => '/Framework/MockObject/Builder/InvocationMocker.php',
53           'phpunit_framework_mockobject_builder_match' => '/Framework/MockObject/Builder/Match.php',
54           'phpunit_framework_mockobject_builder_methodnamematch' => '/Framework/MockObject/Builder/MethodNameMatch.php',
55           'phpunit_framework_mockobject_builder_namespace' => '/Framework/MockObject/Builder/Namespace.php',
56           'phpunit_framework_mockobject_builder_parametersmatch' => '/Framework/MockObject/Builder/ParametersMatch.php',
57           'phpunit_framework_mockobject_builder_stub' => '/Framework/MockObject/Builder/Stub.php',
58           'phpunit_framework_mockobject_generator' => '/Framework/MockObject/Generator.php',
59           'phpunit_framework_mockobject_invocation' => '/Framework/MockObject/Invocation.php',
60           'phpunit_framework_mockobject_invocation_object' => '/Framework/MockObject/Invocation/Object.php',
61           'phpunit_framework_mockobject_invocation_static' => '/Framework/MockObject/Invocation/Static.php',
62           'phpunit_framework_mockobject_invocationmocker' => '/Framework/MockObject/InvocationMocker.php',
63           'phpunit_framework_mockobject_invokable' => '/Framework/MockObject/Invokable.php',
64           'phpunit_framework_mockobject_matcher' => '/Framework/MockObject/Matcher.php',
65           'phpunit_framework_mockobject_matcher_anyinvokedcount' => '/Framework/MockObject/Matcher/AnyInvokedCount.php',
66           'phpunit_framework_mockobject_matcher_anyparameters' => '/Framework/MockObject/Matcher/AnyParameters.php',
67           'phpunit_framework_mockobject_matcher_invocation' => '/Framework/MockObject/Matcher/Invocation.php',
68           'phpunit_framework_mockobject_matcher_invokedatindex' => '/Framework/MockObject/Matcher/InvokedAtIndex.php',
69           'phpunit_framework_mockobject_matcher_invokedatleastonce' => '/Framework/MockObject/Matcher/InvokedAtLeastOnce.php',
70           'phpunit_framework_mockobject_matcher_invokedcount' => '/Framework/MockObject/Matcher/InvokedCount.php',
71           'phpunit_framework_mockobject_matcher_invokedrecorder' => '/Framework/MockObject/Matcher/InvokedRecorder.php',
72           'phpunit_framework_mockobject_matcher_methodname' => '/Framework/MockObject/Matcher/MethodName.php',
73           'phpunit_framework_mockobject_matcher_parameters' => '/Framework/MockObject/Matcher/Parameters.php',
74           'phpunit_framework_mockobject_matcher_statelessinvocation' => '/Framework/MockObject/Matcher/StatelessInvocation.php',
75           'phpunit_framework_mockobject_mockbuilder' => '/Framework/MockObject/MockBuilder.php',
76           'phpunit_framework_mockobject_mockobject' => '/Framework/MockObject/MockObject.php',
77           'phpunit_framework_mockobject_stub' => '/Framework/MockObject/Stub.php',
78           'phpunit_framework_mockobject_stub_consecutivecalls' => '/Framework/MockObject/Stub/ConsecutiveCalls.php',
79           'phpunit_framework_mockobject_stub_exception' => '/Framework/MockObject/Stub/Exception.php',
80           'phpunit_framework_mockobject_stub_matchercollection' => '/Framework/MockObject/Stub/MatcherCollection.php',
81           'phpunit_framework_mockobject_stub_return' => '/Framework/MockObject/Stub/Return.php',
82           'phpunit_framework_mockobject_stub_returnargument' => '/Framework/MockObject/Stub/ReturnArgument.php',
83           'phpunit_framework_mockobject_stub_returncallback' => '/Framework/MockObject/Stub/ReturnCallback.php',
84           'phpunit_framework_mockobject_stub_returnself' => '/Framework/MockObject/Stub/ReturnSelf.php',
85           'phpunit_framework_mockobject_stub_returnvaluemap' => '/Framework/MockObject/Stub/ReturnValueMap.php',
86           'phpunit_framework_mockobject_verifiable' => '/Framework/MockObject/Verifiable.php'
87         );
88
89         $path = dirname(dirname(dirname(__FILE__)));
90     }
91
92     if ($class === NULL) {
93         $result = array(__FILE__);
94
95         foreach ($classes as $file) {
96             $result[] = $path . $file;
97         }
98
99         return $result;
100     }
101
102     $cn = strtolower($class);
103
104     if (isset($classes[$cn])) {
105         $file = $path . $classes[$cn];
106
107         require $file;
108     }
109 }
110
111 spl_autoload_register('phpunit_mockobject_autoload');