Separate MediaWiki unit and integration tests
authorMáté Szabó <mszabo@wikia-inc.com>
Sat, 1 Jun 2019 14:10:15 +0000 (16:10 +0200)
committerMáté Szabó <mszabo@wikia-inc.com>
Thu, 13 Jun 2019 20:56:31 +0000 (22:56 +0200)
This changeset implements T89432 and related tickets and is based on exploration
done at the Prague Hackathon. The goal is to identify tests in MediaWiki core
that can be run without having to install & configure MediaWiki and its dependencies,
and provide a way to execute these tests via the standard phpunit entry point,
allowing for faster development and integration with existing tooling like IDEs.

The initial set of tests that met these criteria were identified using the work Amir did in
I88822667693d9e00ac3d4639c87bc24e5083e5e8. These tests were then moved into a new subdirectory
under phpunit/ and organized into a separate test suite. The environment for this suite
is set up via a PHPUnit bootstrap file without a custom entry point.

You can execute these tests by running:
$ vendor/bin/phpunit -d memory_limit=512M -c tests/phpunit/unit-tests.xml

Bug: T89432
Bug: T87781
Bug: T84948
Change-Id: Iad01033a0548afd4d2a6f2c1ef6fcc9debf72c0d

426 files changed:
.phpcs.xml
tests/common/TestSetup.php
tests/common/TestsAutoLoader.php
tests/phpunit/MediaWikiUnitTestCase.php [new file with mode: 0644]
tests/phpunit/documentation/ReleaseNotesTest.php [deleted file]
tests/phpunit/includes/CommentStoreCommentTest.php [deleted file]
tests/phpunit/includes/DerivativeRequestTest.php [deleted file]
tests/phpunit/includes/FauxRequestTest.php [deleted file]
tests/phpunit/includes/FauxResponseTest.php [deleted file]
tests/phpunit/includes/FormOptionsInitializationTest.php [deleted file]
tests/phpunit/includes/FormOptionsTest.php [deleted file]
tests/phpunit/includes/GlobalFunctions/wfAppendQueryTest.php [deleted file]
tests/phpunit/includes/GlobalFunctions/wfArrayPlus2dTest.php [deleted file]
tests/phpunit/includes/GlobalFunctions/wfAssembleUrlTest.php [deleted file]
tests/phpunit/includes/GlobalFunctions/wfBaseNameTest.php [deleted file]
tests/phpunit/includes/GlobalFunctions/wfEscapeShellArgTest.php [deleted file]
tests/phpunit/includes/GlobalFunctions/wfGetCallerTest.php [deleted file]
tests/phpunit/includes/GlobalFunctions/wfRemoveDotSegmentsTest.php [deleted file]
tests/phpunit/includes/GlobalFunctions/wfShellExecTest.php [deleted file]
tests/phpunit/includes/GlobalFunctions/wfShorthandToIntegerTest.php [deleted file]
tests/phpunit/includes/GlobalFunctions/wfStringToBoolTest.php [deleted file]
tests/phpunit/includes/GlobalFunctions/wfTimestampTest.php [deleted file]
tests/phpunit/includes/GlobalFunctions/wfUrlencodeTest.php [deleted file]
tests/phpunit/includes/HooksTest.php [deleted file]
tests/phpunit/includes/LicensesTest.php [deleted file]
tests/phpunit/includes/ListToggleTest.php [deleted file]
tests/phpunit/includes/MagicWordFactoryTest.php [deleted file]
tests/phpunit/includes/MediaWikiServicesTest.php [deleted file]
tests/phpunit/includes/MediaWikiVersionFetcherTest.php [deleted file]
tests/phpunit/includes/PathRouterTest.php [deleted file]
tests/phpunit/includes/Revision/FallbackSlotRoleHandlerTest.php [deleted file]
tests/phpunit/includes/Revision/MainSlotRoleHandlerTest.php [deleted file]
tests/phpunit/includes/Revision/RevisionStoreFactoryTest.php [deleted file]
tests/phpunit/includes/Revision/SlotRecordTest.php [deleted file]
tests/phpunit/includes/Revision/SlotRoleHandlerTest.php [deleted file]
tests/phpunit/includes/SanitizerValidateEmailTest.php [deleted file]
tests/phpunit/includes/ServiceWiringTest.php [deleted file]
tests/phpunit/includes/SiteConfigurationTest.php [deleted file]
tests/phpunit/includes/Storage/BlobStoreFactoryTest.php [deleted file]
tests/phpunit/includes/Storage/PreparedEditTest.php [deleted file]
tests/phpunit/includes/TitleArrayFromResultTest.php [deleted file]
tests/phpunit/includes/WikiReferenceTest.php [deleted file]
tests/phpunit/includes/XmlJsTest.php [deleted file]
tests/phpunit/includes/XmlSelectTest.php [deleted file]
tests/phpunit/includes/actions/ViewActionTest.php [deleted file]
tests/phpunit/includes/api/ApiBlockInfoTraitTest.php [deleted file]
tests/phpunit/includes/api/ApiContinuationManagerTest.php [deleted file]
tests/phpunit/includes/api/ApiMessageTest.php [deleted file]
tests/phpunit/includes/api/ApiResultTest.php [deleted file]
tests/phpunit/includes/api/ApiUsageExceptionTest.php [deleted file]
tests/phpunit/includes/auth/AbstractPreAuthenticationProviderTest.php [deleted file]
tests/phpunit/includes/auth/AbstractSecondaryAuthenticationProviderTest.php [deleted file]
tests/phpunit/includes/auth/AuthenticationResponseTest.php [deleted file]
tests/phpunit/includes/auth/ConfirmLinkSecondaryAuthenticationProviderTest.php [deleted file]
tests/phpunit/includes/auth/EmailNotificationSecondaryAuthenticationProviderTest.php [deleted file]
tests/phpunit/includes/changes/ChangesListFilterGroupTest.php [deleted file]
tests/phpunit/includes/collation/CustomUppercaseCollationTest.php [deleted file]
tests/phpunit/includes/composer/ComposerVersionNormalizerTest.php [deleted file]
tests/phpunit/includes/config/ConfigFactoryTest.php [deleted file]
tests/phpunit/includes/config/EtcdConfigTest.php [deleted file]
tests/phpunit/includes/config/HashConfigTest.php [deleted file]
tests/phpunit/includes/config/MultiConfigTest.php [deleted file]
tests/phpunit/includes/config/ServiceOptionsTest.php [deleted file]
tests/phpunit/includes/content/JsonContentHandlerTest.php [deleted file]
tests/phpunit/includes/db/DatabaseOracleTest.php [deleted file]
tests/phpunit/includes/debug/MWDebugTest.php [deleted file]
tests/phpunit/includes/debug/logger/MonologSpiTest.php [deleted file]
tests/phpunit/includes/debug/logger/monolog/AvroFormatterTest.php [deleted file]
tests/phpunit/includes/debug/logger/monolog/CeeFormatterTest.php [deleted file]
tests/phpunit/includes/debug/logger/monolog/KafkaHandlerTest.php [deleted file]
tests/phpunit/includes/debug/logger/monolog/LineFormatterTest.php [deleted file]
tests/phpunit/includes/debug/logger/monolog/LogstashFormatterTest.php [deleted file]
tests/phpunit/includes/deferred/MWCallableUpdateTest.php [deleted file]
tests/phpunit/includes/deferred/TransactionRoundDefiningUpdateTest.php [deleted file]
tests/phpunit/includes/diff/ArrayDiffFormatterTest.php [deleted file]
tests/phpunit/includes/diff/DiffOpTest.php [deleted file]
tests/phpunit/includes/diff/DiffTest.php [deleted file]
tests/phpunit/includes/diff/DifferenceEngineSlotDiffRendererTest.php [deleted file]
tests/phpunit/includes/diff/SlotDiffRendererTest.php [deleted file]
tests/phpunit/includes/exception/HttpErrorTest.php [deleted file]
tests/phpunit/includes/exception/MWExceptionHandlerTest.php [deleted file]
tests/phpunit/includes/exception/ReadOnlyErrorTest.php [deleted file]
tests/phpunit/includes/exception/UserNotLoggedInTest.php [deleted file]
tests/phpunit/includes/externalstore/ExternalStoreFactoryTest.php [deleted file]
tests/phpunit/includes/filebackend/SwiftFileBackendTest.php [deleted file]
tests/phpunit/includes/filerepo/FileBackendDBRepoWrapperTest.php [deleted file]
tests/phpunit/includes/filerepo/FileRepoTest.php [deleted file]
tests/phpunit/includes/htmlform/HTMLAutoCompleteSelectFieldTest.php [deleted file]
tests/phpunit/includes/htmlform/HTMLCheckMatrixTest.php [deleted file]
tests/phpunit/includes/htmlform/HTMLFormTest.php [deleted file]
tests/phpunit/includes/htmlform/HTMLRestrictionsFieldTest.php [deleted file]
tests/phpunit/includes/http/GuzzleHttpRequestTest.php [deleted file]
tests/phpunit/includes/http/HttpRequestFactoryTest.php [deleted file]
tests/phpunit/includes/installer/InstallDocFormatterTest.php [deleted file]
tests/phpunit/includes/installer/OracleInstallerTest.php [deleted file]
tests/phpunit/includes/interwiki/InterwikiLookupAdapterTest.php [deleted file]
tests/phpunit/includes/jobqueue/JobQueueMemoryTest.php [deleted file]
tests/phpunit/includes/json/FormatJsonTest.php [deleted file]
tests/phpunit/includes/libs/ArrayUtilsTest.php [deleted file]
tests/phpunit/includes/libs/CookieTest.php [deleted file]
tests/phpunit/includes/libs/DeferredStringifierTest.php [deleted file]
tests/phpunit/includes/libs/DnsSrvDiscovererTest.php [deleted file]
tests/phpunit/includes/libs/EasyDeflateTest.php [deleted file]
tests/phpunit/includes/libs/GenericArrayObjectTest.php [deleted file]
tests/phpunit/includes/libs/HashRingTest.php [deleted file]
tests/phpunit/includes/libs/HtmlArmorTest.php [deleted file]
tests/phpunit/includes/libs/IEUrlExtensionTest.php [deleted file]
tests/phpunit/includes/libs/IPTest.php [deleted file]
tests/phpunit/includes/libs/JavaScriptMinifierTest.php [deleted file]
tests/phpunit/includes/libs/MapCacheLRUTest.php [deleted file]
tests/phpunit/includes/libs/MemoizedCallableTest.php [deleted file]
tests/phpunit/includes/libs/ProcessCacheLRUTest.php [deleted file]
tests/phpunit/includes/libs/SamplingStatsdClientTest.php [deleted file]
tests/phpunit/includes/libs/StaticArrayWriterTest.php [deleted file]
tests/phpunit/includes/libs/StringUtilsTest.php [deleted file]
tests/phpunit/includes/libs/TimingTest.php [deleted file]
tests/phpunit/includes/libs/XhprofDataTest.php [deleted file]
tests/phpunit/includes/libs/XhprofTest.php [deleted file]
tests/phpunit/includes/libs/XmlTypeCheckTest.php [deleted file]
tests/phpunit/includes/libs/composer/ComposerInstalledTest.php [deleted file]
tests/phpunit/includes/libs/composer/ComposerJsonTest.php [deleted file]
tests/phpunit/includes/libs/composer/ComposerLockTest.php [deleted file]
tests/phpunit/includes/libs/http/HttpAcceptNegotiatorTest.php [deleted file]
tests/phpunit/includes/libs/http/HttpAcceptParserTest.php [deleted file]
tests/phpunit/includes/libs/mime/MSCompoundFileReaderTest.php [deleted file]
tests/phpunit/includes/libs/mime/MimeAnalyzerTest.php [deleted file]
tests/phpunit/includes/libs/objectcache/CachedBagOStuffTest.php [deleted file]
tests/phpunit/includes/libs/objectcache/HashBagOStuffTest.php [deleted file]
tests/phpunit/includes/libs/objectcache/ReplicatedBagOStuffTest.php [deleted file]
tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php [deleted file]
tests/phpunit/includes/libs/rdbms/ChronologyProtectorTest.php [deleted file]
tests/phpunit/includes/libs/rdbms/TransactionProfilerTest.php [deleted file]
tests/phpunit/includes/libs/rdbms/connectionmanager/ConnectionManagerTest.php [deleted file]
tests/phpunit/includes/libs/rdbms/connectionmanager/SessionConsistentConnectionManagerTest.php [deleted file]
tests/phpunit/includes/libs/rdbms/database/DBConnRefTest.php [deleted file]
tests/phpunit/includes/libs/rdbms/database/DatabaseDomainTest.php [deleted file]
tests/phpunit/includes/libs/rdbms/database/DatabaseMssqlTest.php [deleted file]
tests/phpunit/includes/libs/rdbms/database/DatabaseMysqlBaseTest.php [deleted file]
tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php [deleted file]
tests/phpunit/includes/libs/rdbms/database/DatabaseSqliteRdbmsTest.php [deleted file]
tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php [deleted file]
tests/phpunit/includes/libs/services/ServiceContainerTest.php [deleted file]
tests/phpunit/includes/libs/services/TestWiring1.php [deleted file]
tests/phpunit/includes/libs/services/TestWiring2.php [deleted file]
tests/phpunit/includes/libs/stats/PrefixingStatsdDataFactoryProxyTest.php [deleted file]
tests/phpunit/includes/media/GIFMetadataExtractorTest.php [deleted file]
tests/phpunit/includes/media/IPTCTest.php [deleted file]
tests/phpunit/includes/media/JpegMetadataExtractorTest.php [deleted file]
tests/phpunit/includes/media/MediaHandlerTest.php [deleted file]
tests/phpunit/includes/media/SVGMetadataExtractorTest.php [deleted file]
tests/phpunit/includes/media/WebPHandlerTest.php [deleted file]
tests/phpunit/includes/objectcache/MemcachedBagOStuffTest.php [deleted file]
tests/phpunit/includes/objectcache/RESTBagOStuffTest.php [deleted file]
tests/phpunit/includes/objectcache/RedisBagOStuffTest.php [deleted file]
tests/phpunit/includes/page/ArticleTest.php [deleted file]
tests/phpunit/includes/parser/ParserPreloadTest.php [deleted file]
tests/phpunit/includes/parser/PreprocessorTest.php [deleted file]
tests/phpunit/includes/parser/TidyTest.php [deleted file]
tests/phpunit/includes/password/PasswordFactoryTest.php [deleted file]
tests/phpunit/includes/password/PasswordTest.php [deleted file]
tests/phpunit/includes/preferences/FiltersTest.php [deleted file]
tests/phpunit/includes/registration/ExtensionJsonValidatorTest.php [deleted file]
tests/phpunit/includes/registration/ExtensionProcessorTest.php [deleted file]
tests/phpunit/includes/registration/VersionCheckerTest.php [deleted file]
tests/phpunit/includes/resourceloader/DerivativeResourceLoaderContextTest.php [deleted file]
tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php [deleted file]
tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php [deleted file]
tests/phpunit/includes/resourceloader/ResourceLoaderContextTest.php [deleted file]
tests/phpunit/includes/search/SearchIndexFieldTest.php [deleted file]
tests/phpunit/includes/search/SearchSuggestionSetTest.php [deleted file]
tests/phpunit/includes/session/MetadataMergeExceptionTest.php [deleted file]
tests/phpunit/includes/session/SessionIdTest.php [deleted file]
tests/phpunit/includes/session/SessionInfoTest.php [deleted file]
tests/phpunit/includes/session/SessionProviderTest.php [deleted file]
tests/phpunit/includes/session/SessionTest.php [deleted file]
tests/phpunit/includes/session/TokenTest.php [deleted file]
tests/phpunit/includes/shell/CommandFactoryTest.php [deleted file]
tests/phpunit/includes/shell/CommandTest.php [deleted file]
tests/phpunit/includes/shell/FirejailCommandTest.php [deleted file]
tests/phpunit/includes/site/CachingSiteStoreTest.php [deleted file]
tests/phpunit/includes/site/HashSiteStoreTest.php [deleted file]
tests/phpunit/includes/site/MediaWikiPageNameNormalizerTest.php [deleted file]
tests/phpunit/includes/site/SiteExporterTest.php [deleted file]
tests/phpunit/includes/site/SiteImporterTest.php [deleted file]
tests/phpunit/includes/site/SiteImporterTest.xml [deleted file]
tests/phpunit/includes/skins/SkinFactoryTest.php [deleted file]
tests/phpunit/includes/skins/SkinTemplateTest.php [deleted file]
tests/phpunit/includes/skins/SkinTest.php [deleted file]
tests/phpunit/includes/sparql/SparqlClientTest.php [deleted file]
tests/phpunit/includes/specials/ImageListPagerTest.php [deleted file]
tests/phpunit/includes/specials/SpecialUploadTest.php [deleted file]
tests/phpunit/includes/specials/UncategorizedCategoriesPageTest.php [deleted file]
tests/phpunit/includes/tidy/RemexDriverTest.php [deleted file]
tests/phpunit/includes/tidy/html5lib-tests.json [deleted file]
tests/phpunit/includes/title/ForeignTitleTest.php [deleted file]
tests/phpunit/includes/title/NaiveForeignTitleFactoryTest.php [deleted file]
tests/phpunit/includes/title/NamespaceAwareForeignTitleFactoryTest.php [deleted file]
tests/phpunit/includes/title/TitleValueTest.php [deleted file]
tests/phpunit/includes/user/UserArrayFromResultTest.php [deleted file]
tests/phpunit/includes/utils/AvroValidatorTest.php [deleted file]
tests/phpunit/includes/utils/BatchRowUpdateTest.php [deleted file]
tests/phpunit/includes/utils/ClassCollectorTest.php [deleted file]
tests/phpunit/includes/utils/FileContentsHasherTest.php [deleted file]
tests/phpunit/includes/utils/MWCryptHashTest.php [deleted file]
tests/phpunit/includes/utils/MWRestrictionsTest.php [deleted file]
tests/phpunit/includes/utils/UIDGeneratorTest.php [deleted file]
tests/phpunit/includes/utils/ZipDirectoryReaderTest.php [deleted file]
tests/phpunit/includes/watcheditem/NoWriteWatchedItemStoreUnitTest.php [deleted file]
tests/phpunit/languages/SpecialPageAliasTest.php [deleted file]
tests/phpunit/structure/ApiPrefixUniquenessTest.php [deleted file]
tests/phpunit/structure/AutoLoaderStructureTest.php [deleted file]
tests/phpunit/structure/ContentHandlerSanityTest.php [deleted file]
tests/phpunit/structure/PasswordPolicyStructureTest.php [deleted file]
tests/phpunit/structure/StructureTest.php
tests/phpunit/suite.xml
tests/phpunit/unit-tests.xml [new file with mode: 0644]
tests/phpunit/unit/documentation/ReleaseNotesTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/CommentStoreCommentTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/DerivativeRequestTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/FauxRequestTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/FauxResponseTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/FormOptionsInitializationTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/FormOptionsTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/GlobalFunctions/wfAppendQueryTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/GlobalFunctions/wfArrayPlus2dTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/GlobalFunctions/wfAssembleUrlTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/GlobalFunctions/wfBaseNameTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/GlobalFunctions/wfEscapeShellArgTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/GlobalFunctions/wfGetCallerTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/GlobalFunctions/wfRemoveDotSegmentsTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/GlobalFunctions/wfShellExecTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/GlobalFunctions/wfShorthandToIntegerTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/GlobalFunctions/wfStringToBoolTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/GlobalFunctions/wfTimestampTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/GlobalFunctions/wfUrlencodeTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/HooksTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/LicensesTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/ListToggleTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/MagicWordFactoryTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/MediaWikiServicesTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/MediaWikiVersionFetcherTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/PathRouterTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/Revision/FallbackSlotRoleHandlerTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/Revision/MainSlotRoleHandlerTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/Revision/RevisionStoreFactoryTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/Revision/SlotRecordTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/Revision/SlotRoleHandlerTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/SanitizerValidateEmailTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/ServiceWiringTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/SiteConfigurationTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/Storage/BlobStoreFactoryTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/Storage/PreparedEditTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/TitleArrayFromResultTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/WikiReferenceTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/XmlJsTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/XmlSelectTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/actions/ViewActionTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/api/ApiBlockInfoTraitTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/api/ApiContinuationManagerTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/api/ApiMessageTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/api/ApiResultTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/api/ApiUsageExceptionTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/auth/AbstractPreAuthenticationProviderTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/auth/AbstractSecondaryAuthenticationProviderTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/auth/AuthenticationResponseTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/auth/ConfirmLinkSecondaryAuthenticationProviderTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/auth/EmailNotificationSecondaryAuthenticationProviderTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/changes/ChangesListFilterGroupTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/collation/CustomUppercaseCollationTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/composer/ComposerVersionNormalizerTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/config/ConfigFactoryTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/config/EtcdConfigTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/config/HashConfigTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/config/MultiConfigTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/config/ServiceOptionsTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/content/JsonContentHandlerTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/db/DatabaseOracleTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/debug/MWDebugTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/debug/logger/MonologSpiTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/debug/logger/monolog/AvroFormatterTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/debug/logger/monolog/CeeFormatterTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/debug/logger/monolog/KafkaHandlerTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/debug/logger/monolog/LineFormatterTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/debug/logger/monolog/LogstashFormatterTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/deferred/MWCallableUpdateTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/deferred/TransactionRoundDefiningUpdateTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/diff/ArrayDiffFormatterTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/diff/DiffOpTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/diff/DiffTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/diff/DifferenceEngineSlotDiffRendererTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/diff/SlotDiffRendererTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/exception/HttpErrorTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/exception/MWExceptionHandlerTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/exception/ReadOnlyErrorTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/exception/UserNotLoggedInTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/externalstore/ExternalStoreFactoryTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/filebackend/SwiftFileBackendTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/filerepo/FileBackendDBRepoWrapperTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/filerepo/FileRepoTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/htmlform/HTMLAutoCompleteSelectFieldTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/htmlform/HTMLCheckMatrixTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/htmlform/HTMLFormTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/htmlform/HTMLRestrictionsFieldTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/http/GuzzleHttpRequestTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/http/HttpRequestFactoryTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/installer/InstallDocFormatterTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/installer/OracleInstallerTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/interwiki/InterwikiLookupAdapterTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/jobqueue/JobQueueMemoryTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/json/FormatJsonTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/ArrayUtilsTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/CookieTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/DeferredStringifierTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/DnsSrvDiscovererTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/EasyDeflateTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/GenericArrayObjectTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/HashRingTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/HtmlArmorTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/IEUrlExtensionTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/IPTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/JavaScriptMinifierTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/MapCacheLRUTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/MemoizedCallableTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/ProcessCacheLRUTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/SamplingStatsdClientTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/StaticArrayWriterTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/StringUtilsTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/TimingTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/XhprofDataTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/XhprofTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/XmlTypeCheckTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/composer/ComposerInstalledTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/composer/ComposerJsonTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/composer/ComposerLockTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/http/HttpAcceptNegotiatorTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/http/HttpAcceptParserTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/mime/MSCompoundFileReaderTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/mime/MimeAnalyzerTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/objectcache/CachedBagOStuffTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/objectcache/HashBagOStuffTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/objectcache/ReplicatedBagOStuffTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/objectcache/WANObjectCacheTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/rdbms/ChronologyProtectorTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/rdbms/TransactionProfilerTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/rdbms/connectionmanager/ConnectionManagerTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/rdbms/connectionmanager/SessionConsistentConnectionManagerTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/rdbms/database/DBConnRefTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/rdbms/database/DatabaseDomainTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/rdbms/database/DatabaseMssqlTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/rdbms/database/DatabaseMysqlBaseTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/rdbms/database/DatabaseSQLTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/rdbms/database/DatabaseSqliteRdbmsTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/rdbms/database/DatabaseTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/services/ServiceContainerTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/services/TestWiring1.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/services/TestWiring2.php [new file with mode: 0644]
tests/phpunit/unit/includes/libs/stats/PrefixingStatsdDataFactoryProxyTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/media/GIFMetadataExtractorTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/media/IPTCTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/media/JpegMetadataExtractorTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/media/MediaHandlerTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/media/SVGMetadataExtractorTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/media/WebPHandlerTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/objectcache/MemcachedBagOStuffTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/objectcache/RESTBagOStuffTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/objectcache/RedisBagOStuffTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/page/ArticleTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/parser/ParserPreloadTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/parser/PreprocessorTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/parser/TidyTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/password/PasswordFactoryTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/password/PasswordTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/preferences/FiltersTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/registration/ExtensionJsonValidatorTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/registration/ExtensionProcessorTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/registration/VersionCheckerTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/resourceloader/DerivativeResourceLoaderContextTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/resourceloader/MessageBlobStoreTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/resourceloader/ResourceLoaderClientHtmlTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/resourceloader/ResourceLoaderContextTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/search/SearchIndexFieldTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/search/SearchSuggestionSetTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/session/MetadataMergeExceptionTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/session/SessionIdTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/session/SessionInfoTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/session/SessionProviderTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/session/SessionTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/session/TokenTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/shell/CommandFactoryTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/shell/CommandTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/shell/FirejailCommandTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/site/CachingSiteStoreTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/site/HashSiteStoreTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/site/MediaWikiPageNameNormalizerTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/site/SiteExporterTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/site/SiteImporterTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/site/SiteImporterTest.xml [new file with mode: 0644]
tests/phpunit/unit/includes/skins/SkinFactoryTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/skins/SkinTemplateTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/skins/SkinTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/sparql/SparqlClientTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/specials/ImageListPagerTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/specials/SpecialUploadTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/specials/UncategorizedCategoriesPageTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/tidy/RemexDriverTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/tidy/html5lib-tests.json [new file with mode: 0644]
tests/phpunit/unit/includes/title/ForeignTitleTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/title/NaiveForeignTitleFactoryTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/title/NamespaceAwareForeignTitleFactoryTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/title/TitleValueTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/user/UserArrayFromResultTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/utils/AvroValidatorTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/utils/BatchRowUpdateTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/utils/ClassCollectorTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/utils/FileContentsHasherTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/utils/MWCryptHashTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/utils/MWRestrictionsTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/utils/UIDGeneratorTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/utils/ZipDirectoryReaderTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/watcheditem/NoWriteWatchedItemStoreUnitTest.php [new file with mode: 0644]
tests/phpunit/unit/initUnitTests.php [new file with mode: 0644]
tests/phpunit/unit/languages/SpecialPageAliasTest.php [new file with mode: 0644]
tests/phpunit/unit/structure/ApiPrefixUniquenessTest.php [new file with mode: 0644]
tests/phpunit/unit/structure/AutoLoaderStructureTest.php [new file with mode: 0644]
tests/phpunit/unit/structure/ContentHandlerSanityTest.php [new file with mode: 0644]
tests/phpunit/unit/structure/PasswordPolicyStructureTest.php [new file with mode: 0644]

