This adds supportsDirectApiEditing and supportsDirectEditing methods to ContentHandler. Both return false by default for the ContentHandler base class, and true for TextContentHandler and it's derivatives. (everything in core) Extension content types that directly extend AbstractContent / ContentHandler, often / generally don't support direct editing. EntityContent in Wikibase and Flow boards are the two such content types currently in gerrit-hosted extensions. The use and direct settings of the allowNonTextContent member variable is replaced by enableApiEditOverride and a setter for that. The only place allowNonTextContent is used in all of Wikimedia-hosted git repos is core itself (EditPage and ApiEditPage), so should be safe to make this change. With this change, Wikibase can remove its ApiCheckCanExecute hook handler that disallows editing there, and MobileFrontend could check if direct editing is allowed before enabling it's editing features, instead of Wikibase having to add MobileFrontend hook handlers to disable the features. Bug: T96382 Change-Id: I276cd6ecedf38108f1f2be16b38e699e8c5d2d0c
127 lines
6.1 KiB
PHP
127 lines
6.1 KiB
PHP
<?php
|
|
/**
|
|
* AutoLoader for the testing suite.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
*
|
|
* @file
|
|
* @ingroup Testing
|
|
*/
|
|
|
|
global $wgAutoloadClasses;
|
|
$testDir = __DIR__;
|
|
|
|
$wgAutoloadClasses += array(
|
|
|
|
# tests
|
|
'DbTestPreviewer' => "$testDir/testHelpers.inc",
|
|
'DbTestRecorder' => "$testDir/testHelpers.inc",
|
|
'DelayedParserTest' => "$testDir/testHelpers.inc",
|
|
'ParserTestResult' => "$testDir/parser/ParserTestResult.php",
|
|
'TestFileIterator' => "$testDir/testHelpers.inc",
|
|
'TestRecorder' => "$testDir/testHelpers.inc",
|
|
'ITestRecorder' => "$testDir/testHelpers.inc",
|
|
'DjVuSupport' => "$testDir/testHelpers.inc",
|
|
'TidySupport' => "$testDir/testHelpers.inc",
|
|
|
|
# tests/phpunit
|
|
'MediaWikiTestCase' => "$testDir/phpunit/MediaWikiTestCase.php",
|
|
'MediaWikiPHPUnitTestListener' => "$testDir/phpunit/MediaWikiPHPUnitTestListener.php",
|
|
'MediaWikiLangTestCase' => "$testDir/phpunit/MediaWikiLangTestCase.php",
|
|
'ResourceLoaderTestCase' => "$testDir/phpunit/ResourceLoaderTestCase.php",
|
|
'ResourceLoaderTestModule' => "$testDir/phpunit/ResourceLoaderTestCase.php",
|
|
'ResourceLoaderFileModuleTestModule' => "$testDir/phpunit/ResourceLoaderTestCase.php",
|
|
'TestUser' => "$testDir/phpunit/includes/TestUser.php",
|
|
'LessFileCompilationTest' => "$testDir/phpunit/LessFileCompilationTest.php",
|
|
|
|
# tests/phpunit/includes
|
|
'TestingAccessWrapper' => "$testDir/phpunit/includes/TestingAccessWrapper.php",
|
|
|
|
# tests/phpunit/includes/api
|
|
'ApiFormatTestBase' => "$testDir/phpunit/includes/api/format/ApiFormatTestBase.php",
|
|
'ApiQueryTestBase' => "$testDir/phpunit/includes/api/query/ApiQueryTestBase.php",
|
|
'ApiQueryContinueTestBase' => "$testDir/phpunit/includes/api/query/ApiQueryContinueTestBase.php",
|
|
'ApiTestCase' => "$testDir/phpunit/includes/api/ApiTestCase.php",
|
|
'ApiTestCaseUpload' => "$testDir/phpunit/includes/api/ApiTestCaseUpload.php",
|
|
'ApiTestContext' => "$testDir/phpunit/includes/api/ApiTestContext.php",
|
|
'MockApi' => "$testDir/phpunit/includes/api/MockApi.php",
|
|
'MockApiQueryBase' => "$testDir/phpunit/includes/api/MockApiQueryBase.php",
|
|
'UserWrapper' => "$testDir/phpunit/includes/api/UserWrapper.php",
|
|
'RandomImageGenerator' => "$testDir/phpunit/includes/api/RandomImageGenerator.php",
|
|
|
|
# tests/phpunit/includes/changes
|
|
'TestRecentChangesHelper' => "$testDir/phpunit/includes/changes/TestRecentChangesHelper.php",
|
|
|
|
# tests/phpunit/includes/content
|
|
'DummyContentHandlerForTesting' => "$testDir/phpunit/mocks/content/DummyContentHandlerForTesting.php",
|
|
'DummyContentForTesting' => "$testDir/phpunit/mocks/content/DummyContentForTesting.php",
|
|
'DummyNonTextContentHandler' => "$testDir/phpunit/mocks/content/DummyNonTextContentHandler.php",
|
|
'DummyNonTextContent' => "$testDir/phpunit/mocks/content/DummyNonTextContent.php",
|
|
'ContentHandlerTest' => "$testDir/phpunit/includes/content/ContentHandlerTest.php",
|
|
'JavaScriptContentTest' => "$testDir/phpunit/includes/content/JavaScriptContentTest.php",
|
|
'TextContentTest' => "$testDir/phpunit/includes/content/TextContentTest.php",
|
|
'WikitextContentTest' => "$testDir/phpunit/includes/content/WikitextContentTest.php",
|
|
|
|
# tests/phpunit/includes/db
|
|
'ORMRowTest' => "$testDir/phpunit/includes/db/ORMRowTest.php",
|
|
'ORMTableTest' => "$testDir/phpunit/includes/db/ORMTableTest.php",
|
|
'PageORMTableForTesting' => "$testDir/phpunit/includes/db/ORMTableTest.php",
|
|
'DatabaseTestHelper' => "$testDir/phpunit/includes/db/DatabaseTestHelper.php",
|
|
|
|
# tests/phpunit/includes/diff
|
|
'FakeDiffOp' => "$testDir/phpunit/includes/diff/FakeDiffOp.php",
|
|
|
|
# tests/phpunit/includes/password
|
|
'PasswordTestCase' => "$testDir/phpunit/includes/password/PasswordTestCase.php",
|
|
|
|
# tests/phpunit/includes/resourceloader
|
|
'ResourceLoaderImageModuleTest' => "$testDir/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php",
|
|
'ResourceLoaderImageModuleTestable' => "$testDir/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php",
|
|
|
|
# tests/phpunit/languages
|
|
'LanguageClassesTestCase' => "$testDir/phpunit/languages/LanguageClassesTestCase.php",
|
|
|
|
# tests/phpunit/includes/libs
|
|
'GenericArrayObjectTest' => "$testDir/phpunit/includes/libs/GenericArrayObjectTest.php",
|
|
|
|
# tests/phpunit/maintenance
|
|
'DumpTestCase' => "$testDir/phpunit/maintenance/DumpTestCase.php",
|
|
|
|
# tests/phpunit/media
|
|
'FakeDimensionFile' => "$testDir/phpunit/includes/media/FakeDimensionFile.php",
|
|
'MediaWikiMediaTestCase' => "$testDir/phpunit/includes/media/MediaWikiMediaTestCase.php",
|
|
|
|
# tests/phpunit/mocks
|
|
'MockFSFile' => "$testDir/phpunit/mocks/filebackend/MockFSFile.php",
|
|
'MockFileBackend' => "$testDir/phpunit/mocks/filebackend/MockFileBackend.php",
|
|
'MockBitmapHandler' => "$testDir/phpunit/mocks/media/MockBitmapHandler.php",
|
|
'MockImageHandler' => "$testDir/phpunit/mocks/media/MockImageHandler.php",
|
|
'MockSvgHandler' => "$testDir/phpunit/mocks/media/MockSvgHandler.php",
|
|
'MockDjVuHandler' => "$testDir/phpunit/mocks/media/MockDjVuHandler.php",
|
|
|
|
# tests/parser
|
|
'NewParserTest' => "$testDir/phpunit/includes/parser/NewParserTest.php",
|
|
'MediaWikiParserTest' => "$testDir/phpunit/includes/parser/MediaWikiParserTest.php",
|
|
'ParserTest' => "$testDir/parser/parserTest.inc",
|
|
'ParserTestParserHook' => "$testDir/parser/parserTestsParserHook.php",
|
|
|
|
# tests/phpunit/includes/site
|
|
'SiteTest' => "$testDir/phpunit/includes/site/SiteTest.php",
|
|
'TestSites' => "$testDir/phpunit/includes/site/TestSites.php",
|
|
|
|
# tests/phpunit/includes/specialpage
|
|
'SpecialPageTestHelper' => "$testDir/phpunit/includes/specialpage/SpecialPageTestHelper.php",
|
|
);
|