MediaWiki  1.33.0
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 
52  # tests/phpunit
53  'EmptyResourceLoader' => "$testDir/phpunit/ResourceLoaderTestCase.php",
54  'HamcrestPHPUnitIntegration' => "$testDir/phpunit/HamcrestPHPUnitIntegration.php",
55  'LessFileCompilationTest' => "$testDir/phpunit/LessFileCompilationTest.php",
56  'MediaWikiCoversValidator' => "$testDir/phpunit/MediaWikiCoversValidator.php",
57  'MediaWikiLangTestCase' => "$testDir/phpunit/MediaWikiLangTestCase.php",
58  'MediaWikiLoggerPHPUnitTestListener' => "$testDir/phpunit/MediaWikiLoggerPHPUnitTestListener.php",
59  'MediaWikiPHPUnitCommand' => "$testDir/phpunit/MediaWikiPHPUnitCommand.php",
60  'MediaWikiPHPUnitResultPrinter' => "$testDir/phpunit/MediaWikiPHPUnitResultPrinter.php",
61  'MediaWikiPHPUnitTestListener' => "$testDir/phpunit/MediaWikiPHPUnitTestListener.php",
62  'MediaWikiTestCase' => "$testDir/phpunit/MediaWikiTestCase.php",
63  'MediaWikiTestResult' => "$testDir/phpunit/MediaWikiTestResult.php",
64  'MediaWikiTestRunner' => "$testDir/phpunit/MediaWikiTestRunner.php",
65  'PHPUnit4And6Compat' => "$testDir/phpunit/PHPUnit4And6Compat.php",
66  'ResourceLoaderFileModuleTestModule' => "$testDir/phpunit/ResourceLoaderTestCase.php",
67  'ResourceLoaderFileTestModule' => "$testDir/phpunit/ResourceLoaderTestCase.php",
68  'ResourceLoaderTestCase' => "$testDir/phpunit/ResourceLoaderTestCase.php",
69  'ResourceLoaderTestModule' => "$testDir/phpunit/ResourceLoaderTestCase.php",
70  'TestUser' => "$testDir/phpunit/includes/TestUser.php",
71  'TestUserRegistry' => "$testDir/phpunit/includes/TestUserRegistry.php",
72 
73  # tests/phpunit/includes
74  'PageArchiveTestBase' => "$testDir/phpunit/includes/page/PageArchiveTestBase.php",
75  'RevisionDbTestBase' => "$testDir/phpunit/includes/RevisionDbTestBase.php",
76  'RevisionTestModifyableContent' => "$testDir/phpunit/includes/RevisionTestModifyableContent.php",
77  'RevisionTestModifyableContentHandler' => "$testDir/phpunit/includes/RevisionTestModifyableContentHandler.php",
78  'TestLogger' => "$testDir/phpunit/includes/TestLogger.php",
79 
80  # tests/phpunit/includes/api
81  'ApiFormatTestBase' => "$testDir/phpunit/includes/api/format/ApiFormatTestBase.php",
82  'ApiQueryTestBase' => "$testDir/phpunit/includes/api/query/ApiQueryTestBase.php",
83  'ApiQueryContinueTestBase' => "$testDir/phpunit/includes/api/query/ApiQueryContinueTestBase.php",
84  'ApiTestCase' => "$testDir/phpunit/includes/api/ApiTestCase.php",
85  'ApiTestCaseUpload' => "$testDir/phpunit/includes/api/ApiTestCaseUpload.php",
86  'ApiTestContext' => "$testDir/phpunit/includes/api/ApiTestContext.php",
87  'ApiUploadTestCase' => "$testDir/phpunit/includes/api/ApiUploadTestCase.php",
88  'MockApi' => "$testDir/phpunit/includes/api/MockApi.php",
89  'MockApiQueryBase' => "$testDir/phpunit/includes/api/MockApiQueryBase.php",
90  'UserWrapper' => "$testDir/phpunit/includes/api/UserWrapper.php",
91  'RandomImageGenerator' => "$testDir/phpunit/includes/api/RandomImageGenerator.php",
92 
93  # tests/phpunit/includes/auth
94  'MediaWiki\\Auth\\AuthenticationRequestTestCase' =>
95  "$testDir/phpunit/includes/auth/AuthenticationRequestTestCase.php",
96 
97  # tests/phpunit/includes/block
98  'MediaWiki\\Tests\\Block\\Restriction\\RestrictionTestCase' => "$testDir/phpunit/includes/block/Restriction/RestrictionTestCase.php",
99 
100  # tests/phpunit/includes/changes
101  'TestRecentChangesHelper' => "$testDir/phpunit/includes/changes/TestRecentChangesHelper.php",
102 
103  # tests/phpunit/includes/content
104  'DummyContentHandlerForTesting' =>
105  "$testDir/phpunit/mocks/content/DummyContentHandlerForTesting.php",
106  'DummyContentForTesting' => "$testDir/phpunit/mocks/content/DummyContentForTesting.php",
107  'DummyNonTextContentHandler' => "$testDir/phpunit/mocks/content/DummyNonTextContentHandler.php",
108  'DummyNonTextContent' => "$testDir/phpunit/mocks/content/DummyNonTextContent.php",
109  'DummySerializeErrorContentHandler' =>
110  "$testDir/phpunit/mocks/content/DummySerializeErrorContentHandler.php",
111  'ContentHandlerTest' => "$testDir/phpunit/includes/content/ContentHandlerTest.php",
112  'JavaScriptContentTest' => "$testDir/phpunit/includes/content/JavaScriptContentTest.php",
113  'TextContentTest' => "$testDir/phpunit/includes/content/TextContentTest.php",
114  'WikitextContentTest' => "$testDir/phpunit/includes/content/WikitextContentTest.php",
115 
116  # tests/phpunit/includes/db
117  'DatabaseTestHelper' => "$testDir/phpunit/includes/db/DatabaseTestHelper.php",
118 
119  # tests/phpunit/includes/debug
120  'TestDeprecatedClass' => "$testDir/phpunit/includes/debug/TestDeprecatedClass.php",
121  'TestDeprecatedSubclass' => "$testDir/phpunit/includes/debug/TestDeprecatedSubclass.php",
122 
123  # tests/phpunit/includes/diff
124  'CustomDifferenceEngine' => "$testDir/phpunit/includes/diff/CustomDifferenceEngine.php",
125  'FakeDiffOp' => "$testDir/phpunit/includes/diff/FakeDiffOp.php",
126 
127  # tests/phpunit/includes/externalstore
128  'ExternalStoreForTesting' => "$testDir/phpunit/includes/externalstore/ExternalStoreForTesting.php",
129 
130  # tests/phpunit/includes/logging
131  'LogFormatterTestCase' => "$testDir/phpunit/includes/logging/LogFormatterTestCase.php",
132 
133  # tests/phpunit/includes/page
134  'WikiPageDbTestBase' => "$testDir/phpunit/includes/page/WikiPageDbTestBase.php",
135 
136  # tests/phpunit/includes/parser
137  'ParserIntegrationTest' => "$testDir/phpunit/suites/ParserIntegrationTest.php",
138 
139  # tests/phpunit/includes/password
140  'PasswordTestCase' => "$testDir/phpunit/includes/password/PasswordTestCase.php",
141 
142  # tests/phpunit/includes/resourceloader
143  'ResourceLoaderImageModuleTest' =>
144  "$testDir/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php",
145  'ResourceLoaderImageModuleTestable' =>
146  "$testDir/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php",
147 
148  # tests/phpunit/includes/session
149  'MediaWiki\\Session\\TestBagOStuff' => "$testDir/phpunit/includes/session/TestBagOStuff.php",
150  'MediaWiki\\Session\\TestUtils' => "$testDir/phpunit/includes/session/TestUtils.php",
151 
152  # tests/phpunit/includes/site
153  'SiteTest' => "$testDir/phpunit/includes/site/SiteTest.php",
154  'TestSites' => "$testDir/phpunit/includes/site/TestSites.php",
155 
156  # tests/phpunit/includes/specialpage
157  'SpecialPageTestHelper' => "$testDir/phpunit/includes/specialpage/SpecialPageTestHelper.php",
158  'AbstractChangesListSpecialPageTestCase' => "$testDir/phpunit/includes/specialpage/AbstractChangesListSpecialPageTestCase.php",
159  'FormSpecialPageTestCase' => "$testDir/phpunit/includes/specialpage/FormSpecialPageTestCase.php",
160 
161  # tests/phpunit/includes/specials
162  'SpecialPageTestBase' => "$testDir/phpunit/includes/specials/SpecialPageTestBase.php",
163  'SpecialPageExecutor' => "$testDir/phpunit/includes/specials/SpecialPageExecutor.php",
164 
165  # tests/phpunit/includes/Revision
166  'MediaWiki\Tests\Revision\McrSchemaDetection' => "$testDir/phpunit/includes/Revision/McrSchemaDetection.php",
167  'MediaWiki\Tests\Revision\McrSchemaOverride' => "$testDir/phpunit/includes/Revision/McrSchemaOverride.php",
168  'MediaWiki\Tests\Revision\McrWriteBothSchemaOverride' => "$testDir/phpunit/includes/Revision/McrWriteBothSchemaOverride.php",
169  'MediaWiki\Tests\Revision\McrReadNewSchemaOverride' => "$testDir/phpunit/includes/Revision/McrReadNewSchemaOverride.php",
170  'MediaWiki\Tests\Revision\RevisionSlotsTest' => "$testDir/phpunit/includes/Revision/RevisionSlotsTest.php",
171  'MediaWiki\Tests\Revision\RevisionRecordTests' => "$testDir/phpunit/includes/Revision/RevisionRecordTests.php",
172  'MediaWiki\Tests\Revision\RevisionStoreDbTestBase' => "$testDir/phpunit/includes/Revision/RevisionStoreDbTestBase.php",
173  'MediaWiki\Tests\Revision\PreMcrSchemaOverride' => "$testDir/phpunit/includes/Revision/PreMcrSchemaOverride.php",
174  'MediaWiki\Tests\Revision\RevisionStoreRecordTest' => "$testDir/phpunit/includes/Revision/RevisionStoreRecordTest.php",
175 
176  # tests/phpunit/languages
177  'LanguageClassesTestCase' => "$testDir/phpunit/languages/LanguageClassesTestCase.php",
178 
179  # tests/phpunit/includes/libs
180  'GenericArrayObjectTest' => "$testDir/phpunit/includes/libs/GenericArrayObjectTest.php",
181 
182  # tests/phpunit/maintenance
183  'MediaWiki\Tests\Maintenance\DumpAsserter' => "$testDir/phpunit/maintenance/DumpAsserter.php",
184  'MediaWiki\Tests\Maintenance\DumpTestCase' => "$testDir/phpunit/maintenance/DumpTestCase.php",
185  'MediaWiki\Tests\Maintenance\MaintenanceBaseTestCase' => "$testDir/phpunit/maintenance/MaintenanceBaseTestCase.php",
186 
187  # tests/phpunit/media
188  'FakeDimensionFile' => "$testDir/phpunit/includes/media/FakeDimensionFile.php",
189  'MediaWikiMediaTestCase' => "$testDir/phpunit/includes/media/MediaWikiMediaTestCase.php",
190 
191  # tests/phpunit/mocks
192  'MockFSFile' => "$testDir/phpunit/mocks/filebackend/MockFSFile.php",
193  'MockFileBackend' => "$testDir/phpunit/mocks/filebackend/MockFileBackend.php",
194  'MockLocalRepo' => "$testDir/phpunit/mocks/filerepo/MockLocalRepo.php",
195  'MockBitmapHandler' => "$testDir/phpunit/mocks/media/MockBitmapHandler.php",
196  'MockImageHandler' => "$testDir/phpunit/mocks/media/MockImageHandler.php",
197  'MockSvgHandler' => "$testDir/phpunit/mocks/media/MockSvgHandler.php",
198  'MockDjVuHandler' => "$testDir/phpunit/mocks/media/MockDjVuHandler.php",
199  'MockChangesListFilter' => "$testDir/phpunit/mocks/MockChangesListFilter.php",
200  'MockChangesListFilterGroup' => "$testDir/phpunit/mocks/MockChangesListFilterGroup.php",
201  'MockWebRequest' => "$testDir/phpunit/mocks/MockWebRequest.php",
202  'MediaWiki\\Session\\DummySessionBackend'
203  => "$testDir/phpunit/mocks/session/DummySessionBackend.php",
204  'DummySessionProvider' => "$testDir/phpunit/mocks/session/DummySessionProvider.php",
205  'MockMessageLocalizer' => "$testDir/phpunit/mocks/MockMessageLocalizer.php",
206  'MockCompletionSearchEngine' => "$testDir/phpunit/mocks/search/MockCompletionSearchEngine.php",
207  'MockSearchEngine' => "$testDir/phpunit/mocks/search/MockSearchEngine.php",
208  'MockSearchResultSet' => "$testDir/phpunit/mocks/search/MockSearchResultSet.php",
209  'MockSearchResult' => "$testDir/phpunit/mocks/search/MockSearchResult.php",
210 
211  # tests/suites
212  'ParserTestFileSuite' => "$testDir/phpunit/suites/ParserTestFileSuite.php",
213  'ParserTestTopLevelSuite' => "$testDir/phpunit/suites/ParserTestTopLevelSuite.php",
214 ];
215 // phpcs:enable
216 
225 spl_autoload_register( function ( $class ) {
226  if ( strpos( $class, 'PHPUnit_' ) !== 0 ) {
227  // Skip if it doesn't start with the old prefix
228  return;
229  }
230 
231  // Classes that don't map 100%
232  $map = [
233  'PHPUnit_Framework_TestSuite_DataProvider' => 'PHPUnit\Framework\DataProviderTestSuite',
234  'PHPUnit_Framework_Error' => 'PHPUnit\Framework\Error\Error',
235  ];
236 
237  $newForm = $map[$class] ?? str_replace( '_', '\\', $class );
238 
239  if ( class_exists( $newForm ) || interface_exists( $newForm ) ) {
240  // If the new class name exists, alias
241  // the old name to it.
242  class_alias( $newForm, $class );
243  }
244 } );
$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