index 9ccf565..1d5ce0b 100644 (file)
                <exclude-pattern>*/maintenance/storage/trackBlobs\.php</exclude-pattern>
                <!-- Skip violations in some tests for now -->
                <exclude-pattern>*/tests/phpunit/includes/GlobalFunctions/*\.php</exclude-pattern>
+               <exclude-pattern>*/tests/phpunit/unit/includes/GlobalFunctions/*\.php</exclude-pattern>
                <exclude-pattern>*/tests/phpunit/maintenance/*\.php</exclude-pattern>
        </rule>
 
index e24c4c5..6d250be 100644 (file)
@@ -18,6 +18,9 @@ class TestSetup {
                global $wgSessionProviders, $wgSessionPbkdf2Iterations;
                global $wgJobTypeConf;
                global $wgAuthManagerConfig;
+               global $wgSecretKey;
+
+               $wgSecretKey = 'secretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecret';
 
                // wfWarn should cause tests to fail
                $wgDevelopmentWarnings = true;
index 861111a..3eb8c9a 100644 (file)
@@ -60,6 +60,7 @@ $wgAutoloadClasses += [
        'MediaWikiPHPUnitResultPrinter' => "$testDir/phpunit/MediaWikiPHPUnitResultPrinter.php",
        'MediaWikiPHPUnitTestListener' => "$testDir/phpunit/MediaWikiPHPUnitTestListener.php",
        'MediaWikiTestCase' => "$testDir/phpunit/MediaWikiTestCase.php",
+       'MediaWikiUnitTestCase' => "$testDir/phpunit/MediaWikiUnitTestCase.php",
        'MediaWikiTestResult' => "$testDir/phpunit/MediaWikiTestResult.php",
        'MediaWikiTestRunner' => "$testDir/phpunit/MediaWikiTestRunner.php",
        'PHPUnit4And6Compat' => "$testDir/phpunit/PHPUnit4And6Compat.php",
@@ -177,7 +178,7 @@ $wgAutoloadClasses += [
        'LanguageClassesTestCase' => "$testDir/phpunit/languages/LanguageClassesTestCase.php",
 
        # tests/phpunit/includes/libs
-       'GenericArrayObjectTest' => "$testDir/phpunit/includes/libs/GenericArrayObjectTest.php",
+       'GenericArrayObjectTest' => "$testDir/phpunit/unit/includes/libs/GenericArrayObjectTest.php",
 
        # tests/phpunit/maintenance
        'MediaWiki\Tests\Maintenance\DumpAsserter' => "$testDir/phpunit/maintenance/DumpAsserter.php",
diff --git a/tests/phpunit/MediaWikiUnitTestCase.php b/tests/phpunit/MediaWikiUnitTestCase.php
new file mode 100644 (file)
index 0000000..9ecc043
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+
+use MediaWiki\MediaWikiServices;
+use PHPUnit\Framework\TestCase;
+
+abstract class MediaWikiUnitTestCase extends TestCase {
+       use MediaWikiCoversValidator;
+       use PHPUnit4And6Compat;
+
+       /** @var MediaWikiServices $mwServicesBackup */
+       private $mwServicesBackup;
+
+       /**
+        * Replace global MediaWiki service locator with a clone that has the given overrides applied
+        * @param callable[] $overrides map of service names to instantiators
+        * @throws MWException
+        */
+       protected function overrideMwServices( array $overrides ) {
+               $services = clone MediaWikiServices::getInstance();
+
+               foreach ( $overrides as $serviceName => $factory ) {
+                       $services->disableService( $serviceName );
+                       $services->redefineService( $serviceName, $factory );
+               }
+
+               $this->mwServicesBackup = MediaWikiServices::forceGlobalInstance( $services );
+       }
+
+       protected function tearDown() {
+               parent::tearDown();
+
+               if ( $this->mwServicesBackup ) {
+                       MediaWikiServices::forceGlobalInstance( $this->mwServicesBackup );
+               }
+       }
+}
diff --git a/tests/phpunit/documentation/ReleaseNotesTest.php b/tests/phpunit/documentation/ReleaseNotesTest.php
deleted file mode 100644 (file)
index d20fcff..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-
-/**
- * James doesn't like having to manually fix these things.
- */
-class ReleaseNotesTest extends MediaWikiTestCase {
-       /**
-        * Verify that at least one Release Notes file exists, have content, and
-        * aren't overly long.
-        *
-        * @group documentation
-        * @coversNothing
-        */
-       public function testReleaseNotesFilesExistAndAreNotMalformed() {
-               global $wgVersion, $IP;
-
-               $notesFiles = glob( "$IP/RELEASE-NOTES-*" );
-
-               $this->assertGreaterThanOrEqual(
-                       1,
-                       count( $notesFiles ),
-                       'Repo has at least one Release Notes file.'
-               );
-
-               $versionParts = explode( '.', explode( '-', $wgVersion )[0] );
-               $this->assertContains(
-                       "$IP/RELEASE-NOTES-$versionParts[0].$versionParts[1]",
-                       $notesFiles,
-                       'Repo has a Release Notes file for the current $wgVersion.'
-               );
-
-               foreach ( $notesFiles as $index => $fileName ) {
-                       $this->assertFileLength( "Release Notes", $fileName );
-               }
-
-               // Also test the README and similar files
-               $otherFiles = [
-                       "$IP/COPYING",
-                       "$IP/FAQ",
-                       "$IP/HISTORY",
-                       "$IP/INSTALL",
-                       "$IP/README",
-                       "$IP/SECURITY"
-               ];
-
-               foreach ( $otherFiles as $index => $fileName ) {
-                       $this->assertFileLength( "Help", $fileName );
-               }
-       }
-
-       private function assertFileLength( $type, $fileName ) {
-               $file = file( $fileName, FILE_IGNORE_NEW_LINES );
-
-               $this->assertFalse(
-                       !$file,
-                       "$type file '$fileName' is inaccessible."
-               );
-
-               foreach ( $file as $i => $line ) {
-                       $num = $i + 1;
-                       $this->assertLessThanOrEqual(
-                               // FILE_IGNORE_NEW_LINES drops the \n at the EOL, so max length is 80 not 81.
-                               80,
-                               mb_strlen( $line ),
-                               "$type file '$fileName' line $num, is longer than 80 chars:\n\t'$line'"
-                       );
-               }
-       }
-}
diff --git a/tests/phpunit/includes/CommentStoreCommentTest.php b/tests/phpunit/includes/CommentStoreCommentTest.php
deleted file mode 100644 (file)
index 2dfe03a..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-use PHPUnit\Framework\TestCase;
-
-/**
- * @covers CommentStoreComment
- *
- * @license GPL-2.0-or-later
- */
-class CommentStoreCommentTest extends TestCase {
-
-       public function testConstructorWithMessage() {
-               $message = new Message( 'test' );
-               $comment = new CommentStoreComment( null, 'test', $message );
-
-               $this->assertSame( $message, $comment->message );
-       }
-
-       public function testConstructorWithoutMessage() {
-               $text = '{{template|param}}';
-               $comment = new CommentStoreComment( null, $text );
-
-               $this->assertSame( $text, $comment->message->text() );
-       }
-
-}
diff --git a/tests/phpunit/includes/DerivativeRequestTest.php b/tests/phpunit/includes/DerivativeRequestTest.php
deleted file mode 100644 (file)
index f33022b..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-
-/**
- * @covers DerivativeRequest
- */
-class DerivativeRequestTest extends PHPUnit\Framework\TestCase {
-
-       public function testSetIp() {
-               $original = new WebRequest();
-               $original->setIP( '1.2.3.4' );
-               $derivative = new DerivativeRequest( $original, [] );
-
-               $this->assertEquals( '1.2.3.4', $derivative->getIP() );
-
-               $derivative->setIP( '5.6.7.8' );
-
-               $this->assertEquals( '5.6.7.8', $derivative->getIP() );
-               $this->assertEquals( '1.2.3.4', $original->getIP() );
-       }
-
-}
diff --git a/tests/phpunit/includes/FauxRequestTest.php b/tests/phpunit/includes/FauxRequestTest.php
deleted file mode 100644 (file)
index c054caa..0000000
+++ /dev/null
@@ -1,294 +0,0 @@
-<?php
-
-use MediaWiki\Session\SessionManager;
-
-class FauxRequestTest extends PHPUnit\Framework\TestCase {
-
-       use MediaWikiCoversValidator;
-       use PHPUnit4And6Compat;
-
-       public function setUp() {
-               parent::setUp();
-               $this->orgWgServer = $GLOBALS['wgServer'];
-       }
-
-       public function tearDown() {
-               $GLOBALS['wgServer'] = $this->orgWgServer;
-               parent::tearDown();
-       }
-
-       /**
-        * @covers FauxRequest::__construct
-        */
-       public function testConstructInvalidData() {
-               $this->setExpectedException( MWException::class, 'bogus data' );
-               $req = new FauxRequest( 'x' );
-       }
-
-       /**
-        * @covers FauxRequest::__construct
-        */
-       public function testConstructInvalidSession() {
-               $this->setExpectedException( MWException::class, 'bogus session' );
-               $req = new FauxRequest( [], false, 'x' );
-       }
-
-       /**
-        * @covers FauxRequest::__construct
-        */
-       public function testConstructWithSession() {
-               $session = SessionManager::singleton()->getEmptySession( new FauxRequest( [] ) );
-               $this->assertInstanceOf(
-                       FauxRequest::class,
-                       new FauxRequest( [], false, $session )
-               );
-       }
-
-       /**
-        * @covers FauxRequest::getText
-        */
-       public function testGetText() {
-               $req = new FauxRequest( [ 'x' => 'Value' ] );
-               $this->assertEquals( 'Value', $req->getText( 'x' ) );
-               $this->assertEquals( '', $req->getText( 'z' ) );
-       }
-
-       /**
-        * Integration test for parent method
-        * @covers FauxRequest::getVal
-        */
-       public function testGetVal() {
-               $req = new FauxRequest( [ 'crlf' => "A\r\nb" ] );
-               $this->assertSame( "A\r\nb", $req->getVal( 'crlf' ), 'CRLF' );
-       }
-
-       /**
-        * Integration test for parent method
-        * @covers FauxRequest::getRawVal
-        */
-       public function testGetRawVal() {
-               $req = new FauxRequest( [
-                       'x' => 'Value',
-                       'y' => [ 'a' ],
-                       'crlf' => "A\r\nb"
-               ] );
-               $this->assertSame( 'Value', $req->getRawVal( 'x' ) );
-               $this->assertSame( null, $req->getRawVal( 'z' ), 'Not found' );
-               $this->assertSame( null, $req->getRawVal( 'y' ), 'Array is ignored' );
-               $this->assertSame( "A\r\nb", $req->getRawVal( 'crlf' ), 'CRLF' );
-       }
-
-       /**
-        * @covers FauxRequest::getValues
-        */
-       public function testGetValues() {
-               $values = [ 'x' => 'Value', 'y' => '' ];
-               $req = new FauxRequest( $values );
-               $this->assertEquals( $values, $req->getValues() );
-       }
-
-       /**
-        * @covers FauxRequest::getQueryValues
-        */
-       public function testGetQueryValues() {
-               $values = [ 'x' => 'Value', 'y' => '' ];
-
-               $req = new FauxRequest( $values );
-               $this->assertEquals( $values, $req->getQueryValues() );
-               $req = new FauxRequest( $values, /*wasPosted*/ true );
-               $this->assertEquals( [], $req->getQueryValues() );
-       }
-
-       /**
-        * @covers FauxRequest::getMethod
-        */
-       public function testGetMethod() {
-               $req = new FauxRequest( [] );
-               $this->assertEquals( 'GET', $req->getMethod() );
-               $req = new FauxRequest( [], /*wasPosted*/ true );
-               $this->assertEquals( 'POST', $req->getMethod() );
-       }
-
-       /**
-        * @covers FauxRequest::wasPosted
-        */
-       public function testWasPosted() {
-               $req = new FauxRequest( [] );
-               $this->assertFalse( $req->wasPosted() );
-               $req = new FauxRequest( [], /*wasPosted*/ true );
-               $this->assertTrue( $req->wasPosted() );
-       }
-
-       /**
-        * @covers FauxRequest::getCookie
-        * @covers FauxRequest::setCookie
-        * @covers FauxRequest::setCookies
-        */
-       public function testCookies() {
-               $req = new FauxRequest();
-               $this->assertSame( null, $req->getCookie( 'z', '' ) );
-
-               $req->setCookie( 'x', 'Value', '' );
-               $this->assertEquals( 'Value', $req->getCookie( 'x', '' ) );
-
-               $req->setCookies( [ 'x' => 'One', 'y' => 'Two' ], '' );
-               $this->assertEquals( 'One', $req->getCookie( 'x', '' ) );
-               $this->assertEquals( 'Two', $req->getCookie( 'y', '' ) );
-       }
-
-       /**
-        * @covers FauxRequest::getCookie
-        * @covers FauxRequest::setCookie
-        * @covers FauxRequest::setCookies
-        */
-       public function testCookiesDefaultPrefix() {
-               global $wgCookiePrefix;
-               $oldPrefix = $wgCookiePrefix;
-               $wgCookiePrefix = '_';
-
-               $req = new FauxRequest();
-               $this->assertSame( null, $req->getCookie( 'z' ) );
-
-               $req->setCookie( 'x', 'Value' );
-               $this->assertEquals( 'Value', $req->getCookie( 'x' ) );
-
-               $wgCookiePrefix = $oldPrefix;
-       }
-
-       /**
-        * @covers FauxRequest::getRequestURL
-        */
-       public function testGetRequestURL_disallowed() {
-               $req = new FauxRequest();
-               $this->setExpectedException( MWException::class );
-               $req->getRequestURL();
-       }
-
-       /**
-        * @covers FauxRequest::setRequestURL
-        * @covers FauxRequest::getRequestURL
-        */
-       public function testSetRequestURL() {
-               $req = new FauxRequest();
-               $req->setRequestURL( 'https://example.org' );
-               $this->assertEquals( 'https://example.org', $req->getRequestURL() );
-       }
-
-       /**
-        * @covers FauxRequest::getFullRequestURL
-        */
-       public function testGetFullRequestURL_disallowed() {
-               $GLOBALS['wgServer'] = '//wiki.test';
-               $req = new FauxRequest();
-
-               $this->setExpectedException( MWException::class );
-               $req->getFullRequestURL();
-       }
-
-       /**
-        * @covers FauxRequest::getFullRequestURL
-        */
-       public function testGetFullRequestURL_http() {
-               $GLOBALS['wgServer'] = '//wiki.test';
-               $req = new FauxRequest();
-               $req->setRequestURL( '/path' );
-
-               $this->assertSame(
-                       'http://wiki.test/path',
-                       $req->getFullRequestURL()
-               );
-       }
-
-       /**
-        * @covers FauxRequest::getFullRequestURL
-        */
-       public function testGetFullRequestURL_https() {
-               $GLOBALS['wgServer'] = '//wiki.test';
-               $req = new FauxRequest( [], false, null, 'https' );
-               $req->setRequestURL( '/path' );
-
-               $this->assertSame(
-                       'https://wiki.test/path',
-                       $req->getFullRequestURL()
-               );
-       }
-
-       /**
-        * @covers FauxRequest::__construct
-        * @covers FauxRequest::getProtocol
-        */
-       public function testProtocol() {
-               $req = new FauxRequest();
-               $this->assertEquals( 'http', $req->getProtocol() );
-               $req = new FauxRequest( [], false, null, 'http' );
-               $this->assertEquals( 'http', $req->getProtocol() );
-               $req = new FauxRequest( [], false, null, 'https' );
-               $this->assertEquals( 'https', $req->getProtocol() );
-       }
-
-       /**
-        * @covers FauxRequest::setHeader
-        * @covers FauxRequest::setHeaders
-        * @covers FauxRequest::getHeader
-        */
-       public function testGetSetHeader() {
-               $value = 'text/plain, text/html';
-
-               $request = new FauxRequest();
-               $request->setHeader( 'Accept', $value );
-
-               $this->assertEquals( $request->getHeader( 'Nonexistent' ), false );
-               $this->assertEquals( $request->getHeader( 'Accept' ), $value );
-               $this->assertEquals( $request->getHeader( 'ACCEPT' ), $value );
-               $this->assertEquals( $request->getHeader( 'accept' ), $value );
-               $this->assertEquals(
-                       $request->getHeader( 'Accept', WebRequest::GETHEADER_LIST ),
-                       [ 'text/plain', 'text/html' ]
-               );
-       }
-
-       /**
-        * @covers FauxRequest::initHeaders
-        */
-       public function testGetAllHeaders() {
-               $_SERVER['HTTP_TEST'] = 'Example';
-
-               $request = new FauxRequest();
-
-               $this->assertEquals(
-                       [],
-                       $request->getAllHeaders()
-               );
-
-               $this->assertEquals(
-                       false,
-                       $request->getHeader( 'test' )
-               );
-       }
-
-       /**
-        * @covers FauxRequest::__construct
-        * @covers FauxRequest::getSessionArray
-        */
-       public function testSessionData() {
-               $values = [ 'x' => 'Value', 'y' => '' ];
-
-               $req = new FauxRequest( [], false, /*session*/ $values );
-               $this->assertEquals( $values, $req->getSessionArray() );
-
-               $req = new FauxRequest();
-               $this->assertSame( null, $req->getSessionArray() );
-       }
-
-       /**
-        * @covers FauxRequest::getRawQueryString
-        * @covers FauxRequest::getRawPostString
-        * @covers FauxRequest::getRawInput
-        */
-       public function testDummies() {
-               $req = new FauxRequest();
-               $this->assertEquals( '', $req->getRawQueryString() );
-               $this->assertEquals( '', $req->getRawPostString() );
-               $this->assertEquals( '', $req->getRawInput() );
-       }
-}
diff --git a/tests/phpunit/includes/FauxResponseTest.php b/tests/phpunit/includes/FauxResponseTest.php
deleted file mode 100644 (file)
index 8085bc7..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-<?php
-/**
- * Copyright @ 2011 Alexandre Emsenhuber
- *
- * 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
- */
-
-class FauxResponseTest extends MediaWikiTestCase {
-       /** @var FauxResponse */
-       protected $response;
-
-       protected function setUp() {
-               parent::setUp();
-               $this->response = new FauxResponse;
-       }
-
-       /**
-        * @covers FauxResponse::setCookie
-        * @covers FauxResponse::getCookie
-        * @covers FauxResponse::getCookieData
-        * @covers FauxResponse::getCookies
-        */
-       public function testCookie() {
-               $expire = time() + 100;
-               $cookie = [
-                       'value' => 'val',
-                       'path' => '/path',
-                       'domain' => 'domain',
-                       'secure' => true,
-                       'httpOnly' => false,
-                       'raw' => false,
-                       'expire' => $expire,
-               ];
-
-               $this->assertEquals( null, $this->response->getCookie( 'xkey' ), 'Non-existing cookie' );
-               $this->response->setCookie( 'key', 'val', $expire, [
-                       'prefix' => 'x',
-                       'path' => '/path',
-                       'domain' => 'domain',
-                       'secure' => 1,
-                       'httpOnly' => 0,
-               ] );
-               $this->assertEquals( 'val', $this->response->getCookie( 'xkey' ), 'Existing cookie' );
-               $this->assertEquals( $cookie, $this->response->getCookieData( 'xkey' ),
-                       'Existing cookie (data)' );
-               $this->assertEquals( [ 'xkey' => $cookie ], $this->response->getCookies(),
-                       'Existing cookies' );
-       }
-
-       /**
-        * @covers FauxResponse::getheader
-        * @covers FauxResponse::header
-        */
-       public function testHeader() {
-               $this->assertEquals( null, $this->response->getHeader( 'Location' ), 'Non-existing header' );
-
-               $this->response->header( 'Location: http://localhost/' );
-               $this->assertEquals(
-                       'http://localhost/',
-                       $this->response->getHeader( 'Location' ),
-                       'Set header'
-               );
-
-               $this->response->header( 'Location: http://127.0.0.1/' );
-               $this->assertEquals(
-                       'http://127.0.0.1/',
-                       $this->response->getHeader( 'Location' ),
-                       'Same header'
-               );
-
-               $this->response->header( 'Location: http://127.0.0.2/', false );
-               $this->assertEquals(
-                       'http://127.0.0.1/',
-                       $this->response->getHeader( 'Location' ),
-                       'Same header with override disabled'
-               );
-
-               $this->response->header( 'Location: http://localhost/' );
-               $this->assertEquals(
-                       'http://localhost/',
-                       $this->response->getHeader( 'LOCATION' ),
-                       'Get header case insensitive'
-               );
-       }
-
-       /**
-        * @covers FauxResponse::getStatusCode
-        */
-       public function testResponseCode() {
-               $this->response->header( 'HTTP/1.1 200' );
-               $this->assertEquals( 200, $this->response->getStatusCode(), 'Header with no message' );
-
-               $this->response->header( 'HTTP/1.x 201' );
-               $this->assertEquals(
-                       201,
-                       $this->response->getStatusCode(),
-                       'Header with no message and protocol 1.x'
-               );
-
-               $this->response->header( 'HTTP/1.1 202 OK' );
-               $this->assertEquals( 202, $this->response->getStatusCode(), 'Normal header' );
-
-               $this->response->header( 'HTTP/1.x 203 OK' );
-               $this->assertEquals(
-                       203,
-                       $this->response->getStatusCode(),
-                       'Normal header with no message and protocol 1.x'
-               );
-
-               $this->response->header( 'HTTP/1.x 204 OK', false, 205 );
-               $this->assertEquals(
-                       205,
-                       $this->response->getStatusCode(),
-                       'Third parameter overrides the HTTP/... header'
-               );
-
-               $this->response->statusHeader( 210 );
-               $this->assertEquals(
-                       210,
-                       $this->response->getStatusCode(),
-                       'Handle statusHeader method'
-               );
-
-               $this->response->header( 'Location: http://localhost/', false, 206 );
-               $this->assertEquals(
-                       206,
-                       $this->response->getStatusCode(),
-                       'Third parameter with another header'
-               );
-       }
-}
diff --git a/tests/phpunit/includes/FormOptionsInitializationTest.php b/tests/phpunit/includes/FormOptionsInitializationTest.php
deleted file mode 100644 (file)
index 2c78618..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-
-use Wikimedia\TestingAccessWrapper;
-
-/**
- * Test class for FormOptions initialization
- * Ensure the FormOptions::add() does what we want it to do.
- *
- * Copyright © 2011, Antoine Musso
- *
- * @author Antoine Musso
- */
-class FormOptionsInitializationTest extends MediaWikiTestCase {
-       /**
-        * @var FormOptions
-        */
-       protected $object;
-
-       /**
-        * A new fresh and empty FormOptions object to test initialization
-        * with.
-        */
-       protected function setUp() {
-               parent::setUp();
-               $this->object = TestingAccessWrapper::newFromObject( new FormOptions() );
-       }
-
-       /**
-        * @covers FormOptions::add
-        */
-       public function testAddStringOption() {
-               $this->object->add( 'foo', 'string value' );
-               $this->assertEquals(
-                       [
-                               'foo' => [
-                                       'default' => 'string value',
-                                       'consumed' => false,
-                                       'type' => FormOptions::STRING,
-                                       'value' => null,
-                               ]
-                       ],
-                       $this->object->options
-               );
-       }
-
-       /**
-        * @covers FormOptions::add
-        */
-       public function testAddIntegers() {
-               $this->object->add( 'one', 1 );
-               $this->object->add( 'negone', -1 );
-               $this->assertEquals(
-                       [
-                               'negone' => [
-                                       'default' => -1,
-                                       'value' => null,
-                                       'consumed' => false,
-                                       'type' => FormOptions::INT,
-                               ],
-                               'one' => [
-                                       'default' => 1,
-                                       'value' => null,
-                                       'consumed' => false,
-                                       'type' => FormOptions::INT,
-                               ]
-                       ],
-                       $this->object->options
-               );
-       }
-}
diff --git a/tests/phpunit/includes/FormOptionsTest.php b/tests/phpunit/includes/FormOptionsTest.php
deleted file mode 100644 (file)
index da08670..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-/**
- * This file host two test case classes for the MediaWiki FormOptions class:
- *  - FormOptionsInitializationTest : tests initialization of the class.
- *  - FormOptionsTest : tests methods an on instance
- *
- * The split let us take advantage of setting up a fixture for the methods
- * tests.
- */
-
-/**
- * Test class for FormOptions methods.
- *
- * Copyright © 2011, Antoine Musso
- *
- * @author Antoine Musso
- */
-class FormOptionsTest extends MediaWikiTestCase {
-       /**
-        * @var FormOptions
-        */
-       protected $object;
-
-       /**
-        * Instanciates a FormOptions object to play with.
-        * FormOptions::add() is tested by the class FormOptionsInitializationTest
-        * so we assume the function is well tested already an use it to create
-        * the fixture.
-        */
-       protected function setUp() {
-               parent::setUp();
-               $this->object = new FormOptions;
-               $this->object->add( 'string1', 'string one' );
-               $this->object->add( 'string2', 'string two' );
-               $this->object->add( 'integer', 0 );
-               $this->object->add( 'float', 0.0 );
-               $this->object->add( 'intnull', 0, FormOptions::INTNULL );
-       }
-
-       /** Helpers for testGuessType() */
-       /* @{ */
-       private function assertGuessBoolean( $data ) {
-               $this->guess( FormOptions::BOOL, $data );
-       }
-
-       private function assertGuessInt( $data ) {
-               $this->guess( FormOptions::INT, $data );
-       }
-
-       private function assertGuessFloat( $data ) {
-               $this->guess( FormOptions::FLOAT, $data );
-       }
-
-       private function assertGuessString( $data ) {
-               $this->guess( FormOptions::STRING, $data );
-       }
-
-       private function assertGuessArray( $data ) {
-               $this->guess( FormOptions::ARR, $data );
-       }
-
-       /** Generic helper */
-       private function guess( $expected, $data ) {
-               $this->assertEquals(
-                       $expected,
-                       FormOptions::guessType( $data )
-               );
-       }
-
-       /* @} */
-
-       /**
-        * Reuse helpers above assertGuessBoolean assertGuessInt assertGuessString
-        * @covers FormOptions::guessType
-        */
-       public function testGuessTypeDetection() {
-               $this->assertGuessBoolean( true );
-               $this->assertGuessBoolean( false );
-
-               $this->assertGuessInt( 0 );
-               $this->assertGuessInt( -5 );
-               $this->assertGuessInt( 5 );
-               $this->assertGuessInt( 0x0F );
-
-               $this->assertGuessFloat( 0.0 );
-               $this->assertGuessFloat( 1.5 );
-               $this->assertGuessFloat( 1e3 );
-
-               $this->assertGuessString( 'true' );
-               $this->assertGuessString( 'false' );
-               $this->assertGuessString( '5' );
-               $this->assertGuessString( '0' );
-               $this->assertGuessString( '1.5' );
-
-               $this->assertGuessArray( [ 'foo' ] );
-       }
-
-       /**
-        * @expectedException MWException
-        * @covers FormOptions::guessType
-        */
-       public function testGuessTypeOnNullThrowException() {
-               $this->object->guessType( null );
-       }
-}
diff --git a/tests/phpunit/includes/GlobalFunctions/wfAppendQueryTest.php b/tests/phpunit/includes/GlobalFunctions/wfAppendQueryTest.php
deleted file mode 100644 (file)
index bb71610..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-<?php
-
-/**
- * @group GlobalFunctions
- * @covers ::wfAppendQuery
- */
-class WfAppendQueryTest extends MediaWikiTestCase {
-       /**
-        * @dataProvider provideAppendQuery
-        */
-       public function testAppendQuery( $url, $query, $expected, $message = null ) {
-               $this->assertEquals( $expected, wfAppendQuery( $url, $query ), $message );
-       }
-
-       public static function provideAppendQuery() {
-               return [
-                       [
-                               'http://www.example.org/index.php',
-                               '',
-                               'http://www.example.org/index.php',
-                               'No query'
-                       ],
-                       [
-                               'http://www.example.org/index.php',
-                               [ 'foo' => 'bar' ],
-                               'http://www.example.org/index.php?foo=bar',
-                               'Set query array'
-                       ],
-                       [
-                               'http://www.example.org/index.php?foz=baz',
-                               'foo=bar',
-                               'http://www.example.org/index.php?foz=baz&foo=bar',
-                               'Set query string'
-                       ],
-                       [
-                               'http://www.example.org/index.php?foo=bar',
-                               '',
-                               'http://www.example.org/index.php?foo=bar',
-                               'Empty string with query'
-                       ],
-                       [
-                               'http://www.example.org/index.php?foo=bar',
-                               [ 'baz' => 'quux' ],
-                               'http://www.example.org/index.php?foo=bar&baz=quux',
-                               'Add query array'
-                       ],
-                       [
-                               'http://www.example.org/index.php?foo=bar',
-                               'baz=quux',
-                               'http://www.example.org/index.php?foo=bar&baz=quux',
-                               'Add query string'
-                       ],
-                       [
-                               'http://www.example.org/index.php?foo=bar',
-                               [ 'baz' => 'quux', 'foo' => 'baz' ],
-                               'http://www.example.org/index.php?foo=bar&baz=quux&foo=baz',
-                               'Modify query array'
-                       ],
-                       [
-                               'http://www.example.org/index.php?foo=bar',
-                               'baz=quux&foo=baz',
-                               'http://www.example.org/index.php?foo=bar&baz=quux&foo=baz',
-                               'Modify query string'
-                       ],
-                       [
-                               'http://www.example.org/index.php#baz',
-                               'foo=bar',
-                               'http://www.example.org/index.php?foo=bar#baz',
-                               'URL with fragment'
-                       ],
-                       [
-                               'http://www.example.org/index.php?foo=bar#baz',
-                               'quux=blah',
-                               'http://www.example.org/index.php?foo=bar&quux=blah#baz',
-                               'URL with query string and fragment'
-                       ]
-               ];
-       }
-}
diff --git a/tests/phpunit/includes/GlobalFunctions/wfArrayPlus2dTest.php b/tests/phpunit/includes/GlobalFunctions/wfArrayPlus2dTest.php
deleted file mode 100644 (file)
index 65b56ef..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-/**
- * @group GlobalFunctions
- * @covers ::wfArrayPlus2d
- */
-class WfArrayPlus2dTest extends MediaWikiTestCase {
-       /**
-        * @dataProvider provideArrays
-        */
-       public function testWfArrayPlus2d( $baseArray, $newValues, $expected, $testName ) {
-               $this->assertEquals(
-                       $expected,
-                       wfArrayPlus2d( $baseArray, $newValues ),
-                       $testName
-               );
-       }
-
-       /**
-        * Provider for testing wfArrayPlus2d
-        *
-        * @return array
-        */
-       public static function provideArrays() {
-               return [
-                       // target array, new values array, expected result
-                       [
-                               [ 0 => '1dArray' ],
-                               [ 1 => '1dArray' ],
-                               [ 0 => '1dArray', 1 => '1dArray' ],
-                               "Test simple union of two arrays with different keys",
-                       ],
-                       [
-                               [
-                                       0 => [ 0 => '2dArray' ],
-                               ],
-                               [
-                                       0 => [ 1 => '2dArray' ],
-                               ],
-                               [
-                                       0 => [ 0 => '2dArray', 1 => '2dArray' ],
-                               ],
-                               "Test union of 2d arrays with different keys in the value array",
-                       ],
-                       [
-                               [
-                                       0 => [ 0 => '2dArray' ],
-                               ],
-                               [
-                                       0 => [ 0 => '1dArray' ],
-                               ],
-                               [
-                                       0 => [ 0 => '2dArray' ],
-                               ],
-                               "Test union of 2d arrays with same keys in the value array",
-                       ],
-                       [
-                               [
-                                       0 => [ 0 => [ 0 => '3dArray' ] ],
-                               ],
-                               [
-                                       0 => [ 0 => [ 1 => '2dArray' ] ],
-                               ],
-                               [
-                                       0 => [ 0 => [ 0 => '3dArray' ] ],
-                               ],
-                               "Test union of 3d array with different keys",
-                       ],
-                       [
-                               [
-                                       0 => [ 0 => [ 0 => '3dArray' ] ],
-                               ],
-                               [
-                                       0 => [ 1 => [ 0 => '2dArray' ] ],
-                               ],
-                               [
-                                       0 => [ 0 => [ 0 => '3dArray' ], 1 => [ 0 => '2dArray' ] ],
-                               ],
-                               "Test union of 3d array with different keys in the value array",
-                       ],
-                       [
-                               [
-                                       0 => [ 0 => [ 0 => '3dArray' ] ],
-                               ],
-                               [
-                                       0 => [ 0 => [ 0 => '2dArray' ] ],
-                               ],
-                               [
-                                       0 => [ 0 => [ 0 => '3dArray' ] ],
-                               ],
-                               "Test union of 3d array with same keys in the value array",
-                       ],
-               ];
-       }
-}
diff --git a/tests/phpunit/includes/GlobalFunctions/wfAssembleUrlTest.php b/tests/phpunit/includes/GlobalFunctions/wfAssembleUrlTest.php
deleted file mode 100644 (file)
index 7ddad36..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-<?php
-/**
- * @group GlobalFunctions
- * @covers ::wfAssembleUrl
- */
-class WfAssembleUrlTest extends MediaWikiTestCase {
-       /**
-        * @dataProvider provideURLParts
-        */
-       public function testWfAssembleUrl( $parts, $output ) {
-               $partsDump = print_r( $parts, true );
-               $this->assertEquals(
-                       $output,
-                       wfAssembleUrl( $parts ),
-                       "Testing $partsDump assembles to $output"
-               );
-       }
-
-       /**
-        * Provider of URL parts for testing wfAssembleUrl()
-        *
-        * @return array
-        */
-       public static function provideURLParts() {
-               $schemes = [
-                       '' => [],
-                       '//' => [
-                               'delimiter' => '//',
-                       ],
-                       'http://' => [
-                               'scheme' => 'http',
-                               'delimiter' => '://',
-                       ],
-               ];
-
-               $hosts = [
-                       '' => [],
-                       'example.com' => [
-                               'host' => 'example.com',
-                       ],
-                       'example.com:123' => [
-                               'host' => 'example.com',
-                               'port' => 123,
-                       ],
-                       'id@example.com' => [
-                               'user' => 'id',
-                               'host' => 'example.com',
-                       ],
-                       'id@example.com:123' => [
-                               'user' => 'id',
-                               'host' => 'example.com',
-                               'port' => 123,
-                       ],
-                       'id:key@example.com' => [
-                               'user' => 'id',
-                               'pass' => 'key',
-                               'host' => 'example.com',
-                       ],
-                       'id:key@example.com:123' => [
-                               'user' => 'id',
-                               'pass' => 'key',
-                               'host' => 'example.com',
-                               'port' => 123,
-                       ],
-               ];
-
-               $cases = [];
-               foreach ( $schemes as $scheme => $schemeParts ) {
-                       foreach ( $hosts as $host => $hostParts ) {
-                               foreach ( [ '', '/path' ] as $path ) {
-                                       foreach ( [ '', 'query' ] as $query ) {
-                                               foreach ( [ '', 'fragment' ] as $fragment ) {
-                                                       $parts = array_merge(
-                                                               $schemeParts,
-                                                               $hostParts
-                                                       );
-                                                       $url = $scheme .
-                                                               $host .
-                                                               $path;
-
-                                                       if ( $path ) {
-                                                               $parts['path'] = $path;
-                                                       }
-                                                       if ( $query ) {
-                                                               $parts['query'] = $query;
-                                                               $url .= '?' . $query;
-                                                       }
-                                                       if ( $fragment ) {
-                                                               $parts['fragment'] = $fragment;
-                                                               $url .= '#' . $fragment;
-                                                       }
-
-                                                       $cases[] = [
-                                                               $parts,
-                                                               $url,
-                                                       ];
-                                               }
-                                       }
-                               }
-                       }
-               }
-
-               $complexURL = 'http://id:key@example.org:321' .
-                       '/over/there?name=ferret&foo=bar#nose';
-               $cases[] = [
-                       wfParseUrl( $complexURL ),
-                       $complexURL,
-               ];
-
-               return $cases;
-       }
-}
diff --git a/tests/phpunit/includes/GlobalFunctions/wfBaseNameTest.php b/tests/phpunit/includes/GlobalFunctions/wfBaseNameTest.php
deleted file mode 100644 (file)
index 78e09e6..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/**
- * @group GlobalFunctions
- * @covers ::wfBaseName
- */
-class WfBaseNameTest extends MediaWikiTestCase {
-       /**
-        * @dataProvider providePaths
-        */
-       public function testBaseName( $fullpath, $basename ) {
-               $this->assertEquals( $basename, wfBaseName( $fullpath ),
-                       "wfBaseName('$fullpath') => '$basename'" );
-       }
-
-       public static function providePaths() {
-               return [
-                       [ '', '' ],
-                       [ '/', '' ],
-                       [ '\\', '' ],
-                       [ '//', '' ],
-                       [ '\\\\', '' ],
-                       [ 'a', 'a' ],
-                       [ 'aaaa', 'aaaa' ],
-                       [ '/a', 'a' ],
-                       [ '\\a', 'a' ],
-                       [ '/aaaa', 'aaaa' ],
-                       [ '\\aaaa', 'aaaa' ],
-                       [ '/aaaa/', 'aaaa' ],
-                       [ '\\aaaa\\', 'aaaa' ],
-                       [ '\\aaaa\\', 'aaaa' ],
-                       [
-                               '/mnt/upload3/wikipedia/en/thumb/8/8b/'
-                                       . 'Zork_Grand_Inquisitor_box_cover.jpg/93px-Zork_Grand_Inquisitor_box_cover.jpg',
-                               '93px-Zork_Grand_Inquisitor_box_cover.jpg'
-                       ],
-                       [ 'C:\\Progra~1\\Wikime~1\\Wikipe~1\\VIEWER.EXE', 'VIEWER.EXE' ],
-                       [ 'Östergötland_coat_of_arms.png', 'Östergötland_coat_of_arms.png' ],
-               ];
-       }
-}
diff --git a/tests/phpunit/includes/GlobalFunctions/wfEscapeShellArgTest.php b/tests/phpunit/includes/GlobalFunctions/wfEscapeShellArgTest.php
deleted file mode 100644 (file)
index 7402054..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-/**
- * @group GlobalFunctions
- * @covers ::wfEscapeShellArg
- */
-class WfEscapeShellArgTest extends MediaWikiTestCase {
-       public function testSingleInput() {
-               if ( wfIsWindows() ) {
-                       $expected = '"blah"';
-               } else {
-                       $expected = "'blah'";
-               }
-
-               $actual = wfEscapeShellArg( 'blah' );
-
-               $this->assertEquals( $expected, $actual );
-       }
-
-       public function testMultipleArgs() {
-               if ( wfIsWindows() ) {
-                       $expected = '"foo" "bar" "baz"';
-               } else {
-                       $expected = "'foo' 'bar' 'baz'";
-               }
-
-               $actual = wfEscapeShellArg( 'foo', 'bar', 'baz' );
-
-               $this->assertEquals( $expected, $actual );
-       }
-
-       public function testMultipleArgsAsArray() {
-               if ( wfIsWindows() ) {
-                       $expected = '"foo" "bar" "baz"';
-               } else {
-                       $expected = "'foo' 'bar' 'baz'";
-               }
-
-               $actual = wfEscapeShellArg( [ 'foo', 'bar', 'baz' ] );
-
-               $this->assertEquals( $expected, $actual );
-       }
-}
diff --git a/tests/phpunit/includes/GlobalFunctions/wfGetCallerTest.php b/tests/phpunit/includes/GlobalFunctions/wfGetCallerTest.php
deleted file mode 100644 (file)
index 8a7bfa5..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-/**
- * @group GlobalFunctions
- * @covers ::wfGetCaller
- */
-class WfGetCallerTest extends MediaWikiTestCase {
-       public function testZero() {
-               $this->assertEquals( 'WfGetCallerTest->testZero', wfGetCaller( 1 ) );
-       }
-
-       function callerOne() {
-               return wfGetCaller();
-       }
-
-       public function testOne() {
-               $this->assertEquals( 'WfGetCallerTest->testOne', self::callerOne() );
-       }
-
-       static function intermediateFunction( $level = 2, $n = 0 ) {
-               if ( $n > 0 ) {
-                       return self::intermediateFunction( $level, $n - 1 );
-               }
-
-               return wfGetCaller( $level );
-       }
-
-       public function testTwo() {
-               $this->assertEquals( 'WfGetCallerTest->testTwo', self::intermediateFunction() );
-       }
-
-       public function testN() {
-               $this->assertEquals( 'WfGetCallerTest->testN', self::intermediateFunction( 2, 0 ) );
-               $this->assertEquals(
-                       'WfGetCallerTest::intermediateFunction',
-                       self::intermediateFunction( 1, 0 )
-               );
-
-               for ( $i = 0; $i < 10; $i++ ) {
-                       $this->assertEquals(
-                               'WfGetCallerTest::intermediateFunction',
-                               self::intermediateFunction( $i + 1, $i )
-                       );
-               }
-       }
-}
diff --git a/tests/phpunit/includes/GlobalFunctions/wfRemoveDotSegmentsTest.php b/tests/phpunit/includes/GlobalFunctions/wfRemoveDotSegmentsTest.php
deleted file mode 100644 (file)
index eae5588..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-<?php
-
-/**
- * @group GlobalFunctions
- * @covers ::wfRemoveDotSegments
- */
-class WfRemoveDotSegmentsTest extends MediaWikiTestCase {
-       /**
-        * @dataProvider providePaths
-        */
-       public function testWfRemoveDotSegments( $inputPath, $outputPath ) {
-               $this->assertEquals(
-                       $outputPath,
-                       wfRemoveDotSegments( $inputPath ),
-                       "Testing $inputPath expands to $outputPath"
-               );
-       }
-
-       /**
-        * Provider of URL paths for testing wfRemoveDotSegments()
-        *
-        * @return array
-        */
-       public static function providePaths() {
-               return [
-                       [ '/a/b/c/./../../g', '/a/g' ],
-                       [ 'mid/content=5/../6', 'mid/6' ],
-                       [ '/a//../b', '/a/b' ],
-                       [ '/.../a', '/.../a' ],
-                       [ '.../a', '.../a' ],
-                       [ '', '' ],
-                       [ '/', '/' ],
-                       [ '//', '//' ],
-                       [ '.', '' ],
-                       [ '..', '' ],
-                       [ '...', '...' ],
-                       [ '/.', '/' ],
-                       [ '/..', '/' ],
-                       [ './', '' ],
-                       [ '../', '' ],
-                       [ './a', 'a' ],
-                       [ '../a', 'a' ],
-                       [ '../../a', 'a' ],
-                       [ '.././a', 'a' ],
-                       [ './../a', 'a' ],
-                       [ '././a', 'a' ],
-                       [ '../../', '' ],
-                       [ '.././', '' ],
-                       [ './../', '' ],
-                       [ '././', '' ],
-                       [ '../..', '' ],
-                       [ '../.', '' ],
-                       [ './..', '' ],
-                       [ './.', '' ],
-                       [ '/../../a', '/a' ],
-                       [ '/.././a', '/a' ],
-                       [ '/./../a', '/a' ],
-                       [ '/././a', '/a' ],
-                       [ '/../../', '/' ],
-                       [ '/.././', '/' ],
-                       [ '/./../', '/' ],
-                       [ '/././', '/' ],
-                       [ '/../..', '/' ],
-                       [ '/../.', '/' ],
-                       [ '/./..', '/' ],
-                       [ '/./.', '/' ],
-                       [ 'b/../../a', '/a' ],
-                       [ 'b/.././a', '/a' ],
-                       [ 'b/./../a', '/a' ],
-                       [ 'b/././a', 'b/a' ],
-                       [ 'b/../../', '/' ],
-                       [ 'b/.././', '/' ],
-                       [ 'b/./../', '/' ],
-                       [ 'b/././', 'b/' ],
-                       [ 'b/../..', '/' ],
-                       [ 'b/../.', '/' ],
-                       [ 'b/./..', '/' ],
-                       [ 'b/./.', 'b/' ],
-                       [ '/b/../../a', '/a' ],
-                       [ '/b/.././a', '/a' ],
-                       [ '/b/./../a', '/a' ],
-                       [ '/b/././a', '/b/a' ],
-                       [ '/b/../../', '/' ],
-                       [ '/b/.././', '/' ],
-                       [ '/b/./../', '/' ],
-                       [ '/b/././', '/b/' ],
-                       [ '/b/../..', '/' ],
-                       [ '/b/../.', '/' ],
-                       [ '/b/./..', '/' ],
-                       [ '/b/./.', '/b/' ],
-               ];
-       }
-}
diff --git a/tests/phpunit/includes/GlobalFunctions/wfShellExecTest.php b/tests/phpunit/includes/GlobalFunctions/wfShellExecTest.php
deleted file mode 100644 (file)
index 6279cf6..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-/**
- * @group GlobalFunctions
- * @covers ::wfShellExec
- */
-class WfShellExecTest extends MediaWikiTestCase {
-       public function testT69870() {
-               $command = wfIsWindows()
-                       // 333 = 331 + CRLF
-                       ? ( 'for /l %i in (1, 1, 1001) do @echo ' . str_repeat( '*', 331 ) )
-                       : 'printf "%-333333s" "*"';
-
-               // Test several times because it involves a race condition that may randomly succeed or fail
-               for ( $i = 0; $i < 10; $i++ ) {
-                       $output = wfShellExec( $command );
-                       $this->assertEquals( 333333, strlen( $output ) );
-               }
-       }
-}
diff --git a/tests/phpunit/includes/GlobalFunctions/wfShorthandToIntegerTest.php b/tests/phpunit/includes/GlobalFunctions/wfShorthandToIntegerTest.php
deleted file mode 100644 (file)
index 40b2e63..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-
-/**
- * @group GlobalFunctions
- * @covers ::wfShorthandToInteger
- */
-class WfShorthandToIntegerTest extends MediaWikiTestCase {
-       /**
-        * @dataProvider provideABunchOfShorthands
-        */
-       public function testWfShorthandToInteger( $input, $output, $description ) {
-               $this->assertEquals(
-                       wfShorthandToInteger( $input ),
-                       $output,
-                       $description
-               );
-       }
-
-       public static function provideABunchOfShorthands() {
-               return [
-                       [ '', -1, 'Empty string' ],
-                       [ '     ', -1, 'String of spaces' ],
-                       [ '1G', 1024 * 1024 * 1024, 'One gig uppercased' ],
-                       [ '1g', 1024 * 1024 * 1024, 'One gig lowercased' ],
-                       [ '1M', 1024 * 1024, 'One meg uppercased' ],
-                       [ '1m', 1024 * 1024, 'One meg lowercased' ],
-                       [ '1K', 1024, 'One kb uppercased' ],
-                       [ '1k', 1024, 'One kb lowercased' ],
-               ];
-       }
-}
diff --git a/tests/phpunit/includes/GlobalFunctions/wfStringToBoolTest.php b/tests/phpunit/includes/GlobalFunctions/wfStringToBoolTest.php
deleted file mode 100644 (file)
index 7f56b60..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-
-/**
- * @group GlobalFunctions
- * @covers ::wfStringToBool
- */
-class WfStringToBoolTest extends MediaWikiTestCase {
-
-       public function getTestCases() {
-               return [
-                       [ 'true', true ],
-                       [ 'on', true ],
-                       [ 'yes', true ],
-                       [ 'TRUE', true ],
-                       [ 'YeS', true ],
-                       [ 'On', true ],
-                       [ '1', true ],
-                       [ '+1', true ],
-                       [ '01', true ],
-                       [ '-001', true ],
-                       [ '  1', true ],
-                       [ '-1  ', true ],
-                       [ '', false ],
-                       [ '0', false ],
-                       [ 'false', false ],
-                       [ 'NO', false ],
-                       [ 'NOT', false ],
-                       [ 'never', false ],
-                       [ '!&', false ],
-                       [ '-0', false ],
-                       [ '+0', false ],
-                       [ 'forget about it', false ],
-                       [ ' on', false ],
-                       [ 'true ', false ],
-               ];
-       }
-
-       /**
-        * @dataProvider getTestCases
-        * @param string $str
-        * @param bool $bool
-        */
-       public function testStr2Bool( $str, $bool ) {
-               if ( $bool ) {
-                       $this->assertTrue( wfStringToBool( $str ) );
-               } else {
-                       $this->assertFalse( wfStringToBool( $str ) );
-               }
-       }
-
-}
diff --git a/tests/phpunit/includes/GlobalFunctions/wfTimestampTest.php b/tests/phpunit/includes/GlobalFunctions/wfTimestampTest.php
deleted file mode 100644 (file)
index a70f136..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-<?php
-
-/**
- * @group GlobalFunctions
- * @covers ::wfTimestamp
- */
-class WfTimestampTest extends MediaWikiTestCase {
-       /**
-        * @dataProvider provideNormalTimestamps
-        */
-       public function testNormalTimestamps( $input, $format, $output, $desc ) {
-               $this->assertEquals( $output, wfTimestamp( $format, $input ), $desc );
-       }
-
-       public static function provideNormalTimestamps() {
-               $t = gmmktime( 12, 34, 56, 1, 15, 2001 );
-
-               return [
-                       // TS_UNIX
-                       [ $t, TS_MW, '20010115123456', 'TS_UNIX to TS_MW' ],
-                       [ -30281104, TS_MW, '19690115123456', 'Negative TS_UNIX to TS_MW' ],
-                       [ $t, TS_UNIX, 979562096, 'TS_UNIX to TS_UNIX' ],
-                       [ $t, TS_DB, '2001-01-15 12:34:56', 'TS_UNIX to TS_DB' ],
-                       [ $t + 0.01, TS_MW, '20010115123456', 'TS_UNIX float to TS_MW' ],
-
-                       [ $t, TS_ISO_8601_BASIC, '20010115T123456Z', 'TS_ISO_8601_BASIC to TS_DB' ],
-
-                       // TS_MW
-                       [ '20010115123456', TS_MW, '20010115123456', 'TS_MW to TS_MW' ],
-                       [ '20010115123456', TS_UNIX, 979562096, 'TS_MW to TS_UNIX' ],
-                       [ '20010115123456', TS_DB, '2001-01-15 12:34:56', 'TS_MW to TS_DB' ],
-                       [ '20010115123456', TS_ISO_8601_BASIC, '20010115T123456Z', 'TS_MW to TS_ISO_8601_BASIC' ],
-
-                       // TS_DB
-                       [ '2001-01-15 12:34:56', TS_MW, '20010115123456', 'TS_DB to TS_MW' ],
-                       [ '2001-01-15 12:34:56', TS_UNIX, 979562096, 'TS_DB to TS_UNIX' ],
-                       [ '2001-01-15 12:34:56', TS_DB, '2001-01-15 12:34:56', 'TS_DB to TS_DB' ],
-                       [
-                               '2001-01-15 12:34:56',
-                               TS_ISO_8601_BASIC,
-                               '20010115T123456Z',
-                               'TS_DB to TS_ISO_8601_BASIC'
-                       ],
-
-                       # rfc2822 section 3.3
-                       [ '20010115123456', TS_RFC2822, 'Mon, 15 Jan 2001 12:34:56 GMT', 'TS_MW to TS_RFC2822' ],
-                       [ 'Mon, 15 Jan 2001 12:34:56 GMT', TS_MW, '20010115123456', 'TS_RFC2822 to TS_MW' ],
-                       [
-                               ' Mon, 15 Jan 2001 12:34:56 GMT',
-                               TS_MW,
-                               '20010115123456',
-                               'TS_RFC2822 with leading space to TS_MW'
-                       ],
-                       [
-                               '15 Jan 2001 12:34:56 GMT',
-                               TS_MW,
-                               '20010115123456',
-                               'TS_RFC2822 without optional day-of-week to TS_MW'
-                       ],
-
-                       # FWS = ([*WSP CRLF] 1*WSP) / obs-FWS ; Folding white space
-                       # obs-FWS = 1*WSP *(CRLF 1*WSP) ; Section 4.2
-                       [ 'Mon, 15         Jan 2001 12:34:56 GMT', TS_MW, '20010115123456', 'TS_RFC2822 to TS_MW' ],
-
-                       # WSP = SP / HTAB ; rfc2234
-                       [
-                               "Mon, 15 Jan\x092001 12:34:56 GMT",
-                               TS_MW,
-                               '20010115123456',
-                               'TS_RFC2822 with HTAB to TS_MW'
-                       ],
-                       [
-                               "Mon, 15 Jan\x09 \x09  2001 12:34:56 GMT",
-                               TS_MW,
-                               '20010115123456',
-                               'TS_RFC2822 with HTAB and SP to TS_MW'
-                       ],
-                       [
-                               'Sun, 6 Nov 94 08:49:37 GMT',
-                               TS_MW,
-                               '19941106084937',
-                               'TS_RFC2822 with obsolete year to TS_MW'
-                       ],
-               ];
-       }
-
-       /**
-        * This test checks wfTimestamp() with values outside.
-        * It needs PHP 64 bits or PHP > 5.1.
-        * See r74778 and T27451
-        * @dataProvider provideOldTimestamps
-        */
-       public function testOldTimestamps( $input, $outputType, $output, $message ) {
-               $timestamp = wfTimestamp( $outputType, $input );
-               if ( substr( $output, 0, 1 ) === '/' ) {
-                       // T66946: Day of the week calculations for very old
-                       // timestamps varies from system to system.
-                       $this->assertRegExp( $output, $timestamp, $message );
-               } else {
-                       $this->assertEquals( $output, $timestamp, $message );
-               }
-       }
-
-       public static function provideOldTimestamps() {
-               return [
-                       [
-                               '19011213204554',
-                               TS_RFC2822,
-                               'Fri, 13 Dec 1901 20:45:54 GMT',
-                               'Earliest time according to PHP documentation'
-                       ],
-                       [ '20380119031407', TS_RFC2822, 'Tue, 19 Jan 2038 03:14:07 GMT', 'Latest 32 bit time' ],
-                       [ '19011213204552', TS_UNIX, '-2147483648', 'Earliest 32 bit unix time' ],
-                       [ '20380119031407', TS_UNIX, '2147483647', 'Latest 32 bit unix time' ],
-                       [ '19011213204552', TS_RFC2822, 'Fri, 13 Dec 1901 20:45:52 GMT', 'Earliest 32 bit time' ],
-                       [
-                               '19011213204551',
-                               TS_RFC2822,
-                               'Fri, 13 Dec 1901 20:45:51 GMT', 'Earliest 32 bit time - 1'
-                       ],
-                       [ '20380119031408', TS_RFC2822, 'Tue, 19 Jan 2038 03:14:08 GMT', 'Latest 32 bit time + 1' ],
-                       [ '19011212000000', TS_MW, '19011212000000', 'Convert to itself r74778#c10645' ],
-                       [ '19011213204551', TS_UNIX, '-2147483649', 'Earliest 32 bit unix time - 1' ],
-                       [ '20380119031408', TS_UNIX, '2147483648', 'Latest 32 bit unix time + 1' ],
-                       [ '-2147483649', TS_MW, '19011213204551', '1901 negative unix time to MediaWiki' ],
-                       [ '-5331871504', TS_MW, '18010115123456', '1801 negative unix time to MediaWiki' ],
-                       [
-                               '0117-08-09 12:34:56',
-                               TS_RFC2822,
-                               '/, 09 Aug 0117 12:34:56 GMT$/',
-                               'Death of Roman Emperor [[Trajan]]'
-                       ],
-
-                       /* @todo FIXME: 00 to 101 years are taken as being in [1970-2069] */
-                       [ '-58979923200', TS_RFC2822, '/, 01 Jan 0101 00:00:00 GMT$/', '1/1/101' ],
-                       [ '-62135596800', TS_RFC2822, 'Mon, 01 Jan 0001 00:00:00 GMT', 'Year 1' ],
-
-                       /* It is not clear if we should generate a year 0 or not
-                        * We are completely off RFC2822 requirement of year being
-                        * 1900 or later.
-                        */
-                       [
-                               '-62142076800',
-                               TS_RFC2822,
-                               'Wed, 18 Oct 0000 00:00:00 GMT',
-                               'ISO 8601:2004 [[year 0]], also called [[1 BC]]'
-                       ],
-               ];
-       }
-
-       /**
-        * @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1
-        * @dataProvider provideHttpDates
-        */
-       public function testHttpDate( $input, $output, $desc ) {
-               $this->assertEquals( $output, wfTimestamp( TS_MW, $input ), $desc );
-       }
-
-       public static function provideHttpDates() {
-               return [
-                       [ 'Sun, 06 Nov 1994 08:49:37 GMT', '19941106084937', 'RFC 822 date' ],
-                       [ 'Sunday, 06-Nov-94 08:49:37 GMT', '19941106084937', 'RFC 850 date' ],
-                       [ 'Sun Nov  6 08:49:37 1994', '19941106084937', "ANSI C's asctime() format" ],
-                       // See http://www.squid-cache.org/mail-archive/squid-users/200307/0122.html and r77171
-                       [
-                               'Mon, 22 Nov 2010 14:12:42 GMT; length=52626',
-                               '20101122141242',
-                               'Netscape extension to HTTP/1.0'
-                       ],
-               ];
-       }
-
-       /**
-        * There are a number of assumptions in our codebase where wfTimestamp()
-        * should give the current date but it is not given a 0 there. See r71751 CR
-        */
-       public function testTimestampParameter() {
-               $now = wfTimestamp( TS_UNIX );
-               // We check that wfTimestamp doesn't return false (error) and use a LessThan assert
-               // for the cases where the test is run in a second boundary.
-
-               $zero = wfTimestamp( TS_UNIX, 0 );
-               $this->assertNotEquals( false, $zero );
-               $this->assertLessThan( 5, $zero - $now );
-
-               $empty = wfTimestamp( TS_UNIX, '' );
-               $this->assertNotEquals( false, $empty );
-               $this->assertLessThan( 5, $empty - $now );
-
-               $null = wfTimestamp( TS_UNIX, null );
-               $this->assertNotEquals( false, $null );
-               $this->assertLessThan( 5, $null - $now );
-       }
-}
diff --git a/tests/phpunit/includes/GlobalFunctions/wfUrlencodeTest.php b/tests/phpunit/includes/GlobalFunctions/wfUrlencodeTest.php
deleted file mode 100644 (file)
index 5d9f63d..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-<?php
-
-/**
- * The function only need a string parameter and might react to IIS7.0
- *
- * @group GlobalFunctions
- * @covers ::wfUrlencode
- */
-class WfUrlencodeTest extends MediaWikiTestCase {
-       # ### TESTS ##############################################################
-
-       /**
-        * @dataProvider provideURLS
-        */
-       public function testEncodingUrlWith( $input, $expected ) {
-               $this->verifyEncodingFor( 'Apache', $input, $expected );
-       }
-
-       /**
-        * @dataProvider provideURLS
-        */
-       public function testEncodingUrlWithMicrosoftIis7( $input, $expected ) {
-               $this->verifyEncodingFor( 'Microsoft-IIS/7', $input, $expected );
-       }
-
-       # ### HELPERS #############################################################
-
-       /**
-        * Internal helper that actually run the test.
-        * Called by the public methods testEncodingUrlWith...()
-        */
-       private function verifyEncodingFor( $server, $input, $expectations ) {
-               $expected = $this->extractExpect( $server, $expectations );
-
-               // save up global
-               $old = $_SERVER['SERVER_SOFTWARE'] ?? null;
-               $_SERVER['SERVER_SOFTWARE'] = $server;
-               wfUrlencode( null );
-
-               // do the requested test
-               $this->assertEquals(
-                       $expected,
-                       wfUrlencode( $input ),
-                       "Encoding '$input' for server '$server' should be '$expected'"
-               );
-
-               // restore global
-               if ( $old === null ) {
-                       unset( $_SERVER['SERVER_SOFTWARE'] );
-               } else {
-                       $_SERVER['SERVER_SOFTWARE'] = $old;
-               }
-               wfUrlencode( null );
-       }
-
-       /**
-        * Interprets the provider array. Return expected value depending
-        * the HTTP server name.
-        */
-       private function extractExpect( $server, $expectations ) {
-               if ( is_string( $expectations ) ) {
-                       return $expectations;
-               } elseif ( is_array( $expectations ) ) {
-                       if ( !array_key_exists( $server, $expectations ) ) {
-                               throw new MWException( __METHOD__ . " expectation does not have any "
-                                       . "value for server name $server. Check the provider array.\n" );
-                       } else {
-                               return $expectations[$server];
-                       }
-               } else {
-                       throw new MWException( __METHOD__ . " given invalid expectation for "
-                               . "'$server'. Should be a string or an array( <http server name> => <string> ).\n" );
-               }
-       }
-
-       # ### PROVIDERS ###########################################################
-
-       /**
-        * Format is either:
-        *   [ 'input', 'expected' ];
-        * Or:
-        *   [ 'input',
-        *       [ 'Apache', 'expected' ],
-        *       [ 'Microsoft-IIS/7', 'expected' ],
-        *   ],
-        * If you want to add other HTTP server name, you will have to add a new
-        * testing method much like the testEncodingUrlWith() method above.
-        */
-       public static function provideURLS() {
-               return [
-                       # ## RFC 1738 chars
-                       // + is not safe
-                       [ '+', '%2B' ],
-                       // & and = not safe in queries
-                       [ '&', '%26' ],
-                       [ '=', '%3D' ],
-
-                       [ ':', [
-                               'Apache' => ':',
-                               'Microsoft-IIS/7' => '%3A',
-                       ] ],
-
-                       // remaining chars do not need encoding
-                       [
-                               ';@$-_.!*',
-                               ';@$-_.!*',
-                       ],
-
-                       # ## Other tests
-                       // slash remain unchanged. %2F seems to break things
-                       [ '/', '/' ],
-                       // T105265
-                       [ '~', '~' ],
-
-                       // Other 'funnies' chars
-                       [ '[]', '%5B%5D' ],
-                       [ '<>', '%3C%3E' ],
-
-                       // Apostrophe is encoded
-                       [ '\'', '%27' ],
-               ];
-       }
-}
diff --git a/tests/phpunit/includes/HooksTest.php b/tests/phpunit/includes/HooksTest.php
deleted file mode 100644 (file)
index c66b712..0000000
+++ /dev/null
@@ -1,332 +0,0 @@
-<?php
-
-class HooksTest extends MediaWikiTestCase {
-
-       function setUp() {
-               global $wgHooks;
-               parent::setUp();
-               Hooks::clear( 'MediaWikiHooksTest001' );
-               unset( $wgHooks['MediaWikiHooksTest001'] );
-       }
-
-       public static function provideHooks() {
-               $i = new NothingClass();
-
-               return [
-                       [
-                               'Object and method',
-                               [ $i, 'someNonStatic' ],
-                               'changed-nonstatic',
-                               'changed-nonstatic'
-                       ],
-                       [ 'Object and no method', [ $i ], 'changed-onevent', 'original' ],
-                       [
-                               'Object and method with data',
-                               [ $i, 'someNonStaticWithData', 'data' ],
-                               'data',
-                               'original'
-                       ],
-                       [ 'Object and static method', [ $i, 'someStatic' ], 'changed-static', 'original' ],
-                       [
-                               'Class::method static call',
-                               [ 'NothingClass::someStatic' ],
-                               'changed-static',
-                               'original'
-                       ],
-                       [
-                               'Class::method static call as array',
-                               [ [ 'NothingClass::someStatic' ] ],
-                               'changed-static',
-                               'original'
-                       ],
-                       [ 'Global function', [ 'NothingFunction' ], 'changed-func', 'original' ],
-                       [ 'Global function with data', [ 'NothingFunctionData', 'data' ], 'data', 'original' ],
-                       [ 'Closure', [ function ( &$foo, $bar ) {
-                               $foo = 'changed-closure';
-
-                               return true;
-                       } ], 'changed-closure', 'original' ],
-                       [ 'Closure with data', [ function ( $data, &$foo, $bar ) {
-                               $foo = $data;
-
-                               return true;
-                       }, 'data' ], 'data', 'original' ]
-               ];
-       }
-
-       /**
-        * @dataProvider provideHooks
-        * @covers Hooks::register
-        * @covers Hooks::run
-        * @covers Hooks::callHook
-        */
-       public function testNewStyleHooks( $msg, $hook, $expectedFoo, $expectedBar ) {
-               $foo = $bar = 'original';
-
-               Hooks::register( 'MediaWikiHooksTest001', $hook );
-               Hooks::run( 'MediaWikiHooksTest001', [ &$foo, &$bar ] );
-
-               $this->assertSame( $expectedFoo, $foo, $msg );
-               $this->assertSame( $expectedBar, $bar, $msg );
-       }
-
-       /**
-        * @covers Hooks::getHandlers
-        */
-       public function testGetHandlers() {
-               global $wgHooks;
-
-               $this->assertSame(
-                       [],
-                       Hooks::getHandlers( 'MediaWikiHooksTest001' ),
-                       'No hooks registered'
-               );
-
-               $a = new NothingClass();
-               $b = new NothingClass();
-
-               $wgHooks['MediaWikiHooksTest001'][] = $a;
-
-               $this->assertSame(
-                       [ $a ],
-                       Hooks::getHandlers( 'MediaWikiHooksTest001' ),
-                       'Hook registered by $wgHooks'
-               );
-
-               Hooks::register( 'MediaWikiHooksTest001', $b );
-               $this->assertSame(
-                       [ $b, $a ],
-                       Hooks::getHandlers( 'MediaWikiHooksTest001' ),
-                       'Hooks::getHandlers() should return hooks registered via wgHooks as well as Hooks::register'
-               );
-
-               Hooks::clear( 'MediaWikiHooksTest001' );
-               unset( $wgHooks['MediaWikiHooksTest001'] );
-
-               Hooks::register( 'MediaWikiHooksTest001', $b );
-               $this->assertSame(
-                       [ $b ],
-                       Hooks::getHandlers( 'MediaWikiHooksTest001' ),
-                       'Hook registered by Hook::register'
-               );
-       }
-
-       /**
-        * @covers Hooks::isRegistered
-        * @covers Hooks::register
-        * @covers Hooks::run
-        * @covers Hooks::callHook
-        */
-       public function testNewStyleHookInteraction() {
-               global $wgHooks;
-
-               $a = new NothingClass();
-               $b = new NothingClass();
-
-               $wgHooks['MediaWikiHooksTest001'][] = $a;
-               $this->assertTrue(
-                       Hooks::isRegistered( 'MediaWikiHooksTest001' ),
-                       'Hook registered via $wgHooks should be noticed by Hooks::isRegistered'
-               );
-
-               Hooks::register( 'MediaWikiHooksTest001', $b );
-               $this->assertEquals(
-                       2,
-                       count( Hooks::getHandlers( 'MediaWikiHooksTest001' ) ),
-                       'Hooks::getHandlers() should return hooks registered via wgHooks as well as Hooks::register'
-               );
-
-               $foo = 'quux';
-               $bar = 'qaax';
-
-               Hooks::run( 'MediaWikiHooksTest001', [ &$foo, &$bar ] );
-               $this->assertEquals(
-                       1,
-                       $a->calls,
-                       'Hooks::run() should run hooks registered via wgHooks as well as Hooks::register'
-               );
-               $this->assertEquals(
-                       1,
-                       $b->calls,
-                       'Hooks::run() should run hooks registered via wgHooks as well as Hooks::register'
-               );
-       }
-
-       /**
-        * @expectedException MWException
-        * @covers Hooks::run
-        * @covers Hooks::callHook
-        */
-       public function testUncallableFunction() {
-               Hooks::register( 'MediaWikiHooksTest001', 'ThisFunctionDoesntExist' );
-               Hooks::run( 'MediaWikiHooksTest001', [] );
-       }
-
-       /**
-        * @covers Hooks::run
-        * @covers Hooks::callHook
-        */
-       public function testFalseReturn() {
-               Hooks::register( 'MediaWikiHooksTest001', function ( &$foo ) {
-                       return false;
-               } );
-               Hooks::register( 'MediaWikiHooksTest001', function ( &$foo ) {
-                       $foo = 'test';
-
-                       return true;
-               } );
-               $foo = 'original';
-               Hooks::run( 'MediaWikiHooksTest001', [ &$foo ] );
-               $this->assertSame( 'original', $foo, 'Hooks abort after a false return.' );
-       }
-
-       /**
-        * @covers Hooks::run
-        */
-       public function testNullReturn() {
-               Hooks::register( 'MediaWikiHooksTest001', function ( &$foo ) {
-                       return;
-               } );
-               Hooks::register( 'MediaWikiHooksTest001', function ( &$foo ) {
-                       $foo = 'test';
-
-                       return true;
-               } );
-               $foo = 'original';
-               Hooks::run( 'MediaWikiHooksTest001', [ &$foo ] );
-               $this->assertSame( 'test', $foo, 'Hooks continue after a null return.' );
-       }
-
-       /**
-        * @covers Hooks::callHook
-        */
-       public function testCallHook_FalseHook() {
-               Hooks::register( 'MediaWikiHooksTest001', false );
-               Hooks::register( 'MediaWikiHooksTest001', function ( &$foo ) {
-                       $foo = 'test';
-
-                       return true;
-               } );
-               $foo = 'original';
-               Hooks::run( 'MediaWikiHooksTest001', [ &$foo ] );
-               $this->assertSame( 'test', $foo, 'Hooks that are falsey are skipped.' );
-       }
-
-       /**
-        * @covers Hooks::callHook
-        * @expectedException MWException
-        */
-       public function testCallHook_UnknownDatatype() {
-               Hooks::register( 'MediaWikiHooksTest001', 12345 );
-               Hooks::run( 'MediaWikiHooksTest001' );
-       }
-
-       /**
-        * @covers Hooks::callHook
-        * @expectedException PHPUnit_Framework_Error_Deprecated
-        */
-       public function testCallHook_Deprecated() {
-               Hooks::register( 'MediaWikiHooksTest001', 'NothingClass::someStatic' );
-               Hooks::run( 'MediaWikiHooksTest001', [], '1.31' );
-       }
-
-       /**
-        * @covers Hooks::runWithoutAbort
-        * @covers Hooks::callHook
-        */
-       public function testRunWithoutAbort() {
-               $list = [];
-               Hooks::register( 'MediaWikiHooksTest001', function ( &$list ) {
-                       $list[] = 1;
-                       return true; // Explicit true
-               } );
-               Hooks::register( 'MediaWikiHooksTest001', function ( &$list ) {
-                       $list[] = 2;
-                       return; // Implicit null
-               } );
-               Hooks::register( 'MediaWikiHooksTest001', function ( &$list ) {
-                       $list[] = 3;
-                       // No return
-               } );
-
-               Hooks::runWithoutAbort( 'MediaWikiHooksTest001', [ &$list ] );
-               $this->assertSame( [ 1, 2, 3 ], $list, 'All hooks ran.' );
-       }
-
-       /**
-        * @covers Hooks::runWithoutAbort
-        * @covers Hooks::callHook
-        */
-       public function testRunWithoutAbortWarning() {
-               Hooks::register( 'MediaWikiHooksTest001', function ( &$foo ) {
-                       return false;
-               } );
-               Hooks::register( 'MediaWikiHooksTest001', function ( &$foo ) {
-                       $foo = 'test';
-                       return true;
-               } );
-               $foo = 'original';
-
-               $this->setExpectedException(
-                       UnexpectedValueException::class,
-                       'Invalid return from hook-MediaWikiHooksTest001-closure for ' .
-                               'unabortable MediaWikiHooksTest001'
-               );
-               Hooks::runWithoutAbort( 'MediaWikiHooksTest001', [ &$foo ] );
-       }
-
-       /**
-        * @expectedException FatalError
-        * @covers Hooks::run
-        */
-       public function testFatalError() {
-               Hooks::register( 'MediaWikiHooksTest001', function () {
-                       return 'test';
-               } );
-               Hooks::run( 'MediaWikiHooksTest001', [] );
-       }
-}
-
-function NothingFunction( &$foo, &$bar ) {
-       $foo = 'changed-func';
-
-       return true;
-}
-
-function NothingFunctionData( $data, &$foo, &$bar ) {
-       $foo = $data;
-
-       return true;
-}
-
-class NothingClass {
-       public $calls = 0;
-
-       public static function someStatic( &$foo, &$bar ) {
-               $foo = 'changed-static';
-
-               return true;
-       }
-
-       public function someNonStatic( &$foo, &$bar ) {
-               $this->calls++;
-               $foo = 'changed-nonstatic';
-               $bar = 'changed-nonstatic';
-
-               return true;
-       }
-
-       public function onMediaWikiHooksTest001( &$foo, &$bar ) {
-               $this->calls++;
-               $foo = 'changed-onevent';
-
-               return true;
-       }
-
-       public function someNonStaticWithData( $data, &$foo, &$bar ) {
-               $this->calls++;
-               $foo = $data;
-
-               return true;
-       }
-}
diff --git a/tests/phpunit/includes/LicensesTest.php b/tests/phpunit/includes/LicensesTest.php
deleted file mode 100644 (file)
index 0e96bf4..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-/**
- * @covers Licenses
- */
-class LicensesTest extends MediaWikiTestCase {
-
-       public function testLicenses() {
-               $str = "
-* Free licenses:
-** GFDL|Debian disagrees
-";
-
-               $lc = new Licenses( [
-                       'fieldname' => 'FooField',
-                       'type' => 'select',
-                       'section' => 'description',
-                       'id' => 'wpLicense',
-                       'label' => 'A label text', # Note can't test label-message because $wgOut is not defined
-                       'name' => 'AnotherName',
-                       'licenses' => $str,
-               ] );
-               $this->assertThat( $lc, $this->isInstanceOf( Licenses::class ) );
-       }
-}
diff --git a/tests/phpunit/includes/ListToggleTest.php b/tests/phpunit/includes/ListToggleTest.php
deleted file mode 100644 (file)
index 3574545..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-
-/**
- * @covers ListToggle
- */
-class ListToggleTest extends MediaWikiTestCase {
-
-       /**
-        * @covers ListToggle::__construct
-        */
-       public function testConstruct() {
-               $output = $this->getMockBuilder( OutputPage::class )
-                       ->setMethods( null )
-                       ->disableOriginalConstructor()
-                       ->getMock();
-
-               $listToggle = new ListToggle( $output );
-
-               $this->assertInstanceOf( ListToggle::class, $listToggle );
-               $this->assertContains( 'mediawiki.checkboxtoggle', $output->getModules() );
-               $this->assertContains( 'mediawiki.checkboxtoggle.styles', $output->getModuleStyles() );
-       }
-
-       /**
-        * @covers ListToggle::getHTML
-        */
-       public function testGetHTML() {
-               $output = $this->createMock( OutputPage::class );
-               $output->expects( $this->any() )
-                       ->method( 'msg' )
-                       ->will( $this->returnCallback( function ( $key ) {
-                               return wfMessage( $key )->inLanguage( 'qqx' );
-                       } ) );
-               $output->expects( $this->once() )
-                       ->method( 'getLanguage' )
-                       ->will( $this->returnValue( Language::factory( 'qqx' ) ) );
-
-               $listToggle = new ListToggle( $output );
-
-               $html = $listToggle->getHTML();
-               $this->assertEquals( '<div class="mw-checkbox-toggle-controls">' .
-                       '(checkbox-select: <a class="mw-checkbox-all" role="button"' .
-                       ' tabindex="0">(checkbox-all)</a>(comma-separator)' .
-                       '<a class="mw-checkbox-none" role="button" tabindex="0">' .
-                       '(checkbox-none)</a>(comma-separator)<a class="mw-checkbox-invert" ' .
-                       'role="button" tabindex="0">(checkbox-invert)</a>)</div>',
-                       $html );
-       }
-}
diff --git a/tests/phpunit/includes/MagicWordFactoryTest.php b/tests/phpunit/includes/MagicWordFactoryTest.php
deleted file mode 100644 (file)
index 065024b..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-
-/**
- * @covers \MagicWordFactory
- *
- * @author Derick N. Alangi
- */
-class MagicWordFactoryTest extends MediaWikiTestCase {
-       private function makeMagicWordFactory( Language $contLang = null ) {
-               return new MagicWordFactory( $contLang ?: Language::factory( 'en' ) );
-       }
-
-       public function testGetContentLanguage() {
-               $contLang = Language::factory( 'en' );
-
-               $magicWordFactory = $this->makeMagicWordFactory( $contLang );
-               $magicWordContLang = $magicWordFactory->getContentLanguage();
-
-               $this->assertSame( $contLang, $magicWordContLang );
-       }
-
-       public function testGetMagicWord() {
-               $magicWordIdValid = 'pageid';
-               $magicWordFactory = $this->makeMagicWordFactory();
-               $mwActual = $magicWordFactory->get( $magicWordIdValid );
-               $contLang = $magicWordFactory->getContentLanguage();
-               $expected = new MagicWord( $magicWordIdValid, [ 'PAGEID' ], false, $contLang );
-
-               $this->assertEquals( $expected, $mwActual );
-       }
-
-       public function testGetInvalidMagicWord() {
-               $magicWordFactory = $this->makeMagicWordFactory();
-
-               $this->setExpectedException( MWException::class );
-               \Wikimedia\suppressWarnings();
-               try {
-                       $magicWordFactory->get( 'invalid magic word' );
-               } finally {
-                       \Wikimedia\restoreWarnings();
-               }
-       }
-
-       public function testGetVariableIDs() {
-               $magicWordFactory = $this->makeMagicWordFactory();
-               $varIds = $magicWordFactory->getVariableIDs();
-
-               $this->assertInternalType( 'array', $varIds );
-               $this->assertNotEmpty( $varIds );
-               $this->assertContainsOnly( 'string', $varIds );
-       }
-
-       public function testGetSubstIDs() {
-               $magicWordFactory = $this->makeMagicWordFactory();
-               $substIds = $magicWordFactory->getSubstIDs();
-
-               $this->assertInternalType( 'array', $substIds );
-               $this->assertNotEmpty( $substIds );
-               $this->assertContainsOnly( 'string', $substIds );
-       }
-
-       /**
-        * Test both valid and invalid caching hints paths
-        */
-       public function testGetCacheTTL() {
-               $magicWordFactory = $this->makeMagicWordFactory();
-               $actual = $magicWordFactory->getCacheTTL( 'localday' );
-
-               $this->assertSame( 3600, $actual );
-
-               $actual = $magicWordFactory->getCacheTTL( 'currentmonth' );
-               $this->assertSame( 86400, $actual );
-
-               $actual = $magicWordFactory->getCacheTTL( 'invalid' );
-               $this->assertSame( -1, $actual );
-       }
-
-       public function testGetDoubleUnderscoreArray() {
-               $magicWordFactory = $this->makeMagicWordFactory();
-               $actual = $magicWordFactory->getDoubleUnderscoreArray();
-
-               $this->assertInstanceOf( MagicWordArray::class, $actual );
-       }
-}
diff --git a/tests/phpunit/includes/MediaWikiServicesTest.php b/tests/phpunit/includes/MediaWikiServicesTest.php
deleted file mode 100644 (file)
index 8fa0cd6..0000000
+++ /dev/null
@@ -1,372 +0,0 @@
-<?php
-
-use MediaWiki\MediaWikiServices;
-use Wikimedia\Services\DestructibleService;
-use Wikimedia\Services\SalvageableService;
-use Wikimedia\Services\ServiceDisabledException;
-
-/**
- * @covers MediaWiki\MediaWikiServices
- *
- * @group MediaWiki
- */
-class MediaWikiServicesTest extends MediaWikiTestCase {
-       private $deprecatedServices = [];
-
-       /**
-        * @return Config
-        */
-       private function newTestConfig() {
-               $globalConfig = new GlobalVarConfig();
-
-               $testConfig = new HashConfig();
-               $testConfig->set( 'ServiceWiringFiles', $globalConfig->get( 'ServiceWiringFiles' ) );
-               $testConfig->set( 'ConfigRegistry', $globalConfig->get( 'ConfigRegistry' ) );
-
-               return $testConfig;
-       }
-
-       /**
-        * @return MediaWikiServices
-        */
-       private function newMediaWikiServices( Config $config = null ) {
-               if ( $config === null ) {
-                       $config = $this->newTestConfig();
-               }
-
-               $instance = new MediaWikiServices( $config );
-
-               // Load the default wiring from the specified files.
-               $wiringFiles = $config->get( 'ServiceWiringFiles' );
-               $instance->loadWiringFiles( $wiringFiles );
-
-               return $instance;
-       }
-
-       public function testGetInstance() {
-               $services = MediaWikiServices::getInstance();
-               $this->assertInstanceOf( MediaWikiServices::class, $services );
-       }
-
-       public function testForceGlobalInstance() {
-               $newServices = $this->newMediaWikiServices();
-               $oldServices = MediaWikiServices::forceGlobalInstance( $newServices );
-
-               $this->assertInstanceOf( MediaWikiServices::class, $oldServices );
-               $this->assertNotSame( $oldServices, $newServices );
-
-               $theServices = MediaWikiServices::getInstance();
-               $this->assertSame( $theServices, $newServices );
-
-               MediaWikiServices::forceGlobalInstance( $oldServices );
-
-               $theServices = MediaWikiServices::getInstance();
-               $this->assertSame( $theServices, $oldServices );
-       }
-
-       public function testResetGlobalInstance() {
-               $newServices = $this->newMediaWikiServices();
-               $oldServices = MediaWikiServices::forceGlobalInstance( $newServices );
-
-               $service1 = $this->createMock( SalvageableService::class );
-               $service1->expects( $this->never() )
-                       ->method( 'salvage' );
-
-               $newServices->defineService(
-                       'Test',
-                       function () use ( $service1 ) {
-                               return $service1;
-                       }
-               );
-
-               // force instantiation
-               $newServices->getService( 'Test' );
-
-               MediaWikiServices::resetGlobalInstance( $this->newTestConfig() );
-               $theServices = MediaWikiServices::getInstance();
-
-               $this->assertSame(
-                       $service1,
-                       $theServices->getService( 'Test' ),
-                       'service definition should survive reset'
-               );
-
-               $this->assertNotSame( $theServices, $newServices );
-               $this->assertNotSame( $theServices, $oldServices );
-
-               MediaWikiServices::forceGlobalInstance( $oldServices );
-       }
-
-       public function testResetGlobalInstance_quick() {
-               $newServices = $this->newMediaWikiServices();
-               $oldServices = MediaWikiServices::forceGlobalInstance( $newServices );
-
-               $service1 = $this->createMock( SalvageableService::class );
-               $service1->expects( $this->never() )
-                       ->method( 'salvage' );
-
-               $service2 = $this->createMock( SalvageableService::class );
-               $service2->expects( $this->once() )
-                       ->method( 'salvage' )
-                       ->with( $service1 );
-
-               // sequence of values the instantiator will return
-               $instantiatorReturnValues = [
-                       $service1,
-                       $service2,
-               ];
-
-               $newServices->defineService(
-                       'Test',
-                       function () use ( &$instantiatorReturnValues ) {
-                               return array_shift( $instantiatorReturnValues );
-                       }
-               );
-
-               // force instantiation
-               $newServices->getService( 'Test' );
-
-               MediaWikiServices::resetGlobalInstance( $this->newTestConfig(), 'quick' );
-               $theServices = MediaWikiServices::getInstance();
-
-               $this->assertSame( $service2, $theServices->getService( 'Test' ) );
-
-               $this->assertNotSame( $theServices, $newServices );
-               $this->assertNotSame( $theServices, $oldServices );
-
-               MediaWikiServices::forceGlobalInstance( $oldServices );
-       }
-
-       public function testDisableStorageBackend() {
-               $newServices = $this->newMediaWikiServices();
-               $oldServices = MediaWikiServices::forceGlobalInstance( $newServices );
-
-               $lbFactory = $this->getMockBuilder( \Wikimedia\Rdbms\LBFactorySimple::class )
-                       ->disableOriginalConstructor()
-                       ->getMock();
-
-               $newServices->redefineService(
-                       'DBLoadBalancerFactory',
-                       function () use ( $lbFactory ) {
-                               return $lbFactory;
-                       }
-               );
-
-               // force the service to become active, so we can check that it does get destroyed
-               $newServices->getService( 'DBLoadBalancerFactory' );
-
-               MediaWikiServices::disableStorageBackend(); // should destroy DBLoadBalancerFactory
-
-               try {
-                       MediaWikiServices::getInstance()->getService( 'DBLoadBalancerFactory' );
-                       $this->fail( 'DBLoadBalancerFactory should have been disabled' );
-               }
-               catch ( ServiceDisabledException $ex ) {
-                       // ok, as expected
-               } catch ( Throwable $ex ) {
-                       $this->fail( 'ServiceDisabledException expected, caught ' . get_class( $ex ) );
-               }
-
-               MediaWikiServices::forceGlobalInstance( $oldServices );
-               $newServices->destroy();
-
-               // No exception was thrown, avoid being risky
-               $this->assertTrue( true );
-       }
-
-       public function testResetChildProcessServices() {
-               $newServices = $this->newMediaWikiServices();
-               $oldServices = MediaWikiServices::forceGlobalInstance( $newServices );
-
-               $service1 = $this->createMock( DestructibleService::class );
-               $service1->expects( $this->once() )
-                       ->method( 'destroy' );
-
-               $service2 = $this->createMock( DestructibleService::class );
-               $service2->expects( $this->never() )
-                       ->method( 'destroy' );
-
-               // sequence of values the instantiator will return
-               $instantiatorReturnValues = [
-                       $service1,
-                       $service2,
-               ];
-
-               $newServices->defineService(
-                       'Test',
-                       function () use ( &$instantiatorReturnValues ) {
-                               return array_shift( $instantiatorReturnValues );
-                       }
-               );
-
-               // force the service to become active, so we can check that it does get destroyed
-               $oldTestService = $newServices->getService( 'Test' );
-
-               MediaWikiServices::resetChildProcessServices();
-               $finalServices = MediaWikiServices::getInstance();
-
-               $newTestService = $finalServices->getService( 'Test' );
-               $this->assertNotSame( $oldTestService, $newTestService );
-
-               MediaWikiServices::forceGlobalInstance( $oldServices );
-       }
-
-       public function testResetServiceForTesting() {
-               $services = $this->newMediaWikiServices();
-               $serviceCounter = 0;
-
-               $services->defineService(
-                       'Test',
-                       function () use ( &$serviceCounter ) {
-                               $serviceCounter++;
-                               $service = $this->createMock( Wikimedia\Services\DestructibleService::class );
-                               $service->expects( $this->once() )->method( 'destroy' );
-                               return $service;
-                       }
-               );
-
-               // This should do nothing. In particular, it should not create a service instance.
-               $services->resetServiceForTesting( 'Test' );
-               $this->assertEquals( 0, $serviceCounter, 'No service instance should be created yet.' );
-
-               $oldInstance = $services->getService( 'Test' );
-               $this->assertEquals( 1, $serviceCounter, 'A service instance should exit now.' );
-
-               // The old instance should be detached, and destroy() called.
-               $services->resetServiceForTesting( 'Test' );
-               $newInstance = $services->getService( 'Test' );
-
-               $this->assertNotSame( $oldInstance, $newInstance );
-
-               // Satisfy the expectation that destroy() is called also for the second service instance.
-               $newInstance->destroy();
-       }
-
-       public function testResetServiceForTesting_noDestroy() {
-               $services = $this->newMediaWikiServices();
-
-               $services->defineService(
-                       'Test',
-                       function () {
-                               $service = $this->createMock( Wikimedia\Services\DestructibleService::class );
-                               $service->expects( $this->never() )->method( 'destroy' );
-                               return $service;
-                       }
-               );
-
-               $oldInstance = $services->getService( 'Test' );
-
-               // The old instance should be detached, but destroy() not called.
-               $services->resetServiceForTesting( 'Test', false );
-               $newInstance = $services->getService( 'Test' );
-
-               $this->assertNotSame( $oldInstance, $newInstance );
-       }
-
-       public function provideGetters() {
-               $getServiceCases = $this->provideGetService();
-               $getterCases = [];
-
-               // All getters should be named just like the service, with "get" added.
-               foreach ( $getServiceCases as $name => $case ) {
-                       if ( $name[0] === '_' ) {
-                               // Internal service, no getter
-                               continue;
-                       }
-                       list( $service, $class ) = $case;
-                       $getterCases[$name] = [
-                               'get' . $service,
-                               $class,
-                               in_array( $service, $this->deprecatedServices )
-                       ];
-               }
-
-               return $getterCases;
-       }
-
-       /**
-        * @dataProvider provideGetters
-        */
-       public function testGetters( $getter, $type, $isDeprecated = false ) {
-               if ( $isDeprecated ) {
-                       $this->hideDeprecated( MediaWikiServices::class . "::$getter" );
-               }
-
-               // Test against the default instance, since the dummy will not know the default services.
-               $services = MediaWikiServices::getInstance();
-               $service = $services->$getter();
-               $this->assertInstanceOf( $type, $service );
-       }
-
-       public function provideGetService() {
-               global $IP;
-               $serviceList = require "$IP/includes/ServiceWiring.php";
-               $ret = [];
-               foreach ( $serviceList as $name => $callback ) {
-                       $fun = new ReflectionFunction( $callback );
-                       if ( !$fun->hasReturnType() ) {
-                               throw new MWException( 'All service callbacks must have a return type defined, ' .
-                                       "none found for $name" );
-                       }
-                       $ret[$name] = [ $name, $fun->getReturnType()->__toString() ];
-               }
-               return $ret;
-       }
-
-       /**
-        * @dataProvider provideGetService
-        */
-       public function testGetService( $name, $type ) {
-               // Test against the default instance, since the dummy will not know the default services.
-               $services = MediaWikiServices::getInstance();
-
-               $service = $services->getService( $name );
-               $this->assertInstanceOf( $type, $service );
-       }
-
-       public function testDefaultServiceInstantiation() {
-               // Check all services in the default instance, not a dummy instance!
-               // Note that we instantiate all services here, including any that
-               // were registered by extensions.
-               $services = MediaWikiServices::getInstance();
-               $names = $services->getServiceNames();
-
-               foreach ( $names as $name ) {
-                       $this->assertTrue( $services->hasService( $name ) );
-                       $service = $services->getService( $name );
-                       $this->assertInternalType( 'object', $service );
-               }
-       }
-
-       public function testDefaultServiceWiringServicesHaveTests() {
-               global $IP;
-               $testedServices = array_keys( $this->provideGetService() );
-               $allServices = array_keys( require "$IP/includes/ServiceWiring.php" );
-               $this->assertEquals(
-                       [],
-                       array_diff( $allServices, $testedServices ),
-                       'The following services have not been added to MediaWikiServicesTest::provideGetService'
-               );
-       }
-
-       public function testGettersAreSorted() {
-               $methods = ( new ReflectionClass( MediaWikiServices::class ) )
-                       ->getMethods( ReflectionMethod::IS_STATIC | ReflectionMethod::IS_PUBLIC );
-
-               $names = array_map( function ( $method ) {
-                       return $method->getName();
-               }, $methods );
-               $serviceNames = array_map( function ( $name ) {
-                       return "get$name";
-               }, array_keys( $this->provideGetService() ) );
-               $names = array_values( array_filter( $names, function ( $name ) use ( $serviceNames ) {
-                       return in_array( $name, $serviceNames );
-               } ) );
-
-               $sortedNames = $names;
-               natcasesort( $sortedNames );
-
-               $this->assertSame( $sortedNames, $names,
-                       'Please keep service getters sorted alphabetically' );
-       }
-}
diff --git a/tests/phpunit/includes/MediaWikiVersionFetcherTest.php b/tests/phpunit/includes/MediaWikiVersionFetcherTest.php
deleted file mode 100644 (file)
index 9803081..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-
-/**
- * Note: this is not a unit test, as it touches the file system and reads an actual file.
- * If unit tests are added for MediaWikiVersionFetcher, this should be done in a distinct test case.
- *
- * @covers MediaWikiVersionFetcher
- *
- * @group ComposerHooks
- *
- * @author Jeroen De Dauw < jeroendedauw@gmail.com >
- */
-class MediaWikiVersionFetcherTest extends MediaWikiTestCase {
-
-       public function testReturnsResult() {
-               global $wgVersion;
-               $versionFetcher = new MediaWikiVersionFetcher();
-               $this->assertSame( $wgVersion, $versionFetcher->fetchVersion() );
-       }
-
-}
diff --git a/tests/phpunit/includes/PathRouterTest.php b/tests/phpunit/includes/PathRouterTest.php
deleted file mode 100644 (file)
index d891675..0000000
+++ /dev/null
@@ -1,325 +0,0 @@
-<?php
-
-/**
- * Tests for the PathRouter parsing.
- *
- * @covers PathRouter
- */
-class PathRouterTest extends MediaWikiTestCase {
-
-       /**
-        * @var PathRouter
-        */
-       protected $basicRouter;
-
-       protected function setUp() {
-               parent::setUp();
-               $router = new PathRouter;
-               $router->add( "/wiki/$1" );
-               $this->basicRouter = $router;
-       }
-
-       public static function provideParse() {
-               $tests = [
-                       // Basic path parsing
-                       'Basic path parsing' => [
-                               "/wiki/$1",
-                               "/wiki/Foo",
-                               [ 'title' => "Foo" ]
-                       ],
-                       //
-                       'Loose path auto-$1: /$1' => [
-                               "/",
-                               "/Foo",
-                               [ 'title' => "Foo" ]
-                       ],
-                       'Loose path auto-$1: /wiki' => [
-                               "/wiki",
-                               "/wiki/Foo",
-                               [ 'title' => "Foo" ]
-                       ],
-                       'Loose path auto-$1: /wiki/' => [
-                               "/wiki/",
-                               "/wiki/Foo",
-                               [ 'title' => "Foo" ]
-                       ],
-                       // Ensure that path is based on specificity, not order
-                       'Order, /$1 added first' => [
-                               [ "/$1", "/a/$1", "/b/$1" ],
-                               "/a/Foo",
-                               [ 'title' => "Foo" ]
-                       ],
-                       'Order, /$1 added last' => [
-                               [ "/b/$1", "/a/$1", "/$1" ],
-                               "/a/Foo",
-                               [ 'title' => "Foo" ]
-                       ],
-                       // Handling of key based arrays with a url parameter
-                       'Key based array' => [
-                               [ [
-                                       'path' => [ 'edit' => "/edit/$1" ],
-                                       'params' => [ 'action' => '$key' ],
-                               ] ],
-                               "/edit/Foo",
-                               [ 'title' => "Foo", 'action' => 'edit' ]
-                       ],
-                       // Additional parameter
-                       'Basic $2' => [
-                               [ [
-                                       'path' => '/$2/$1',
-                                       'params' => [ 'test' => '$2' ]
-                               ] ],
-                               "/asdf/Foo",
-                               [ 'title' => "Foo", 'test' => 'asdf' ]
-                       ],
-               ];
-               // Shared patterns for restricted value parameter tests
-               $restrictedPatterns = [
-                       [
-                               'path' => '/$2/$1',
-                               'params' => [ 'test' => '$2' ],
-                               'options' => [ '$2' => [ 'a', 'b' ] ]
-                       ],
-                       [
-                               'path' => '/$2/$1',
-                               'params' => [ 'test2' => '$2' ],
-                               'options' => [ '$2' => 'c' ]
-                       ],
-                       '/$1'
-               ];
-               $tests += [
-                       // Restricted value parameter tests
-                       'Restricted 1' => [
-                               $restrictedPatterns,
-                               "/asdf/Foo",
-                               [ 'title' => "asdf/Foo" ]
-                       ],
-                       'Restricted 2' => [
-                               $restrictedPatterns,
-                               "/a/Foo",
-                               [ 'title' => "Foo", 'test' => 'a' ]
-                       ],
-                       'Restricted 3' => [
-                               $restrictedPatterns,
-                               "/c/Foo",
-                               [ 'title' => "Foo", 'test2' => 'c' ]
-                       ],
-
-                       // Callback test
-                       'Callback' => [
-                               [ [
-                                       'path' => "/$1",
-                                       'params' => [ 'a' => 'b', 'data:foo' => 'bar' ],
-                                       'options' => [ 'callback' => [ __CLASS__, 'callbackForTest' ] ]
-                               ] ],
-                               '/Foo',
-                               [
-                                       'title' => "Foo",
-                                       'x' => 'Foo',
-                                       'a' => 'b',
-                                       'foo' => 'bar'
-                               ]
-                       ],
-
-                       // Test to ensure that matches are not made if a parameter expects nonexistent input
-                       'Fail' => [
-                               [ [
-                                       'path' => "/wiki/$1",
-                                       'params' => [ 'title' => "$1$2" ],
-                               ] ],
-                               "/wiki/A",
-                               []
-                       ],
-
-                       // Make sure the router handles titles like Special:Recentchanges correctly
-                       'Special title' => [
-                               "/wiki/$1",
-                               "/wiki/Special:Recentchanges",
-                               [ 'title' => "Special:Recentchanges" ]
-                       ],
-
-                       // Make sure the router decodes urlencoding properly
-                       'URL encoding' => [
-                               "/wiki/$1",
-                               "/wiki/Title_With%20Space",
-                               [ 'title' => "Title_With Space" ]
-                       ],
-
-                       // Double slash and dot expansion
-                       'Double slash in prefix' => [
-                               '/wiki/$1',
-                               '//wiki/Foo',
-                               [ 'title' => 'Foo' ]
-                       ],
-                       'Double slash at start of $1' => [
-                               '/wiki/$1',
-                               '/wiki//Foo',
-                               [ 'title' => '/Foo' ]
-                       ],
-                       'Double slash in middle of $1' => [
-                               '/wiki/$1',
-                               '/wiki/.hack//SIGN',
-                               [ 'title' => '.hack//SIGN' ]
-                       ],
-                       'Dots removed 1' => [
-                               '/wiki/$1',
-                               '/x/../wiki/Foo',
-                               [ 'title' => 'Foo' ]
-                       ],
-                       'Dots removed 2' => [
-                               '/wiki/$1',
-                               '/./wiki/Foo',
-                               [ 'title' => 'Foo' ]
-                       ],
-                       'Dots retained 1' => [
-                               '/wiki/$1',
-                               '/wiki/../wiki/Foo',
-                               [ 'title' => '../wiki/Foo' ]
-                       ],
-                       'Dots retained 2' => [
-                               '/wiki/$1',
-                               '/wiki/./Foo',
-                               [ 'title' => './Foo' ]
-                       ],
-                       'Triple slash' => [
-                               '/wiki/$1',
-                               '///wiki/Foo',
-                               [ 'title' => 'Foo' ]
-                       ],
-                       // '..' only traverses one slash, see e.g. RFC 3986
-                       'Dots traversing double slash 1' => [
-                               '/wiki/$1',
-                               '/a//b/../../wiki/Foo',
-                               []
-                       ],
-                       'Dots traversing double slash 2' => [
-                               '/wiki/$1',
-                               '/a//b/../../../wiki/Foo',
-                               [ 'title' => 'Foo' ]
-                       ],
-               ];
-
-               // Make sure the router doesn't break on special characters like $ used in regexp replacements
-               foreach ( [ "$", "$1", "\\", "\\$1" ] as $char ) {
-                       $tests["Regexp character $char"] = [
-                               "/wiki/$1",
-                               "/wiki/$char",
-                               [ 'title' => "$char" ]
-                       ];
-               }
-
-               $tests += [
-                       // Make sure the router handles characters like +&() properly
-                       "Special characters" => [
-                               "/wiki/$1",
-                               "/wiki/Plus+And&Dollar\\Stuff();[]{}*",
-                               [ 'title' => "Plus+And&Dollar\\Stuff();[]{}*" ],
-                       ],
-
-                       // Make sure the router handles unicode characters correctly
-                       "Unicode 1" => [
-                               "/wiki/$1",
-                               "/wiki/Spécial:Modifications_récentes" ,
-                               [ 'title' => "Spécial:Modifications_récentes" ],
-                       ],
-
-                       "Unicode 2" => [
-                               "/wiki/$1",
-                               "/wiki/Sp%C3%A9cial:Modifications_r%C3%A9centes",
-                               [ 'title' => "Spécial:Modifications_récentes" ],
-                       ]
-               ];
-
-               // Ensure the router doesn't choke on long paths.
-               $lorem = "Lorem_ipsum_dolor_sit_amet,_consectetur_adipisicing_elit,_sed_do_eiusmod_" .
-                       "tempor_incididunt_ut_labore_et_dolore_magna_aliqua._Ut_enim_ad_minim_veniam,_quis_" .
-                        "nostrud_exercitation_ullamco_laboris_nisi_ut_aliquip_ex_ea_commodo_consequat._" .
-                        "Duis_aute_irure_dolor_in_reprehenderit_in_voluptate_velit_esse_cillum_dolore_" .
-                        "eu_fugiat_nulla_pariatur._Excepteur_sint_occaecat_cupidatat_non_proident,_sunt_" .
-                        "in_culpa_qui_officia_deserunt_mollit_anim_id_est_laborum.";
-
-               $tests += [
-                       "Long path" => [
-                               "/wiki/$1",
-                               "/wiki/$lorem",
-                               [ 'title' => $lorem ]
-                       ],
-
-                       // Ensure that the php passed site of parameter values are not urldecoded
-                       "Pattern urlencoding" => [
-                               [ [ 'path' => "/wiki/$1", 'params' => [ 'title' => '%20:$1' ] ] ],
-                               "/wiki/Foo",
-                               [ 'title' => '%20:Foo' ]
-                       ],
-
-                       // Ensure that raw parameter values do not have any variable replacements or urldecoding
-                       "Raw param value" => [
-                               [ [ 'path' => "/wiki/$1", 'params' => [ 'title' => [ 'value' => 'bar%20$1' ] ] ] ],
-                               "/wiki/Foo",
-                               [ 'title' => 'bar%20$1' ]
-                       ]
-               ];
-
-               return $tests;
-       }
-
-       /**
-        * Test path parsing
-        * @dataProvider provideParse
-        */
-       public function testParse( $patterns, $path, $expected ) {
-               $patterns = (array)$patterns;
-
-               $router = new PathRouter;
-               foreach ( $patterns as $pattern ) {
-                       if ( is_array( $pattern ) ) {
-                               $router->add( $pattern['path'], $pattern['params'] ?? [],
-                                       $pattern['options'] ?? [] );
-                       } else {
-                               $router->add( $pattern );
-                       }
-               }
-               $matches = $router->parse( $path );
-               $this->assertEquals( $matches, $expected );
-       }
-
-       public static function callbackForTest( &$matches, $data ) {
-               $matches['x'] = $data['$1'];
-               $matches['foo'] = $data['foo'];
-       }
-
-       public static function provideWeight() {
-               return [
-                       [ '/Foo', [ 'title' => 'Foo' ] ],
-                       [ '/Bar', [ 'ping' => 'pong' ] ],
-                       [ '/Baz', [ 'marco' => 'polo' ] ],
-                       [ '/asdf-foo', [ 'title' => 'qwerty-foo' ] ],
-                       [ '/qwerty-bar', [ 'title' => 'asdf-bar' ] ],
-                       [ '/a/Foo', [ 'title' => 'Foo' ] ],
-                       [ '/asdf/Foo', [ 'title' => 'Foo' ] ],
-                       [ '/qwerty/Foo', [ 'title' => 'Foo', 'qwerty' => 'qwerty' ] ],
-                       [ '/baz/Foo', [ 'title' => 'Foo', 'unrestricted' => 'baz' ] ],
-                       [ '/y/Foo', [ 'title' => 'Foo', 'restricted-to-y' => 'y' ] ],
-               ];
-       }
-
-       /**
-        * Test to ensure weight of paths is handled correctly
-        * @dataProvider provideWeight
-        */
-       public function testWeight( $path, $expected ) {
-               $router = new PathRouter;
-               $router->addStrict( "/Bar", [ 'ping' => 'pong' ] );
-               $router->add( "/asdf-$1", [ 'title' => 'qwerty-$1' ] );
-               $router->add( "/$1" );
-               $router->add( "/qwerty-$1", [ 'title' => 'asdf-$1' ] );
-               $router->addStrict( "/Baz", [ 'marco' => 'polo' ] );
-               $router->add( "/a/$1" );
-               $router->add( "/asdf/$1" );
-               $router->add( "/$2/$1", [ 'unrestricted' => '$2' ] );
-               $router->add( [ 'qwerty' => "/qwerty/$1" ], [ 'qwerty' => '$key' ] );
-               $router->add( "/$2/$1", [ 'restricted-to-y' => '$2' ], [ '$2' => 'y' ] );
-
-               $this->assertEquals( $router->parse( $path ), $expected );
-       }
-}
diff --git a/tests/phpunit/includes/Revision/FallbackSlotRoleHandlerTest.php b/tests/phpunit/includes/Revision/FallbackSlotRoleHandlerTest.php
deleted file mode 100644 (file)
index aedf292..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-
-namespace MediaWiki\Tests\Revision;
-
-use MediaWiki\Revision\FallbackSlotRoleHandler;
-use MediaWikiTestCase;
-use Title;
-
-/**
- * @covers \MediaWiki\Revision\FallbackSlotRoleHandler
- */
-class FallbackSlotRoleHandlerTest extends MediaWikiTestCase {
-
-       private function makeBlankTitleObject() {
-               /** @var Title $title */
-               $title = $this->getMockBuilder( Title::class )
-                       ->disableOriginalConstructor()
-                       ->getMock();
-
-               return $title;
-       }
-
-       /**
-        * @covers \MediaWiki\Revision\FallbackSlotRoleHandler::__construct
-        * @covers \MediaWiki\Revision\FallbackSlotRoleHandler::getRole()
-        * @covers \MediaWiki\Revision\FallbackSlotRoleHandler::getNameMessageKey()
-        * @covers \MediaWiki\Revision\FallbackSlotRoleHandler::getDefaultModel()
-        * @covers \MediaWiki\Revision\FallbackSlotRoleHandler::getOutputLayoutHints()
-        */
-       public function testConstruction() {
-               $handler = new FallbackSlotRoleHandler( 'foo' );
-               $this->assertSame( 'foo', $handler->getRole() );
-               $this->assertSame( 'slot-name-foo', $handler->getNameMessageKey() );
-
-               $title = $this->makeBlankTitleObject();
-               $this->assertSame( CONTENT_MODEL_TEXT, $handler->getDefaultModel( $title ) );
-
-               $hints = $handler->getOutputLayoutHints();
-               $this->assertArrayHasKey( 'display', $hints );
-               $this->assertArrayHasKey( 'region', $hints );
-               $this->assertArrayHasKey( 'placement', $hints );
-       }
-
-       /**
-        * @covers \MediaWiki\Revision\FallbackSlotRoleHandler::isAllowedModel()
-        */
-       public function testIsAllowedModel() {
-               $handler = new FallbackSlotRoleHandler( 'foo', 'FooModel' );
-
-               // For the fallback handler, no models are allowed
-               $title = $this->makeBlankTitleObject();
-               $this->assertFalse( $handler->isAllowedModel( 'FooModel', $title ) );
-               $this->assertFalse( $handler->isAllowedModel( 'QuaxModel', $title ) );
-       }
-
-       /**
-        * @covers \MediaWiki\Revision\SlotRoleHandler::isAllowedModel()
-        */
-       public function testIsAllowedOn() {
-               $handler = new FallbackSlotRoleHandler( 'foo', 'FooModel' );
-
-               $title = $this->makeBlankTitleObject();
-               $this->assertFalse( $handler->isAllowedOn( $title ) );
-       }
-
-       /**
-        * @covers \MediaWiki\Revision\FallbackSlotRoleHandler::supportsArticleCount()
-        */
-       public function testSupportsArticleCount() {
-               $handler = new FallbackSlotRoleHandler( 'foo', 'FooModel' );
-
-               $this->assertFalse( $handler->supportsArticleCount() );
-       }
-
-}
diff --git a/tests/phpunit/includes/Revision/MainSlotRoleHandlerTest.php b/tests/phpunit/includes/Revision/MainSlotRoleHandlerTest.php
deleted file mode 100644 (file)
index 5e32574..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-<?php
-
-namespace MediaWiki\Tests\Revision;
-
-use MediaWiki\Revision\MainSlotRoleHandler;
-use MediaWikiTestCase;
-use PHPUnit\Framework\MockObject\MockObject;
-use Title;
-
-/**
- * @covers \MediaWiki\Revision\MainSlotRoleHandler
- */
-class MainSlotRoleHandlerTest extends MediaWikiTestCase {
-
-       private function makeTitleObject( $ns ) {
-               /** @var Title|MockObject $title */
-               $title = $this->getMockBuilder( Title::class )
-                       ->disableOriginalConstructor()
-                       ->getMock();
-
-               $title->method( 'getNamespace' )
-                       ->willReturn( $ns );
-
-               return $title;
-       }
-
-       /**
-        * @covers \MediaWiki\Revision\MainSlotRoleHandler::__construct
-        * @covers \MediaWiki\Revision\MainSlotRoleHandler::getRole()
-        * @covers \MediaWiki\Revision\MainSlotRoleHandler::getNameMessageKey()
-        * @covers \MediaWiki\Revision\MainSlotRoleHandler::getOutputLayoutHints()
-        */
-       public function testConstruction() {
-               $handler = new MainSlotRoleHandler( [] );
-               $this->assertSame( 'main', $handler->getRole() );
-               $this->assertSame( 'slot-name-main', $handler->getNameMessageKey() );
-
-               $hints = $handler->getOutputLayoutHints();
-               $this->assertArrayHasKey( 'display', $hints );
-               $this->assertArrayHasKey( 'region', $hints );
-               $this->assertArrayHasKey( 'placement', $hints );
-       }
-
-       /**
-        * @covers \MediaWiki\Revision\MainSlotRoleHandler::getDefaultModel()
-        */
-       public function testFetDefaultModel() {
-               $handler = new MainSlotRoleHandler( [ 100 => CONTENT_MODEL_TEXT ] );
-
-               // For the main handler, the namespace determins the default model
-               $titleMain = $this->makeTitleObject( NS_MAIN );
-               $this->assertSame( CONTENT_MODEL_WIKITEXT, $handler->getDefaultModel( $titleMain ) );
-
-               $title100 = $this->makeTitleObject( 100 );
-               $this->assertSame( CONTENT_MODEL_TEXT, $handler->getDefaultModel( $title100 ) );
-       }
-
-       /**
-        * @covers \MediaWiki\Revision\MainSlotRoleHandler::isAllowedModel()
-        */
-       public function testIsAllowedModel() {
-               $handler = new MainSlotRoleHandler( [] );
-
-               // For the main handler, (nearly) all models are allowed
-               $title = $this->makeTitleObject( NS_MAIN );
-               $this->assertTrue( $handler->isAllowedModel( CONTENT_MODEL_WIKITEXT, $title ) );
-               $this->assertTrue( $handler->isAllowedModel( CONTENT_MODEL_TEXT, $title ) );
-       }
-
-       /**
-        * @covers \MediaWiki\Revision\MainSlotRoleHandler::supportsArticleCount()
-        */
-       public function testSupportsArticleCount() {
-               $handler = new MainSlotRoleHandler( [] );
-
-               $this->assertTrue( $handler->supportsArticleCount() );
-       }
-
-}
diff --git a/tests/phpunit/includes/Revision/RevisionStoreFactoryTest.php b/tests/phpunit/includes/Revision/RevisionStoreFactoryTest.php
deleted file mode 100644 (file)
index 138d6bc..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-<?php
-
-namespace MediaWiki\Tests\Revision;
-
-use ActorMigration;
-use CommentStore;
-use MediaWiki\Logger\Spi as LoggerSpi;
-use MediaWiki\Revision\RevisionStore;
-use MediaWiki\Revision\RevisionStoreFactory;
-use MediaWiki\Revision\SlotRoleRegistry;
-use MediaWiki\Storage\BlobStore;
-use MediaWiki\Storage\BlobStoreFactory;
-use MediaWiki\Storage\NameTableStore;
-use MediaWiki\Storage\NameTableStoreFactory;
-use MediaWiki\Storage\SqlBlobStore;
-use MediaWikiTestCase;
-use Psr\Log\LoggerInterface;
-use Psr\Log\NullLogger;
-use WANObjectCache;
-use Wikimedia\Rdbms\ILBFactory;
-use Wikimedia\Rdbms\ILoadBalancer;
-use Wikimedia\TestingAccessWrapper;
-
-class RevisionStoreFactoryTest extends MediaWikiTestCase {
-
-       /**
-        * @covers \MediaWiki\Revision\RevisionStoreFactory::__construct
-        */
-       public function testValidConstruction_doesntCauseErrors() {
-               new RevisionStoreFactory(
-                       $this->getMockLoadBalancerFactory(),
-                       $this->getMockBlobStoreFactory(),
-                       $this->getNameTableStoreFactory(),
-                       $this->getMockSlotRoleRegistry(),
-                       $this->getHashWANObjectCache(),
-                       $this->getMockCommentStore(),
-                       ActorMigration::newMigration(),
-                       MIGRATION_OLD,
-                       $this->getMockLoggerSpi(),
-                       true
-               );
-               $this->assertTrue( true );
-       }
-
-       public function provideWikiIds() {
-               yield [ true ];
-               yield [ false ];
-               yield [ 'somewiki' ];
-               yield [ 'somewiki', MIGRATION_OLD , false ];
-               yield [ 'somewiki', MIGRATION_NEW , true ];
-       }
-
-       /**
-        * @dataProvider provideWikiIds
-        * @covers \MediaWiki\Revision\RevisionStoreFactory::getRevisionStore
-        */
-       public function testGetRevisionStore(
-               $wikiId,
-               $mcrMigrationStage = MIGRATION_OLD,
-               $contentHandlerUseDb = true
-       ) {
-               $lbFactory = $this->getMockLoadBalancerFactory();
-               $blobStoreFactory = $this->getMockBlobStoreFactory();
-               $nameTableStoreFactory = $this->getNameTableStoreFactory();
-               $slotRoleRegistry = $this->getMockSlotRoleRegistry();
-               $cache = $this->getHashWANObjectCache();
-               $commentStore = $this->getMockCommentStore();
-               $actorMigration = ActorMigration::newMigration();
-               $loggerProvider = $this->getMockLoggerSpi();
-
-               $factory = new RevisionStoreFactory(
-                       $lbFactory,
-                       $blobStoreFactory,
-                       $nameTableStoreFactory,
-                       $slotRoleRegistry,
-                       $cache,
-                       $commentStore,
-                       $actorMigration,
-                       $mcrMigrationStage,
-                       $loggerProvider,
-                       $contentHandlerUseDb
-               );
-
-               $store = $factory->getRevisionStore( $wikiId );
-               $wrapper = TestingAccessWrapper::newFromObject( $store );
-
-               // ensure the correct object type is returned
-               $this->assertInstanceOf( RevisionStore::class, $store );
-
-               // ensure the RevisionStore is for the given wikiId
-               $this->assertSame( $wikiId, $wrapper->wikiId );
-
-               // ensure all other required services are correctly set
-               $this->assertSame( $cache, $wrapper->cache );
-               $this->assertSame( $commentStore, $wrapper->commentStore );
-               $this->assertSame( $mcrMigrationStage, $wrapper->mcrMigrationStage );
-               $this->assertSame( $actorMigration, $wrapper->actorMigration );
-               $this->assertSame( $contentHandlerUseDb, $store->getContentHandlerUseDB() );
-
-               $this->assertInstanceOf( ILoadBalancer::class, $wrapper->loadBalancer );
-               $this->assertInstanceOf( BlobStore::class, $wrapper->blobStore );
-               $this->assertInstanceOf( NameTableStore::class, $wrapper->contentModelStore );
-               $this->assertInstanceOf( NameTableStore::class, $wrapper->slotRoleStore );
-               $this->assertInstanceOf( LoggerInterface::class, $wrapper->logger );
-       }
-
-       /**
-        * @return \PHPUnit_Framework_MockObject_MockObject|ILoadBalancer
-        */
-       private function getMockLoadBalancer() {
-               return $this->getMockBuilder( ILoadBalancer::class )
-                       ->disableOriginalConstructor()->getMock();
-       }
-
-       /**
-        * @return \PHPUnit_Framework_MockObject_MockObject|ILBFactory
-        */
-       private function getMockLoadBalancerFactory() {
-               $mock = $this->getMockBuilder( ILBFactory::class )
-                       ->disableOriginalConstructor()->getMock();
-
-               $mock->method( 'getMainLB' )
-                       ->willReturnCallback( function () {
-                               return $this->getMockLoadBalancer();
-                       } );
-
-               return $mock;
-       }
-
-       /**
-        * @return \PHPUnit_Framework_MockObject_MockObject|SqlBlobStore
-        */
-       private function getMockSqlBlobStore() {
-               return $this->getMockBuilder( SqlBlobStore::class )
-                       ->disableOriginalConstructor()->getMock();
-       }
-
-       /**
-        * @return \PHPUnit_Framework_MockObject_MockObject|BlobStoreFactory
-        */
-       private function getMockBlobStoreFactory() {
-               $mock = $this->getMockBuilder( BlobStoreFactory::class )
-                       ->disableOriginalConstructor()->getMock();
-
-               $mock->method( 'newSqlBlobStore' )
-                       ->willReturnCallback( function () {
-                               return $this->getMockSqlBlobStore();
-                       } );
-
-               return $mock;
-       }
-
-       /**
-        * @return \PHPUnit_Framework_MockObject_MockObject|SlotRoleRegistry
-        */
-       private function getMockSlotRoleRegistry() {
-               $mock = $this->getMockBuilder( SlotRoleRegistry::class )
-                       ->disableOriginalConstructor()->getMock();
-
-               return $mock;
-       }
-
-       /**
-        * @return NameTableStoreFactory
-        */
-       private function getNameTableStoreFactory() {
-               return new NameTableStoreFactory(
-                       $this->getMockLoadBalancerFactory(),
-                       $this->getHashWANObjectCache(),
-                       new NullLogger() );
-       }
-
-       /**
-        * @return \PHPUnit_Framework_MockObject_MockObject|CommentStore
-        */
-       private function getMockCommentStore() {
-               return $this->getMockBuilder( CommentStore::class )
-                       ->disableOriginalConstructor()->getMock();
-       }
-
-       private function getHashWANObjectCache() {
-               return new WANObjectCache( [ 'cache' => new \HashBagOStuff() ] );
-       }
-
-       /**
-        * @return \PHPUnit_Framework_MockObject_MockObject|LoggerSpi
-        */
-       private function getMockLoggerSpi() {
-               $mock = $this->getMock( LoggerSpi::class );
-
-               $mock->method( 'getLogger' )
-                       ->willReturn( new NullLogger() );
-
-               return $mock;
-       }
-
-}
diff --git a/tests/phpunit/includes/Revision/SlotRecordTest.php b/tests/phpunit/includes/Revision/SlotRecordTest.php
deleted file mode 100644 (file)
index 1b6ff2a..0000000
+++ /dev/null
@@ -1,408 +0,0 @@
-<?php
-
-namespace MediaWiki\Tests\Revision;
-
-use InvalidArgumentException;
-use LogicException;
-use MediaWiki\Revision\IncompleteRevisionException;
-use MediaWiki\Revision\SlotRecord;
-use MediaWiki\Revision\SuppressedDataException;
-use MediaWikiTestCase;
-use WikitextContent;
-
-/**
- * @covers \MediaWiki\Revision\SlotRecord
- */
-class SlotRecordTest extends MediaWikiTestCase {
-
-       private function makeRow( $data = [] ) {
-               $data = $data + [
-                       'slot_id' => 1234,
-                       'slot_content_id' => 33,
-                       'content_size' => '5',
-                       'content_sha1' => 'someHash',
-                       'content_address' => 'tt:456',
-                       'model_name' => CONTENT_MODEL_WIKITEXT,
-                       'format_name' => CONTENT_FORMAT_WIKITEXT,
-                       'slot_revision_id' => '2',
-                       'slot_origin' => '1',
-                       'role_name' => 'myRole',
-               ];
-               return (object)$data;
-       }
-
-       public function testCompleteConstruction() {
-               $row = $this->makeRow();
-               $record = new SlotRecord( $row, new WikitextContent( 'A' ) );
-
-               $this->assertTrue( $record->hasAddress() );
-               $this->assertTrue( $record->hasContentId() );
-               $this->assertTrue( $record->hasRevision() );
-               $this->assertTrue( $record->isInherited() );
-               $this->assertSame( 'A', $record->getContent()->getText() );
-               $this->assertSame( 5, $record->getSize() );
-               $this->assertSame( 'someHash', $record->getSha1() );
-               $this->assertSame( CONTENT_MODEL_WIKITEXT, $record->getModel() );
-               $this->assertSame( 2, $record->getRevision() );
-               $this->assertSame( 1, $record->getOrigin() );
-               $this->assertSame( 'tt:456', $record->getAddress() );
-               $this->assertSame( 33, $record->getContentId() );
-               $this->assertSame( CONTENT_FORMAT_WIKITEXT, $record->getFormat() );
-               $this->assertSame( 'myRole', $record->getRole() );
-       }
-
-       public function testConstructionDeferred() {
-               $row = $this->makeRow( [
-                       'content_size' => null, // to be computed
-                       'content_sha1' => null, // to be computed
-                       'format_name' => function () {
-                               return CONTENT_FORMAT_WIKITEXT;
-                       },
-                       'slot_revision_id' => '2',
-                       'slot_origin' => '2',
-                       'slot_content_id' => function () {
-                               return null;
-                       },
-               ] );
-
-               $content = function () {
-                       return new WikitextContent( 'A' );
-               };
-
-               $record = new SlotRecord( $row, $content );
-
-               $this->assertTrue( $record->hasAddress() );
-               $this->assertTrue( $record->hasRevision() );
-               $this->assertFalse( $record->hasContentId() );
-               $this->assertFalse( $record->isInherited() );
-               $this->assertSame( 'A', $record->getContent()->getText() );
-               $this->assertSame( 1, $record->getSize() );
-               $this->assertNotNull( $record->getSha1() );
-               $this->assertSame( CONTENT_MODEL_WIKITEXT, $record->getModel() );
-               $this->assertSame( 2, $record->getRevision() );
-               $this->assertSame( 2, $record->getRevision() );
-               $this->assertSame( 'tt:456', $record->getAddress() );
-               $this->assertSame( CONTENT_FORMAT_WIKITEXT, $record->getFormat() );
-               $this->assertSame( 'myRole', $record->getRole() );
-       }
-
-       public function testNewUnsaved() {
-               $record = SlotRecord::newUnsaved( 'myRole', new WikitextContent( 'A' ) );
-
-               $this->assertFalse( $record->hasAddress() );
-               $this->assertFalse( $record->hasContentId() );
-               $this->assertFalse( $record->hasRevision() );
-               $this->assertFalse( $record->isInherited() );
-               $this->assertFalse( $record->hasOrigin() );
-               $this->assertSame( 'A', $record->getContent()->getText() );
-               $this->assertSame( 1, $record->getSize() );
-               $this->assertNotNull( $record->getSha1() );
-               $this->assertSame( CONTENT_MODEL_WIKITEXT, $record->getModel() );
-               $this->assertSame( 'myRole', $record->getRole() );
-       }
-
-       public function provideInvalidConstruction() {
-               yield 'both null' => [ null, null ];
-               yield 'null row' => [ null, new WikitextContent( 'A' ) ];
-               yield 'array row' => [ [], new WikitextContent( 'A' ) ];
-               yield 'empty row' => [ (object)[], new WikitextContent( 'A' ) ];
-               yield 'null content' => [ (object)[], null ];
-       }
-
-       /**
-        * @dataProvider provideInvalidConstruction
-        */
-       public function testInvalidConstruction( $row, $content ) {
-               $this->setExpectedException( InvalidArgumentException::class );
-               new SlotRecord( $row, $content );
-       }
-
-       public function testGetContentId_fails() {
-               $record = SlotRecord::newUnsaved( SlotRecord::MAIN, new WikitextContent( 'A' ) );
-               $this->setExpectedException( IncompleteRevisionException::class );
-
-               $record->getContentId();
-       }
-
-       public function testGetAddress_fails() {
-               $record = SlotRecord::newUnsaved( SlotRecord::MAIN, new WikitextContent( 'A' ) );
-               $this->setExpectedException( IncompleteRevisionException::class );
-
-               $record->getAddress();
-       }
-
-       public function provideIncomplete() {
-               $unsaved = SlotRecord::newUnsaved( SlotRecord::MAIN, new WikitextContent( 'A' ) );
-               yield 'unsaved' => [ $unsaved ];
-
-               $parent = new SlotRecord( $this->makeRow(), new WikitextContent( 'A' ) );
-               $inherited = SlotRecord::newInherited( $parent );
-               yield 'inherited' => [ $inherited ];
-       }
-
-       /**
-        * @dataProvider provideIncomplete
-        */
-       public function testGetRevision_fails( SlotRecord $record ) {
-               $record = SlotRecord::newUnsaved( SlotRecord::MAIN, new WikitextContent( 'A' ) );
-               $this->setExpectedException( IncompleteRevisionException::class );
-
-               $record->getRevision();
-       }
-
-       /**
-        * @dataProvider provideIncomplete
-        */
-       public function testGetOrigin_fails( SlotRecord $record ) {
-               $record = SlotRecord::newUnsaved( SlotRecord::MAIN, new WikitextContent( 'A' ) );
-               $this->setExpectedException( IncompleteRevisionException::class );
-
-               $record->getOrigin();
-       }
-
-       public function provideHashStability() {
-               yield [ '', 'phoiac9h4m842xq45sp7s6u21eteeq1' ];
-               yield [ 'Lorem ipsum', 'hcr5u40uxr81d3nx89nvwzclfz6r9c5' ];
-       }
-
-       /**
-        * @dataProvider provideHashStability
-        */
-       public function testHashStability( $text, $hash ) {
-               // Changing the output of the hash function will break things horribly!
-
-               $this->assertSame( $hash, SlotRecord::base36Sha1( $text ) );
-
-               $record = SlotRecord::newUnsaved( SlotRecord::MAIN, new WikitextContent( $text ) );
-               $this->assertSame( $hash, $record->getSha1() );
-       }
-
-       public function testNewWithSuppressedContent() {
-               $input = new SlotRecord( $this->makeRow(), new WikitextContent( 'A' ) );
-               $output = SlotRecord::newWithSuppressedContent( $input );
-
-               $this->setExpectedException( SuppressedDataException::class );
-               $output->getContent();
-       }
-
-       public function testNewInherited() {
-               $row = $this->makeRow( [ 'slot_revision_id' => 7, 'slot_origin' => 7 ] );
-               $parent = new SlotRecord( $row, new WikitextContent( 'A' ) );
-
-               // This would happen while doing an edit, before saving revision meta-data.
-               $inherited = SlotRecord::newInherited( $parent );
-
-               $this->assertSame( $parent->getContentId(), $inherited->getContentId() );
-               $this->assertSame( $parent->getAddress(), $inherited->getAddress() );
-               $this->assertSame( $parent->getContent(), $inherited->getContent() );
-               $this->assertTrue( $inherited->isInherited() );
-               $this->assertTrue( $inherited->hasOrigin() );
-               $this->assertFalse( $inherited->hasRevision() );
-
-               // make sure we didn't mess with the internal state of $parent
-               $this->assertFalse( $parent->isInherited() );
-               $this->assertSame( 7, $parent->getRevision() );
-
-               // This would happen while doing an edit, after saving the revision meta-data
-               // and content meta-data.
-               $saved = SlotRecord::newSaved(
-                       10,
-                       $inherited->getContentId(),
-                       $inherited->getAddress(),
-                       $inherited
-               );
-               $this->assertSame( $parent->getContentId(), $saved->getContentId() );
-               $this->assertSame( $parent->getAddress(), $saved->getAddress() );
-               $this->assertSame( $parent->getContent(), $saved->getContent() );
-               $this->assertTrue( $saved->isInherited() );
-               $this->assertTrue( $saved->hasRevision() );
-               $this->assertSame( 10, $saved->getRevision() );
-
-               // make sure we didn't mess with the internal state of $parent or $inherited
-               $this->assertSame( 7, $parent->getRevision() );
-               $this->assertFalse( $inherited->hasRevision() );
-       }
-
-       public function testNewSaved() {
-               // This would happen while doing an edit, before saving revision meta-data.
-               $unsaved = SlotRecord::newUnsaved( SlotRecord::MAIN, new WikitextContent( 'A' ) );
-
-               // This would happen while doing an edit, after saving the revision meta-data
-               // and content meta-data.
-               $saved = SlotRecord::newSaved( 10, 20, 'theNewAddress', $unsaved );
-               $this->assertFalse( $saved->isInherited() );
-               $this->assertTrue( $saved->hasOrigin() );
-               $this->assertTrue( $saved->hasRevision() );
-               $this->assertTrue( $saved->hasAddress() );
-               $this->assertTrue( $saved->hasContentId() );
-               $this->assertSame( 'theNewAddress', $saved->getAddress() );
-               $this->assertSame( 20, $saved->getContentId() );
-               $this->assertSame( 'A', $saved->getContent()->getText() );
-               $this->assertSame( 10, $saved->getRevision() );
-               $this->assertSame( 10, $saved->getOrigin() );
-
-               // make sure we didn't mess with the internal state of $unsaved
-               $this->assertFalse( $unsaved->hasAddress() );
-               $this->assertFalse( $unsaved->hasContentId() );
-               $this->assertFalse( $unsaved->hasRevision() );
-       }
-
-       public function provideNewSaved_LogicException() {
-               $freshRow = $this->makeRow( [
-                       'content_id' => 10,
-                       'content_address' => 'address:1',
-                       'slot_origin' => 1,
-                       'slot_revision_id' => 1,
-               ] );
-
-               $freshSlot = new SlotRecord( $freshRow, new WikitextContent( 'A' ) );
-               yield 'mismatching address' => [ 1, 10, 'address:BAD', $freshSlot ];
-               yield 'mismatching revision' => [ 5, 10, 'address:1', $freshSlot ];
-               yield 'mismatching content ID' => [ 1, 17, 'address:1', $freshSlot ];
-
-               $inheritedRow = $this->makeRow( [
-                       'content_id' => null,
-                       'content_address' => null,
-                       'slot_origin' => 0,
-                       'slot_revision_id' => 1,
-               ] );
-
-               $inheritedSlot = new SlotRecord( $inheritedRow, new WikitextContent( 'A' ) );
-               yield 'inherited, but no address' => [ 1, 10, 'address:2', $inheritedSlot ];
-       }
-
-       /**
-        * @dataProvider provideNewSaved_LogicException
-        */
-       public function testNewSaved_LogicException(
-               $revisionId,
-               $contentId,
-               $contentAddress,
-               SlotRecord $protoSlot
-       ) {
-               $this->setExpectedException( LogicException::class );
-               SlotRecord::newSaved( $revisionId, $contentId, $contentAddress, $protoSlot );
-       }
-
-       public function provideNewSaved_InvalidArgumentException() {
-               $unsaved = SlotRecord::newUnsaved( SlotRecord::MAIN, new WikitextContent( 'A' ) );
-
-               yield 'bad revision id' => [ 'xyzzy', 5, 'address', $unsaved ];
-               yield 'bad content id' => [ 7, 'xyzzy', 'address', $unsaved ];
-               yield 'bad content address' => [ 7, 5, 77, $unsaved ];
-       }
-
-       /**
-        * @dataProvider provideNewSaved_InvalidArgumentException
-        */
-       public function testNewSaved_InvalidArgumentException(
-               $revisionId,
-               $contentId,
-               $contentAddress,
-               SlotRecord $protoSlot
-       ) {
-               $this->setExpectedException( InvalidArgumentException::class );
-               SlotRecord::newSaved( $revisionId, $contentId, $contentAddress, $protoSlot );
-       }
-
-       public function provideHasSameContent() {
-               $fail = function () {
-                       self::fail( 'There should be no need to actually load the content.' );
-               };
-
-               $a100a1 = new SlotRecord(
-                       $this->makeRow(
-                               [
-                                       'model_name' => 'A',
-                                       'content_size' => 100,
-                                       'content_sha1' => 'hash-a',
-                                       'content_address' => 'xxx:a1',
-                               ]
-                       ),
-                       $fail
-               );
-               $a100a1b = new SlotRecord(
-                       $this->makeRow(
-                               [
-                                       'model_name' => 'A',
-                                       'content_size' => 100,
-                                       'content_sha1' => 'hash-a',
-                                       'content_address' => 'xxx:a1',
-                               ]
-                       ),
-                       $fail
-               );
-               $a100null = new SlotRecord(
-                       $this->makeRow(
-                               [
-                                       'model_name' => 'A',
-                                       'content_size' => 100,
-                                       'content_sha1' => 'hash-a',
-                                       'content_address' => null,
-                               ]
-                       ),
-                       $fail
-               );
-               $a100a2 = new SlotRecord(
-                       $this->makeRow(
-                               [
-                                       'model_name' => 'A',
-                                       'content_size' => 100,
-                                       'content_sha1' => 'hash-a',
-                                       'content_address' => 'xxx:a2',
-                               ]
-                       ),
-                       $fail
-               );
-               $b100a1 = new SlotRecord(
-                       $this->makeRow(
-                               [
-                                       'model_name' => 'B',
-                                       'content_size' => 100,
-                                       'content_sha1' => 'hash-a',
-                                       'content_address' => 'xxx:a1',
-                               ]
-                       ),
-                       $fail
-               );
-               $a200a1 = new SlotRecord(
-                       $this->makeRow(
-                               [
-                                       'model_name' => 'A',
-                                       'content_size' => 200,
-                                       'content_sha1' => 'hash-a',
-                                       'content_address' => 'xxx:a2',
-                               ]
-                       ),
-                       $fail
-               );
-               $a100x1 = new SlotRecord(
-                       $this->makeRow(
-                               [
-                                       'model_name' => 'A',
-                                       'content_size' => 100,
-                                       'content_sha1' => 'hash-x',
-                                       'content_address' => 'xxx:x1',
-                               ]
-                       ),
-                       $fail
-               );
-
-               yield 'same instance' => [ $a100a1, $a100a1, true ];
-               yield 'no address' => [ $a100a1, $a100null, true ];
-               yield 'same address' => [ $a100a1, $a100a1b, true ];
-               yield 'different address' => [ $a100a1, $a100a2, true ];
-               yield 'different model' => [ $a100a1, $b100a1, false ];
-               yield 'different size' => [ $a100a1, $a200a1, false ];
-               yield 'different hash' => [ $a100a1, $a100x1, false ];
-       }
-
-       /**
-        * @dataProvider provideHasSameContent
-        */
-       public function testHasSameContent( SlotRecord $a, SlotRecord $b, $sameContent ) {
-               $this->assertSame( $sameContent, $a->hasSameContent( $b ) );
-               $this->assertSame( $sameContent, $b->hasSameContent( $a ) );
-       }
-
-}
diff --git a/tests/phpunit/includes/Revision/SlotRoleHandlerTest.php b/tests/phpunit/includes/Revision/SlotRoleHandlerTest.php
deleted file mode 100644 (file)
index 67e9464..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-
-namespace MediaWiki\Tests\Revision;
-
-use MediaWiki\Revision\SlotRoleHandler;
-use MediaWikiTestCase;
-use Title;
-
-/**
- * @covers \MediaWiki\Revision\SlotRoleHandler
- */
-class SlotRoleHandlerTest extends MediaWikiTestCase {
-
-       private function makeBlankTitleObject() {
-               /** @var Title $title */
-               $title = $this->getMockBuilder( Title::class )
-                       ->disableOriginalConstructor()
-                       ->getMock();
-
-               return $title;
-       }
-
-       /**
-        * @covers \MediaWiki\Revision\SlotRoleHandler::__construct
-        * @covers \MediaWiki\Revision\SlotRoleHandler::getRole()
-        * @covers \MediaWiki\Revision\SlotRoleHandler::getNameMessageKey()
-        * @covers \MediaWiki\Revision\SlotRoleHandler::getDefaultModel()
-        * @covers \MediaWiki\Revision\SlotRoleHandler::getOutputLayoutHints()
-        */
-       public function testConstruction() {
-               $handler = new SlotRoleHandler( 'foo', 'FooModel', [ 'frob' => 'niz' ] );
-               $this->assertSame( 'foo', $handler->getRole() );
-               $this->assertSame( 'slot-name-foo', $handler->getNameMessageKey() );
-
-               $title = $this->makeBlankTitleObject();
-               $this->assertSame( 'FooModel', $handler->getDefaultModel( $title ) );
-
-               $hints = $handler->getOutputLayoutHints();
-               $this->assertArrayHasKey( 'frob', $hints );
-               $this->assertSame( 'niz', $hints['frob'] );
-
-               $this->assertArrayHasKey( 'display', $hints );
-               $this->assertArrayHasKey( 'region', $hints );
-               $this->assertArrayHasKey( 'placement', $hints );
-       }
-
-       /**
-        * @covers \MediaWiki\Revision\SlotRoleHandler::isAllowedModel()
-        */
-       public function testIsAllowedModel() {
-               $handler = new SlotRoleHandler( 'foo', 'FooModel' );
-
-               $title = $this->makeBlankTitleObject();
-               $this->assertTrue( $handler->isAllowedModel( 'FooModel', $title ) );
-               $this->assertFalse( $handler->isAllowedModel( 'QuaxModel', $title ) );
-       }
-
-       /**
-        * @covers \MediaWiki\Revision\SlotRoleHandler::supportsArticleCount()
-        */
-       public function testSupportsArticleCount() {
-               $handler = new SlotRoleHandler( 'foo', 'FooModel' );
-
-               $this->assertFalse( $handler->supportsArticleCount() );
-       }
-
-}
diff --git a/tests/phpunit/includes/SanitizerValidateEmailTest.php b/tests/phpunit/includes/SanitizerValidateEmailTest.php
deleted file mode 100644 (file)
index c4e4308..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-
-/**
- * @covers Sanitizer::validateEmail
- * @todo all test methods in this class should be refactored and...
- *    use a single test method and a single data provider...
- */
-class SanitizerValidateEmailTest extends PHPUnit\Framework\TestCase {
-
-       use MediaWikiCoversValidator;
-
-       private function checkEmail( $addr, $expected = true, $msg = '' ) {
-               if ( $msg == '' ) {
-                       $msg = "Testing $addr";
-               }
-
-               $this->assertEquals(
-                       $expected,
-                       Sanitizer::validateEmail( $addr ),
-                       $msg
-               );
-       }
-
-       private function valid( $addr, $msg = '' ) {
-               $this->checkEmail( $addr, true, $msg );
-       }
-
-       private function invalid( $addr, $msg = '' ) {
-               $this->checkEmail( $addr, false, $msg );
-       }
-
-       public function testEmailWellKnownUserAtHostDotTldAreValid() {
-               $this->valid( 'user@example.com' );
-               $this->valid( 'user@example.museum' );
-       }
-
-       public function testEmailWithUpperCaseCharactersAreValid() {
-               $this->valid( 'USER@example.com' );
-               $this->valid( 'user@EXAMPLE.COM' );
-               $this->valid( 'user@Example.com' );
-               $this->valid( 'USER@eXAMPLE.com' );
-       }
-
-       public function testEmailWithAPlusInUserName() {
-               $this->valid( 'user+sub@example.com' );
-               $this->valid( 'user+@example.com' );
-       }
-
-       public function testEmailDoesNotNeedATopLevelDomain() {
-               $this->valid( "user@localhost" );
-               $this->valid( "FooBar@localdomain" );
-               $this->valid( "nobody@mycompany" );
-       }
-
-       public function testEmailWithWhiteSpacesBeforeOrAfterAreInvalids() {
-               $this->invalid( " user@host.com" );
-               $this->invalid( "user@host.com " );
-               $this->invalid( "\tuser@host.com" );
-               $this->invalid( "user@host.com\t" );
-       }
-
-       public function testEmailWithWhiteSpacesAreInvalids() {
-               $this->invalid( "User user@host" );
-               $this->invalid( "first last@mycompany" );
-               $this->invalid( "firstlast@my company" );
-       }
-
-       /**
-        * T28948 : comma were matched by an incorrect regexp range
-        */
-       public function testEmailWithCommasAreInvalids() {
-               $this->invalid( "user,foo@example.org" );
-               $this->invalid( "userfoo@ex,ample.org" );
-       }
-
-       public function testEmailWithHyphens() {
-               $this->valid( "user-foo@example.org" );
-               $this->valid( "userfoo@ex-ample.org" );
-       }
-
-       public function testEmailDomainCanNotBeginWithDot() {
-               $this->invalid( "user@." );
-               $this->invalid( "user@.localdomain" );
-               $this->invalid( "user@localdomain." );
-               $this->valid( "user.@localdomain" );
-               $this->valid( ".@localdomain" );
-               $this->invalid( ".@a............" );
-       }
-
-       public function testEmailWithFunnyCharacters() {
-               $this->valid( "\$user!ex{this}@123.com" );
-       }
-
-       public function testEmailTopLevelDomainCanBeNumerical() {
-               $this->valid( "user@example.1234" );
-       }
-
-       public function testEmailWithoutAtSignIsInvalid() {
-               $this->invalid( 'useràexample.com' );
-       }
-
-       public function testEmailWithOneCharacterDomainIsValid() {
-               $this->valid( 'user@a' );
-       }
-}
diff --git a/tests/phpunit/includes/ServiceWiringTest.php b/tests/phpunit/includes/ServiceWiringTest.php
deleted file mode 100644 (file)
index 02e06f8..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-/**
- * @coversNothing
- */
-class ServiceWiringTest extends MediaWikiTestCase {
-       public function testServicesAreSorted() {
-               global $IP;
-               $services = array_keys( require "$IP/includes/ServiceWiring.php" );
-               $sortedServices = $services;
-               natcasesort( $sortedServices );
-
-               $this->assertSame( $sortedServices, $services,
-                       'Please keep services sorted alphabetically' );
-       }
-}
diff --git a/tests/phpunit/includes/SiteConfigurationTest.php b/tests/phpunit/includes/SiteConfigurationTest.php
deleted file mode 100644 (file)
index 3b72262..0000000
+++ /dev/null
@@ -1,379 +0,0 @@
-<?php
-
-class SiteConfigurationTest extends MediaWikiTestCase {
-
-       /**
-        * @var SiteConfiguration
-        */
-       protected $mConf;
-
-       protected function setUp() {
-               parent::setUp();
-
-               $this->mConf = new SiteConfiguration;
-
-               $this->mConf->suffixes = [ 'wikipedia' => 'wiki' ];
-               $this->mConf->wikis = [ 'enwiki', 'dewiki', 'frwiki' ];
-               $this->mConf->settings = [
-                       'SimpleKey' => [
-                               'wiki' => 'wiki',
-                               'tag' => 'tag',
-                               'enwiki' => 'enwiki',
-                               'dewiki' => 'dewiki',
-                               'frwiki' => 'frwiki',
-                       ],
-
-                       'Fallback' => [
-                               'default' => 'default',
-                               'wiki' => 'wiki',
-                               'tag' => 'tag',
-                               'frwiki' => 'frwiki',
-                               'null_wiki' => null,
-                       ],
-
-                       'WithParams' => [
-                               'default' => '$lang $site $wiki',
-                       ],
-
-                       '+SomeGlobal' => [
-                               'wiki' => [
-                                       'wiki' => 'wiki',
-                               ],
-                               'tag' => [
-                                       'tag' => 'tag',
-                               ],
-                               'enwiki' => [
-                                       'enwiki' => 'enwiki',
-                               ],
-                               'dewiki' => [
-                                       'dewiki' => 'dewiki',
-                               ],
-                               'frwiki' => [
-                                       'frwiki' => 'frwiki',
-                               ],
-                       ],
-
-                       'MergeIt' => [
-                               '+wiki' => [
-                                       'wiki' => 'wiki',
-                               ],
-                               '+tag' => [
-                                       'tag' => 'tag',
-                               ],
-                               'default' => [
-                                       'default' => 'default',
-                               ],
-                               '+enwiki' => [
-                                       'enwiki' => 'enwiki',
-                               ],
-                               '+dewiki' => [
-                                       'dewiki' => 'dewiki',
-                               ],
-                               '+frwiki' => [
-                                       'frwiki' => 'frwiki',
-                               ],
-                       ],
-               ];
-
-               $GLOBALS['SomeGlobal'] = [ 'SomeGlobal' => 'SomeGlobal' ];
-       }
-
-       /**
-        * This function is used as a callback within the tests below
-        */
-       public static function getSiteParamsCallback( $conf, $wiki ) {
-               $site = null;
-               $lang = null;
-               foreach ( $conf->suffixes as $suffix ) {
-                       if ( substr( $wiki, -strlen( $suffix ) ) == $suffix ) {
-                               $site = $suffix;
-                               $lang = substr( $wiki, 0, -strlen( $suffix ) );
-                               break;
-                       }
-               }
-
-               return [
-                       'suffix' => $site,
-                       'lang' => $lang,
-                       'params' => [
-                               'lang' => $lang,
-                               'site' => $site,
-                               'wiki' => $wiki,
-                       ],
-                       'tags' => [ 'tag' ],
-               ];
-       }
-
-       /**
-        * @covers SiteConfiguration::siteFromDB
-        */
-       public function testSiteFromDb() {
-               $this->assertEquals(
-                       [ 'wikipedia', 'en' ],
-                       $this->mConf->siteFromDB( 'enwiki' ),
-                       'siteFromDB()'
-               );
-               $this->assertEquals(
-                       [ 'wikipedia', '' ],
-                       $this->mConf->siteFromDB( 'wiki' ),
-                       'siteFromDB() on a suffix'
-               );
-               $this->assertEquals(
-                       [ null, null ],
-                       $this->mConf->siteFromDB( 'wikien' ),
-                       'siteFromDB() on a non-existing wiki'
-               );
-
-               $this->mConf->suffixes = [ 'wiki', '' ];
-               $this->assertEquals(
-                       [ '', 'wikien' ],
-                       $this->mConf->siteFromDB( 'wikien' ),
-                       'siteFromDB() on a non-existing wiki (2)'
-               );
-       }
-
-       /**
-        * @covers SiteConfiguration::getLocalDatabases
-        */
-       public function testGetLocalDatabases() {
-               $this->assertEquals(
-                       [ 'enwiki', 'dewiki', 'frwiki' ],
-                       $this->mConf->getLocalDatabases(),
-                       'getLocalDatabases()'
-               );
-       }
-
-       /**
-        * @covers SiteConfiguration::get
-        */
-       public function testGetConfVariables() {
-               // Simple
-               $this->assertEquals(
-                       'enwiki',
-                       $this->mConf->get( 'SimpleKey', 'enwiki', 'wiki' ),
-                       'get(): simple setting on an existing wiki'
-               );
-               $this->assertEquals(
-                       'dewiki',
-                       $this->mConf->get( 'SimpleKey', 'dewiki', 'wiki' ),
-                       'get(): simple setting on an existing wiki (2)'
-               );
-               $this->assertEquals(
-                       'frwiki',
-                       $this->mConf->get( 'SimpleKey', 'frwiki', 'wiki' ),
-                       'get(): simple setting on an existing wiki (3)'
-               );
-               $this->assertEquals(
-                       'wiki',
-                       $this->mConf->get( 'SimpleKey', 'wiki', 'wiki' ),
-                       'get(): simple setting on an suffix'
-               );
-               $this->assertEquals(
-                       'wiki',
-                       $this->mConf->get( 'SimpleKey', 'eswiki', 'wiki' ),
-                       'get(): simple setting on an non-existing wiki'
-               );
-
-               // Fallback
-               $this->assertEquals(
-                       'wiki',
-                       $this->mConf->get( 'Fallback', 'enwiki', 'wiki' ),
-                       'get(): fallback setting on an existing wiki'
-               );
-               $this->assertEquals(
-                       'tag',
-                       $this->mConf->get( 'Fallback', 'dewiki', 'wiki', [], [ 'tag' ] ),
-                       'get(): fallback setting on an existing wiki (with wiki tag)'
-               );
-               $this->assertEquals(
-                       'frwiki',
-                       $this->mConf->get( 'Fallback', 'frwiki', 'wiki', [], [ 'tag' ] ),
-                       'get(): no fallback if wiki has its own setting (matching tag)'
-               );
-               $this->assertSame(
-                       // Potential regression test for T192855
-                       null,
-                       $this->mConf->get( 'Fallback', 'null_wiki', 'wiki', [], [ 'tag' ] ),
-                       'get(): no fallback if wiki has its own setting (matching tag and uses null)'
-               );
-               $this->assertEquals(
-                       'wiki',
-                       $this->mConf->get( 'Fallback', 'wiki', 'wiki' ),
-                       'get(): fallback setting on an suffix'
-               );
-               $this->assertEquals(
-                       'wiki',
-                       $this->mConf->get( 'Fallback', 'wiki', 'wiki', [], [ 'tag' ] ),
-                       'get(): fallback setting on an suffix (with wiki tag)'
-               );
-               $this->assertEquals(
-                       'wiki',
-                       $this->mConf->get( 'Fallback', 'eswiki', 'wiki' ),
-                       'get(): fallback setting on an non-existing wiki'
-               );
-               $this->assertEquals(
-                       'tag',
-                       $this->mConf->get( 'Fallback', 'eswiki', 'wiki', [], [ 'tag' ] ),
-                       'get(): fallback setting on an non-existing wiki (with wiki tag)'
-               );
-
-               // Merging
-               $common = [ 'wiki' => 'wiki', 'default' => 'default' ];
-               $commonTag = [ 'tag' => 'tag', 'wiki' => 'wiki', 'default' => 'default' ];
-               $this->assertEquals(
-                       [ 'enwiki' => 'enwiki' ] + $common,
-                       $this->mConf->get( 'MergeIt', 'enwiki', 'wiki' ),
-                       'get(): merging setting on an existing wiki'
-               );
-               $this->assertEquals(
-                       [ 'enwiki' => 'enwiki' ] + $commonTag,
-                       $this->mConf->get( 'MergeIt', 'enwiki', 'wiki', [], [ 'tag' ] ),
-                       'get(): merging setting on an existing wiki (with tag)'
-               );
-               $this->assertEquals(
-                       [ 'dewiki' => 'dewiki' ] + $common,
-                       $this->mConf->get( 'MergeIt', 'dewiki', 'wiki' ),
-                       'get(): merging setting on an existing wiki (2)'
-               );
-               $this->assertEquals(
-                       [ 'dewiki' => 'dewiki' ] + $commonTag,
-                       $this->mConf->get( 'MergeIt', 'dewiki', 'wiki', [], [ 'tag' ] ),
-                       'get(): merging setting on an existing wiki (2) (with tag)'
-               );
-               $this->assertEquals(
-                       [ 'frwiki' => 'frwiki' ] + $common,
-                       $this->mConf->get( 'MergeIt', 'frwiki', 'wiki' ),
-                       'get(): merging setting on an existing wiki (3)'
-               );
-               $this->assertEquals(
-                       [ 'frwiki' => 'frwiki' ] + $commonTag,
-                       $this->mConf->get( 'MergeIt', 'frwiki', 'wiki', [], [ 'tag' ] ),
-                       'get(): merging setting on an existing wiki (3) (with tag)'
-               );
-               $this->assertEquals(
-                       [ 'wiki' => 'wiki' ] + $common,
-                       $this->mConf->get( 'MergeIt', 'wiki', 'wiki' ),
-                       'get(): merging setting on an suffix'
-               );
-               $this->assertEquals(
-                       [ 'wiki' => 'wiki' ] + $commonTag,
-                       $this->mConf->get( 'MergeIt', 'wiki', 'wiki', [], [ 'tag' ] ),
-                       'get(): merging setting on an suffix (with tag)'
-               );
-               $this->assertEquals(
-                       $common,
-                       $this->mConf->get( 'MergeIt', 'eswiki', 'wiki' ),
-                       'get(): merging setting on an non-existing wiki'
-               );
-               $this->assertEquals(
-                       $commonTag,
-                       $this->mConf->get( 'MergeIt', 'eswiki', 'wiki', [], [ 'tag' ] ),
-                       'get(): merging setting on an non-existing wiki (with tag)'
-               );
-       }
-
-       /**
-        * @covers SiteConfiguration::siteFromDB
-        */
-       public function testSiteFromDbWithCallback() {
-               $this->mConf->siteParamsCallback = 'SiteConfigurationTest::getSiteParamsCallback';
-
-               $this->assertEquals(
-                       [ 'wiki', 'en' ],
-                       $this->mConf->siteFromDB( 'enwiki' ),
-                       'siteFromDB() with callback'
-               );
-               $this->assertEquals(
-                       [ 'wiki', '' ],
-                       $this->mConf->siteFromDB( 'wiki' ),
-                       'siteFromDB() with callback on a suffix'
-               );
-               $this->assertEquals(
-                       [ null, null ],
-                       $this->mConf->siteFromDB( 'wikien' ),
-                       'siteFromDB() with callback on a non-existing wiki'
-               );
-       }
-
-       /**
-        * @covers SiteConfiguration::get
-        */
-       public function testParameterReplacement() {
-               $this->mConf->siteParamsCallback = 'SiteConfigurationTest::getSiteParamsCallback';
-
-               $this->assertEquals(
-                       'en wiki enwiki',
-                       $this->mConf->get( 'WithParams', 'enwiki', 'wiki' ),
-                       'get(): parameter replacement on an existing wiki'
-               );
-               $this->assertEquals(
-                       'de wiki dewiki',
-                       $this->mConf->get( 'WithParams', 'dewiki', 'wiki' ),
-                       'get(): parameter replacement on an existing wiki (2)'
-               );
-               $this->assertEquals(
-                       'fr wiki frwiki',
-                       $this->mConf->get( 'WithParams', 'frwiki', 'wiki' ),
-                       'get(): parameter replacement on an existing wiki (3)'
-               );
-               $this->assertEquals(
-                       ' wiki wiki',
-                       $this->mConf->get( 'WithParams', 'wiki', 'wiki' ),
-                       'get(): parameter replacement on an suffix'
-               );
-               $this->assertEquals(
-                       'es wiki eswiki',
-                       $this->mConf->get( 'WithParams', 'eswiki', 'wiki' ),
-                       'get(): parameter replacement on an non-existing wiki'
-               );
-       }
-
-       /**
-        * @covers SiteConfiguration::getAll
-        */
-       public function testGetAllGlobals() {
-               $this->mConf->siteParamsCallback = 'SiteConfigurationTest::getSiteParamsCallback';
-
-               $getall = [
-                       'SimpleKey' => 'enwiki',
-                       'Fallback' => 'tag',
-                       'WithParams' => 'en wiki enwiki',
-                       'SomeGlobal' => [ 'enwiki' => 'enwiki' ] + $GLOBALS['SomeGlobal'],
-                       'MergeIt' => [
-                               'enwiki' => 'enwiki',
-                               'tag' => 'tag',
-                               'wiki' => 'wiki',
-                               'default' => 'default'
-                       ],
-               ];
-               $this->assertEquals( $getall, $this->mConf->getAll( 'enwiki' ), 'getAll()' );
-
-               $this->mConf->extractAllGlobals( 'enwiki', 'wiki' );
-
-               $this->assertEquals(
-                       $getall['SimpleKey'],
-                       $GLOBALS['SimpleKey'],
-                       'extractAllGlobals(): simple setting'
-               );
-               $this->assertEquals(
-                       $getall['Fallback'],
-                       $GLOBALS['Fallback'],
-                       'extractAllGlobals(): fallback setting'
-               );
-               $this->assertEquals(
-                       $getall['WithParams'],
-                       $GLOBALS['WithParams'],
-                       'extractAllGlobals(): parameter replacement'
-               );
-               $this->assertEquals(
-                       $getall['SomeGlobal'],
-                       $GLOBALS['SomeGlobal'],
-                       'extractAllGlobals(): merging with global'
-               );
-               $this->assertEquals(
-                       $getall['MergeIt'],
-                       $GLOBALS['MergeIt'],
-                       'extractAllGlobals(): merging setting'
-               );
-       }
-}
diff --git a/tests/phpunit/includes/Storage/BlobStoreFactoryTest.php b/tests/phpunit/includes/Storage/BlobStoreFactoryTest.php
deleted file mode 100644 (file)
index 252c657..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-namespace MediaWiki\Tests\Storage;
-
-use MediaWiki\MediaWikiServices;
-use MediaWiki\Storage\BlobStore;
-use MediaWiki\Storage\SqlBlobStore;
-use MediaWikiTestCase;
-use Wikimedia\TestingAccessWrapper;
-
-/**
- * @covers \MediaWiki\Storage\BlobStoreFactory
- */
-class BlobStoreFactoryTest extends MediaWikiTestCase {
-
-       public function provideWikiIds() {
-               yield [ false ];
-               yield [ 'someWiki' ];
-       }
-
-       /**
-        * @dataProvider provideWikiIds
-        */
-       public function testNewBlobStore( $wikiId ) {
-               $factory = MediaWikiServices::getInstance()->getBlobStoreFactory();
-               $store = $factory->newBlobStore( $wikiId );
-               $this->assertInstanceOf( BlobStore::class, $store );
-
-               // This only works as we currently know this is a SqlBlobStore object
-               $wrapper = TestingAccessWrapper::newFromObject( $store );
-               $this->assertEquals( $wikiId, $wrapper->wikiId );
-       }
-
-       /**
-        * @dataProvider provideWikiIds
-        */
-       public function testNewSqlBlobStore( $wikiId ) {
-               $factory = MediaWikiServices::getInstance()->getBlobStoreFactory();
-               $store = $factory->newSqlBlobStore( $wikiId );
-               $this->assertInstanceOf( SqlBlobStore::class, $store );
-
-               $wrapper = TestingAccessWrapper::newFromObject( $store );
-               $this->assertEquals( $wikiId, $wrapper->wikiId );
-       }
-
-}
diff --git a/tests/phpunit/includes/Storage/PreparedEditTest.php b/tests/phpunit/includes/Storage/PreparedEditTest.php
deleted file mode 100644 (file)
index 29999ee..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-
-namespace MediaWiki\Edit;
-
-use ParserOutput;
-use MediaWikiTestCase;
-
-/**
- * @covers \MediaWiki\Edit\PreparedEdit
- */
-class PreparedEditTest extends MediaWikiTestCase {
-       function testCallback() {
-               $output = new ParserOutput();
-               $edit = new PreparedEdit();
-               $edit->parserOutputCallback = function () {
-                       return new ParserOutput();
-               };
-
-               $this->assertEquals( $output, $edit->getOutput() );
-               $this->assertEquals( $output, $edit->output );
-       }
-}
diff --git a/tests/phpunit/includes/TitleArrayFromResultTest.php b/tests/phpunit/includes/TitleArrayFromResultTest.php
deleted file mode 100644 (file)
index 32c7571..0000000
+++ /dev/null
@@