MediaWiki REL1_31
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 'MediaWikiTestCase' => "$testDir/phpunit/MediaWikiTestCase.php",
55 'MediaWikiPHPUnitTestListener' => "$testDir/phpunit/MediaWikiPHPUnitTestListener.php",
56 'MediaWikiLangTestCase' => "$testDir/phpunit/MediaWikiLangTestCase.php",
57 'ResourceLoaderTestCase' => "$testDir/phpunit/ResourceLoaderTestCase.php",
58 'ResourceLoaderTestModule' => "$testDir/phpunit/ResourceLoaderTestCase.php",
59 'ResourceLoaderFileTestModule' => "$testDir/phpunit/ResourceLoaderTestCase.php",
60 'ResourceLoaderFileModuleTestModule' => "$testDir/phpunit/ResourceLoaderTestCase.php",
61 'EmptyResourceLoader' => "$testDir/phpunit/ResourceLoaderTestCase.php",
62 'TestUser' => "$testDir/phpunit/includes/TestUser.php",
63 'TestUserRegistry' => "$testDir/phpunit/includes/TestUserRegistry.php",
64 'LessFileCompilationTest' => "$testDir/phpunit/LessFileCompilationTest.php",
65 'MediaWikiCoversValidator' => "$testDir/phpunit/MediaWikiCoversValidator.php",
66 'PHPUnit4And6Compat' => "$testDir/phpunit/PHPUnit4And6Compat.php",
67 'HamcrestPHPUnitIntegration' => "$testDir/phpunit/HamcrestPHPUnitIntegration.php",
68
69 # tests/phpunit/includes
70 'RevisionDbTestBase' => "$testDir/phpunit/includes/RevisionDbTestBase.php",
71 'RevisionTestModifyableContent' => "$testDir/phpunit/includes/RevisionTestModifyableContent.php",
72 'RevisionTestModifyableContentHandler' => "$testDir/phpunit/includes/RevisionTestModifyableContentHandler.php",
73 'TestLogger' => "$testDir/phpunit/includes/TestLogger.php",
74
75 # tests/phpunit/includes/api
76 'ApiFormatTestBase' => "$testDir/phpunit/includes/api/format/ApiFormatTestBase.php",
77 'ApiQueryTestBase' => "$testDir/phpunit/includes/api/query/ApiQueryTestBase.php",
78 'ApiQueryContinueTestBase' => "$testDir/phpunit/includes/api/query/ApiQueryContinueTestBase.php",
79 'ApiTestCase' => "$testDir/phpunit/includes/api/ApiTestCase.php",
80 'ApiTestCaseUpload' => "$testDir/phpunit/includes/api/ApiTestCaseUpload.php",
81 'ApiTestContext' => "$testDir/phpunit/includes/api/ApiTestContext.php",
82 'ApiUploadTestCase' => "$testDir/phpunit/includes/api/ApiUploadTestCase.php",
83 'MockApi' => "$testDir/phpunit/includes/api/MockApi.php",
84 'MockApiQueryBase' => "$testDir/phpunit/includes/api/MockApiQueryBase.php",
85 'UserWrapper' => "$testDir/phpunit/includes/api/UserWrapper.php",
86 'RandomImageGenerator' => "$testDir/phpunit/includes/api/RandomImageGenerator.php",
87
88 # tests/phpunit/includes/auth
89 'MediaWiki\\Auth\\AuthenticationRequestTestCase' =>
90 "$testDir/phpunit/includes/auth/AuthenticationRequestTestCase.php",
91
92 # tests/phpunit/includes/changes
93 'TestRecentChangesHelper' => "$testDir/phpunit/includes/changes/TestRecentChangesHelper.php",
94
95 # tests/phpunit/includes/content
96 'DummyContentHandlerForTesting' =>
97 "$testDir/phpunit/mocks/content/DummyContentHandlerForTesting.php",
98 'DummyContentForTesting' => "$testDir/phpunit/mocks/content/DummyContentForTesting.php",
99 'DummyNonTextContentHandler' => "$testDir/phpunit/mocks/content/DummyNonTextContentHandler.php",
100 'DummyNonTextContent' => "$testDir/phpunit/mocks/content/DummyNonTextContent.php",
101 'DummySerializeErrorContentHandler' =>
102 "$testDir/phpunit/mocks/content/DummySerializeErrorContentHandler.php",
103 'ContentHandlerTest' => "$testDir/phpunit/includes/content/ContentHandlerTest.php",
104 'JavaScriptContentTest' => "$testDir/phpunit/includes/content/JavaScriptContentTest.php",
105 'TextContentTest' => "$testDir/phpunit/includes/content/TextContentTest.php",
106 'WikitextContentTest' => "$testDir/phpunit/includes/content/WikitextContentTest.php",
107
108 # tests/phpunit/includes/db
109 'DatabaseTestHelper' => "$testDir/phpunit/includes/db/DatabaseTestHelper.php",
110
111 # tests/phpunit/includes/diff
112 'FakeDiffOp' => "$testDir/phpunit/includes/diff/FakeDiffOp.php",
113
114 # tests/phpunit/includes/externalstore
115 'ExternalStoreForTesting' => "$testDir/phpunit/includes/externalstore/ExternalStoreForTesting.php",
116
117 # tests/phpunit/includes/logging
118 'LogFormatterTestCase' => "$testDir/phpunit/includes/logging/LogFormatterTestCase.php",
119
120 # tests/phpunit/includes/page
121 'WikiPageDbTestBase' => "$testDir/phpunit/includes/page/WikiPageDbTestBase.php",
122
123 # tests/phpunit/includes/parser
124 'ParserIntegrationTest' => "$testDir/phpunit/includes/parser/ParserIntegrationTest.php",
125
126 # tests/phpunit/includes/password
127 'PasswordTestCase' => "$testDir/phpunit/includes/password/PasswordTestCase.php",
128
129 # tests/phpunit/includes/resourceloader
130 'ResourceLoaderImageModuleTest' =>
131 "$testDir/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php",
132 'ResourceLoaderImageModuleTestable' =>
133 "$testDir/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php",
134
135 # tests/phpunit/includes/session
136 'MediaWiki\\Session\\TestBagOStuff' => "$testDir/phpunit/includes/session/TestBagOStuff.php",
137 'MediaWiki\\Session\\TestUtils' => "$testDir/phpunit/includes/session/TestUtils.php",
138
139 # tests/phpunit/includes/site
140 'SiteTest' => "$testDir/phpunit/includes/site/SiteTest.php",
141 'TestSites' => "$testDir/phpunit/includes/site/TestSites.php",
142
143 # tests/phpunit/includes/specialpage
144 'SpecialPageTestHelper' => "$testDir/phpunit/includes/specialpage/SpecialPageTestHelper.php",
145 'AbstractChangesListSpecialPageTestCase' => "$testDir/phpunit/includes/specialpage/AbstractChangesListSpecialPageTestCase.php",
146
147 # tests/phpunit/includes/specials
148 'SpecialPageTestBase' => "$testDir/phpunit/includes/specials/SpecialPageTestBase.php",
149 'SpecialPageExecutor' => "$testDir/phpunit/includes/specials/SpecialPageExecutor.php",
150
151 # tests/phpunit/includes/Storage
152 'MediaWiki\Tests\Storage\RevisionSlotsTest' => "$testDir/phpunit/includes/Storage/RevisionSlotsTest.php",
153 'MediaWiki\Tests\Storage\RevisionRecordTests' => "$testDir/phpunit/includes/Storage/RevisionRecordTests.php",
154
155 # tests/phpunit/languages
156 'LanguageClassesTestCase' => "$testDir/phpunit/languages/LanguageClassesTestCase.php",
157
158 # tests/phpunit/includes/libs
159 'GenericArrayObjectTest' => "$testDir/phpunit/includes/libs/GenericArrayObjectTest.php",
160
161 # tests/phpunit/maintenance
162 'MediaWiki\Tests\Maintenance\DumpTestCase' => "$testDir/phpunit/maintenance/DumpTestCase.php",
163 'MediaWiki\Tests\Maintenance\MaintenanceBaseTestCase' => "$testDir/phpunit/maintenance/MaintenanceBaseTestCase.php",
164
165 # tests/phpunit/media
166 'FakeDimensionFile' => "$testDir/phpunit/includes/media/FakeDimensionFile.php",
167 'MediaWikiMediaTestCase' => "$testDir/phpunit/includes/media/MediaWikiMediaTestCase.php",
168
169 # tests/phpunit/mocks
170 'MockFSFile' => "$testDir/phpunit/mocks/filebackend/MockFSFile.php",
171 'MockFileBackend' => "$testDir/phpunit/mocks/filebackend/MockFileBackend.php",
172 'MockLocalRepo' => "$testDir/phpunit/mocks/filerepo/MockLocalRepo.php",
173 'MockBitmapHandler' => "$testDir/phpunit/mocks/media/MockBitmapHandler.php",
174 'MockImageHandler' => "$testDir/phpunit/mocks/media/MockImageHandler.php",
175 'MockSvgHandler' => "$testDir/phpunit/mocks/media/MockSvgHandler.php",
176 'MockDjVuHandler' => "$testDir/phpunit/mocks/media/MockDjVuHandler.php",
177 'MockChangesListFilter' => "$testDir/phpunit/mocks/MockChangesListFilter.php",
178 'MockChangesListFilterGroup' => "$testDir/phpunit/mocks/MockChangesListFilterGroup.php",
179 'MockWebRequest' => "$testDir/phpunit/mocks/MockWebRequest.php",
180 'MediaWiki\\Session\\DummySessionBackend'
181 => "$testDir/phpunit/mocks/session/DummySessionBackend.php",
182 'DummySessionProvider' => "$testDir/phpunit/mocks/session/DummySessionProvider.php",
183 'MockMessageLocalizer' => "$testDir/phpunit/mocks/MockMessageLocalizer.php",
184
185 # tests/suites
186 'ParserTestFileSuite' => "$testDir/phpunit/suites/ParserTestFileSuite.php",
187 'ParserTestTopLevelSuite' => "$testDir/phpunit/suites/ParserTestTopLevelSuite.php",
188];
189// phpcs:enable
190
199spl_autoload_register( function ( $class ) {
200 if ( strpos( $class, 'PHPUnit_' ) !== 0 ) {
201 // Skip if it doesn't start with the old prefix
202 return;
203 }
204
205 // Classes that don't map 100%
206 $map = [
207 'PHPUnit_Framework_TestSuite_DataProvider' => 'PHPUnit\Framework\DataProviderTestSuite',
208 'PHPUnit_Framework_Error' => 'PHPUnit\Framework\Error\Error',
209 ];
210
211 if ( isset( $map[$class] ) ) {
212 $newForm = $map[$class];
213 } else {
214 $newForm = str_replace( '_', '\\', $class );
215 }
216
217 if ( class_exists( $newForm ) || interface_exists( $newForm ) ) {
218 // If the new class name exists, alias
219 // the old name to it.
220 class_alias( $newForm, $class );
221 }
222} );
global $wgAutoloadClasses
when a variable name is used in a it is silently declared as a new local masking the global
Definition design.txt:95
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:37