MediaWiki  1.32.5
TestsAutoLoader.php
Go to the documentation of this file.
1 <?php
25 $testDir = __DIR__ . "/..";
26 
27 // phpcs:disable Generic.Files.LineLength
29 
30  # tests/common
31  'TestSetup' => "$testDir/common/TestSetup.php",
32 
33  # tests/integration
34  'MWHttpRequestTestCase' => "$testDir/integration/includes/http/MWHttpRequestTestCase.php",
35 
36  # tests/parser
37  'DbTestPreviewer' => "$testDir/parser/DbTestPreviewer.php",
38  'DbTestRecorder' => "$testDir/parser/DbTestRecorder.php",
39  'DjVuSupport' => "$testDir/parser/DjVuSupport.php",
40  'MultiTestRecorder' => "$testDir/parser/MultiTestRecorder.php",
41  'ParserTestMockParser' => "$testDir/parser/ParserTestMockParser.php",
42  'ParserTestRunner' => "$testDir/parser/ParserTestRunner.php",
43  'ParserTestParserHook' => "$testDir/parser/ParserTestParserHook.php",
44  'ParserTestPrinter' => "$testDir/parser/ParserTestPrinter.php",
45  'ParserTestResult' => "$testDir/parser/ParserTestResult.php",
46  'ParserTestResultNormalizer' => "$testDir/parser/ParserTestResultNormalizer.php",
47  'PhpunitTestRecorder' => "$testDir/parser/PhpunitTestRecorder.php",
48  'TestFileEditor' => "$testDir/parser/TestFileEditor.php",
49  'TestFileReader' => "$testDir/parser/TestFileReader.php",
50  'TestRecorder' => "$testDir/parser/TestRecorder.php",
51  'TidySupport' => "$testDir/parser/TidySupport.php",
52 
53  # tests/phpunit
54  'EmptyResourceLoader' => "$testDir/phpunit/ResourceLoaderTestCase.php",
55  'HamcrestPHPUnitIntegration' => "$testDir/phpunit/HamcrestPHPUnitIntegration.php",
56  'LessFileCompilationTest' => "$testDir/phpunit/LessFileCompilationTest.php",
57  'MediaWikiCoversValidator' => "$testDir/phpunit/MediaWikiCoversValidator.php",
58  'MediaWikiLangTestCase' => "$testDir/phpunit/MediaWikiLangTestCase.php",
59  'MediaWikiPHPUnitCommand' => "$testDir/phpunit/MediaWikiPHPUnitCommand.php",
60  'MediaWikiPHPUnitTestListener' => "$testDir/phpunit/MediaWikiPHPUnitTestListener.php",
61  'MediaWikiTestCase' => "$testDir/phpunit/MediaWikiTestCase.php",
62  'MediaWikiTestResult' => "$testDir/phpunit/MediaWikiTestResult.php",
63  'MediaWikiTestRunner' => "$testDir/phpunit/MediaWikiTestRunner.php",
64  'PHPUnit4And6Compat' => "$testDir/phpunit/PHPUnit4And6Compat.php",
65  'ResourceLoaderFileModuleTestModule' => "$testDir/phpunit/ResourceLoaderTestCase.php",
66  'ResourceLoaderFileTestModule' => "$testDir/phpunit/ResourceLoaderTestCase.php",
67  'ResourceLoaderTestCase' => "$testDir/phpunit/ResourceLoaderTestCase.php",
68  'ResourceLoaderTestModule' => "$testDir/phpunit/ResourceLoaderTestCase.php",
69  'TestUser' => "$testDir/phpunit/includes/TestUser.php",
70  'TestUserRegistry' => "$testDir/phpunit/includes/TestUserRegistry.php",
71 
72  # tests/phpunit/includes
73  'PageArchiveTestBase' => "$testDir/phpunit/includes/page/PageArchiveTestBase.php",
74  'RevisionDbTestBase' => "$testDir/phpunit/includes/RevisionDbTestBase.php",
75  'RevisionTestModifyableContent' => "$testDir/phpunit/includes/RevisionTestModifyableContent.php",
76  'RevisionTestModifyableContentHandler' => "$testDir/phpunit/includes/RevisionTestModifyableContentHandler.php",
77  'TestLogger' => "$testDir/phpunit/includes/TestLogger.php",
78 
79  # tests/phpunit/includes/api
80  'ApiFormatTestBase' => "$testDir/phpunit/includes/api/format/ApiFormatTestBase.php",
81  'ApiQueryTestBase' => "$testDir/phpunit/includes/api/query/ApiQueryTestBase.php",
82  'ApiQueryContinueTestBase' => "$testDir/phpunit/includes/api/query/ApiQueryContinueTestBase.php",
83  'ApiTestCase' => "$testDir/phpunit/includes/api/ApiTestCase.php",
84  'ApiTestCaseUpload' => "$testDir/phpunit/includes/api/ApiTestCaseUpload.php",
85  'ApiTestContext' => "$testDir/phpunit/includes/api/ApiTestContext.php",
86  'ApiUploadTestCase' => "$testDir/phpunit/includes/api/ApiUploadTestCase.php",
87  'MockApi' => "$testDir/phpunit/includes/api/MockApi.php",
88  'MockApiQueryBase' => "$testDir/phpunit/includes/api/MockApiQueryBase.php",
89  'UserWrapper' => "$testDir/phpunit/includes/api/UserWrapper.php",
90  'RandomImageGenerator' => "$testDir/phpunit/includes/api/RandomImageGenerator.php",
91 
92  # tests/phpunit/includes/auth
93  'MediaWiki\\Auth\\AuthenticationRequestTestCase' =>
94  "$testDir/phpunit/includes/auth/AuthenticationRequestTestCase.php",
95 
96  # tests/phpunit/includes/changes
97  'TestRecentChangesHelper' => "$testDir/phpunit/includes/changes/TestRecentChangesHelper.php",
98 
99  # tests/phpunit/includes/content
100  'DummyContentHandlerForTesting' =>
101  "$testDir/phpunit/mocks/content/DummyContentHandlerForTesting.php",
102  'DummyContentForTesting' => "$testDir/phpunit/mocks/content/DummyContentForTesting.php",
103  'DummyNonTextContentHandler' => "$testDir/phpunit/mocks/content/DummyNonTextContentHandler.php",
104  'DummyNonTextContent' => "$testDir/phpunit/mocks/content/DummyNonTextContent.php",
105  'DummySerializeErrorContentHandler' =>
106  "$testDir/phpunit/mocks/content/DummySerializeErrorContentHandler.php",
107  'ContentHandlerTest' => "$testDir/phpunit/includes/content/ContentHandlerTest.php",
108  'JavaScriptContentTest' => "$testDir/phpunit/includes/content/JavaScriptContentTest.php",
109  'TextContentTest' => "$testDir/phpunit/includes/content/TextContentTest.php",
110  'WikitextContentTest' => "$testDir/phpunit/includes/content/WikitextContentTest.php",
111 
112  # tests/phpunit/includes/db
113  'DatabaseTestHelper' => "$testDir/phpunit/includes/db/DatabaseTestHelper.php",
114 
115  # tests/phpunit/includes/debug
116  'TestDeprecatedClass' => "$testDir/phpunit/includes/debug/TestDeprecatedClass.php",
117  'TestDeprecatedSubclass' => "$testDir/phpunit/includes/debug/TestDeprecatedSubclass.php",
118 
119  # tests/phpunit/includes/diff
120  'CustomDifferenceEngine' => "$testDir/phpunit/includes/diff/CustomDifferenceEngine.php",
121  'FakeDiffOp' => "$testDir/phpunit/includes/diff/FakeDiffOp.php",
122 
123  # tests/phpunit/includes/externalstore
124  'ExternalStoreForTesting' => "$testDir/phpunit/includes/externalstore/ExternalStoreForTesting.php",
125 
126  # tests/phpunit/includes/logging
127  'LogFormatterTestCase' => "$testDir/phpunit/includes/logging/LogFormatterTestCase.php",
128 
129  # tests/phpunit/includes/page
130  'WikiPageDbTestBase' => "$testDir/phpunit/includes/page/WikiPageDbTestBase.php",
131 
132  # tests/phpunit/includes/parser
133  'ParserIntegrationTest' => "$testDir/phpunit/suites/ParserIntegrationTest.php",
134 
135  # tests/phpunit/includes/password
136  'PasswordTestCase' => "$testDir/phpunit/includes/password/PasswordTestCase.php",
137 
138  # tests/phpunit/includes/resourceloader
139  'ResourceLoaderImageModuleTest' =>
140  "$testDir/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php",
141  'ResourceLoaderImageModuleTestable' =>
142  "$testDir/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php",
143 
144  # tests/phpunit/includes/session
145  'MediaWiki\\Session\\TestBagOStuff' => "$testDir/phpunit/includes/session/TestBagOStuff.php",
146  'MediaWiki\\Session\\TestUtils' => "$testDir/phpunit/includes/session/TestUtils.php",
147 
148  # tests/phpunit/includes/site
149  'SiteTest' => "$testDir/phpunit/includes/site/SiteTest.php",
150  'TestSites' => "$testDir/phpunit/includes/site/TestSites.php",
151 
152  # tests/phpunit/includes/specialpage
153  'SpecialPageTestHelper' => "$testDir/phpunit/includes/specialpage/SpecialPageTestHelper.php",
154  'AbstractChangesListSpecialPageTestCase' => "$testDir/phpunit/includes/specialpage/AbstractChangesListSpecialPageTestCase.php",
155 
156  # tests/phpunit/includes/specials
157  'SpecialPageTestBase' => "$testDir/phpunit/includes/specials/SpecialPageTestBase.php",
158  'SpecialPageExecutor' => "$testDir/phpunit/includes/specials/SpecialPageExecutor.php",
159 
160  # tests/phpunit/includes/Revision
161  'MediaWiki\Tests\Revision\McrSchemaDetection' => "$testDir/phpunit/includes/Revision/McrSchemaDetection.php",
162  'MediaWiki\Tests\Revision\McrSchemaOverride' => "$testDir/phpunit/includes/Revision/McrSchemaOverride.php",
163  'MediaWiki\Tests\Revision\McrWriteBothSchemaOverride' => "$testDir/phpunit/includes/Revision/McrWriteBothSchemaOverride.php",
164  'MediaWiki\Tests\Revision\McrReadNewSchemaOverride' => "$testDir/phpunit/includes/Revision/McrReadNewSchemaOverride.php",
165  'MediaWiki\Tests\Revision\RevisionSlotsTest' => "$testDir/phpunit/includes/Revision/RevisionSlotsTest.php",
166  'MediaWiki\Tests\Revision\RevisionRecordTests' => "$testDir/phpunit/includes/Revision/RevisionRecordTests.php",
167  'MediaWiki\Tests\Revision\RevisionStoreDbTestBase' => "$testDir/phpunit/includes/Revision/RevisionStoreDbTestBase.php",
168  'MediaWiki\Tests\Revision\PreMcrSchemaOverride' => "$testDir/phpunit/includes/Revision/PreMcrSchemaOverride.php",
169 
170  # tests/phpunit/languages
171  'LanguageClassesTestCase' => "$testDir/phpunit/languages/LanguageClassesTestCase.php",
172 
173  # tests/phpunit/includes/libs
174  'GenericArrayObjectTest' => "$testDir/phpunit/includes/libs/GenericArrayObjectTest.php",
175 
176  # tests/phpunit/maintenance
177  'MediaWiki\Tests\Maintenance\DumpTestCase' => "$testDir/phpunit/maintenance/DumpTestCase.php",
178  'MediaWiki\Tests\Maintenance\MaintenanceBaseTestCase' => "$testDir/phpunit/maintenance/MaintenanceBaseTestCase.php",
179 
180  # tests/phpunit/media
181  'FakeDimensionFile' => "$testDir/phpunit/includes/media/FakeDimensionFile.php",
182  'MediaWikiMediaTestCase' => "$testDir/phpunit/includes/media/MediaWikiMediaTestCase.php",
183 
184  # tests/phpunit/mocks
185  'MockFSFile' => "$testDir/phpunit/mocks/filebackend/MockFSFile.php",
186  'MockFileBackend' => "$testDir/phpunit/mocks/filebackend/MockFileBackend.php",
187  'MockLocalRepo' => "$testDir/phpunit/mocks/filerepo/MockLocalRepo.php",
188  'MockBitmapHandler' => "$testDir/phpunit/mocks/media/MockBitmapHandler.php",
189  'MockImageHandler' => "$testDir/phpunit/mocks/media/MockImageHandler.php",
190  'MockSvgHandler' => "$testDir/phpunit/mocks/media/MockSvgHandler.php",
191  'MockDjVuHandler' => "$testDir/phpunit/mocks/media/MockDjVuHandler.php",
192  'MockChangesListFilter' => "$testDir/phpunit/mocks/MockChangesListFilter.php",
193  'MockChangesListFilterGroup' => "$testDir/phpunit/mocks/MockChangesListFilterGroup.php",
194  'MockWebRequest' => "$testDir/phpunit/mocks/MockWebRequest.php",
195  'MediaWiki\\Session\\DummySessionBackend'
196  => "$testDir/phpunit/mocks/session/DummySessionBackend.php",
197  'DummySessionProvider' => "$testDir/phpunit/mocks/session/DummySessionProvider.php",
198  'MockMessageLocalizer' => "$testDir/phpunit/mocks/MockMessageLocalizer.php",
199  'MockCompletionSearchEngine' => "$testDir/phpunit/mocks/search/MockCompletionSearchEngine.php",
200  'MockSearchEngine' => "$testDir/phpunit/mocks/search/MockSearchEngine.php",
201  'MockSearchResultSet' => "$testDir/phpunit/mocks/search/MockSearchResultSet.php",
202  'MockSearchResult' => "$testDir/phpunit/mocks/search/MockSearchResult.php",
203 
204  # tests/suites
205  'ParserTestFileSuite' => "$testDir/phpunit/suites/ParserTestFileSuite.php",
206  'ParserTestTopLevelSuite' => "$testDir/phpunit/suites/ParserTestTopLevelSuite.php",
207 ];
208 // phpcs:enable
209 
218 spl_autoload_register( function ( $class ) {
219  if ( strpos( $class, 'PHPUnit_' ) !== 0 ) {
220  // Skip if it doesn't start with the old prefix
221  return;
222  }
223 
224  // Classes that don't map 100%
225  $map = [
226  'PHPUnit_Framework_TestSuite_DataProvider' => 'PHPUnit\Framework\DataProviderTestSuite',
227  'PHPUnit_Framework_Error' => 'PHPUnit\Framework\Error\Error',
228  ];
229 
230  if ( isset( $map[$class] ) ) {
231  $newForm = $map[$class];
232  } else {
233  $newForm = str_replace( '_', '\\', $class );
234  }
235 
236  if ( class_exists( $newForm ) || interface_exists( $newForm ) ) {
237  // If the new class name exists, alias
238  // the old name to it.
239  class_alias( $newForm, $class );
240  }
241 } );
$testDir
$testDir
Definition: TestsAutoLoader.php:25
$wgAutoloadClasses
global $wgAutoloadClasses
Definition: TestsAutoLoader.php:24
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35