From 344481f60d92ac9295129c5089c0fe467ff497b9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?M=C3=A1t=C3=A9=20Szab=C3=B3?= Date: Sun, 30 Jun 2019 15:23:53 +0200 Subject: [PATCH] Move trivially compatible tests to the unit tests suite This changeset resumes work on T89432 and related tickets by porting an initial set of tests to the new unit test suite separated out in I69b92db3e70093570e05cc0a64c7780a278b321a. The tests were only ported if they worked immediately without requiring any changes other than changing the test case class to MediaWikiUnitTestCase and moving the test to the new suite. If a test failed for any reason (even trivial misconfiguration), it was NOT ported. With this change, the unit tests suite now consits of a total of 455 tests. As before, you can run these tests via the following command: $ composer phpunit:unit Bug: T84948 Bug: T89432 Bug: T87781 Change-Id: Ibb8175981092d7f41864e641cc3c118af70a5c76 --- tests/common/TestSetup.php | 3 ++ tests/common/TestsAutoLoader.php | 1 + tests/phpunit/MediaWikiGroupValidator.php | 38 +++++++++++++++++++ .../phpunit/MediaWikiIntegrationTestCase.php | 12 +----- tests/phpunit/MediaWikiUnitTestCase.php | 13 +++++++ tests/phpunit/bootstrap.php | 1 + .../languages/SpecialPageAliasTest.php | 2 +- .../{ => unit}/includes/FauxResponseTest.php | 2 +- .../FormOptionsInitializationTest.php | 2 +- .../{ => unit}/includes/FormOptionsTest.php | 2 +- .../{ => unit}/includes/LicensesTest.php | 2 +- .../includes/Rest/HeaderContainerTest.php | 3 +- .../PathTemplateMatcher/PathMatcherTest.php | 3 +- .../includes/Rest/StringStreamTest.php | 3 +- .../Revision/FallbackSlotRoleHandlerTest.php | 3 +- .../includes/Revision/SlotRoleHandlerTest.php | 3 +- .../{ => unit}/includes/ServiceWiringTest.php | 2 +- .../includes/SiteConfigurationTest.php | 2 +- .../includes/Storage/PreparedEditTest.php | 3 +- .../{ => unit}/includes/XmlSelectTest.php | 2 +- .../auth/AuthenticationResponseTest.php | 2 +- .../changes/ChangesListFilterGroupTest.php | 2 +- .../includes/config/HashConfigTest.php | 2 +- .../includes/config/MultiConfigTest.php | 2 +- .../includes/config/ServiceOptionsTest.php | 2 +- .../content/JsonContentHandlerTest.php | 2 +- .../includes/debug/logger/MonologSpiTest.php | 3 +- .../logger/monolog/AvroFormatterTest.php | 3 +- .../debug/logger/monolog/KafkaHandlerTest.php | 3 +- .../logger/monolog/LineFormatterTest.php | 3 +- .../includes/diff/ArrayDiffFormatterTest.php | 2 +- .../{ => unit}/includes/diff/DiffOpTest.php | 2 +- .../{ => unit}/includes/diff/DiffTest.php | 2 +- .../exception/MWExceptionHandlerTest.php | 2 +- .../installer/InstallDocFormatterTest.php | 2 +- .../installer/OracleInstallerTest.php | 3 +- .../interwiki/InterwikiLookupAdapterTest.php | 2 +- .../objectcache/ReplicatedBagOStuffTest.php | 2 +- .../{ => unit}/includes/media/IPTCTest.php | 2 +- .../includes/media/MediaHandlerTest.php | 2 +- .../objectcache/MemcachedBagOStuffTest.php | 2 +- .../objectcache/RESTBagOStuffTest.php | 2 +- .../{ => unit}/includes/parser/TidyTest.php | 2 +- .../includes/password/PasswordTest.php | 2 +- .../includes/preferences/FiltersTest.php | 2 +- .../registration/ExtensionProcessorTest.php | 2 +- .../includes/search/SearchIndexFieldTest.php | 2 +- .../session/MetadataMergeExceptionTest.php | 4 +- .../includes/session/SessionIdTest.php | 4 +- .../includes/skins/SkinFactoryTest.php | 2 +- .../includes/title/ForeignTitleTest.php | 2 +- .../NamespaceAwareForeignTitleFactoryTest.php | 2 +- .../includes/title/TitleValueTest.php | 2 +- .../includes/user/UserArrayFromResultTest.php | 2 +- .../NoWriteWatchedItemStoreUnitTest.php | 2 +- 55 files changed, 106 insertions(+), 75 deletions(-) create mode 100644 tests/phpunit/MediaWikiGroupValidator.php rename tests/phpunit/{ => unit}/includes/FauxResponseTest.php (98%) rename tests/phpunit/{ => unit}/includes/FormOptionsInitializationTest.php (94%) rename tests/phpunit/{ => unit}/includes/FormOptionsTest.php (97%) rename tests/phpunit/{ => unit}/includes/LicensesTest.php (90%) rename tests/phpunit/{ => unit}/includes/Rest/HeaderContainerTest.php (97%) rename tests/phpunit/{ => unit}/includes/Rest/PathTemplateMatcher/PathMatcherTest.php (96%) rename tests/phpunit/{ => unit}/includes/Rest/StringStreamTest.php (97%) rename tests/phpunit/{ => unit}/includes/Revision/FallbackSlotRoleHandlerTest.php (96%) rename tests/phpunit/{ => unit}/includes/Revision/SlotRoleHandlerTest.php (96%) rename tests/phpunit/{ => unit}/includes/ServiceWiringTest.php (85%) rename tests/phpunit/{ => unit}/includes/SiteConfigurationTest.php (99%) rename tests/phpunit/{ => unit}/includes/Storage/PreparedEditTest.php (83%) rename tests/phpunit/{ => unit}/includes/XmlSelectTest.php (98%) rename tests/phpunit/{ => unit}/includes/auth/AuthenticationResponseTest.php (97%) rename tests/phpunit/{ => unit}/includes/changes/ChangesListFilterGroupTest.php (95%) rename tests/phpunit/{ => unit}/includes/config/HashConfigTest.php (96%) rename tests/phpunit/{ => unit}/includes/config/MultiConfigTest.php (94%) rename tests/phpunit/{ => unit}/includes/config/ServiceOptionsTest.php (98%) rename tests/phpunit/{ => unit}/includes/content/JsonContentHandlerTest.php (82%) rename tests/phpunit/{ => unit}/includes/debug/logger/MonologSpiTest.php (97%) rename tests/phpunit/{ => unit}/includes/debug/logger/monolog/AvroFormatterTest.php (96%) rename tests/phpunit/{ => unit}/includes/debug/logger/monolog/KafkaHandlerTest.php (98%) rename tests/phpunit/{ => unit}/includes/debug/logger/monolog/LineFormatterTest.php (98%) rename tests/phpunit/{ => unit}/includes/diff/ArrayDiffFormatterTest.php (98%) rename tests/phpunit/{ => unit}/includes/diff/DiffOpTest.php (96%) rename tests/phpunit/{ => unit}/includes/diff/DiffTest.php (83%) rename tests/phpunit/{ => unit}/includes/exception/MWExceptionHandlerTest.php (96%) rename tests/phpunit/{ => unit}/includes/installer/InstallDocFormatterTest.php (97%) rename tests/phpunit/{ => unit}/includes/installer/OracleInstallerTest.php (95%) rename tests/phpunit/{ => unit}/includes/interwiki/InterwikiLookupAdapterTest.php (98%) rename tests/phpunit/{ => unit}/includes/libs/objectcache/ReplicatedBagOStuffTest.php (95%) rename tests/phpunit/{ => unit}/includes/media/IPTCTest.php (98%) rename tests/phpunit/{ => unit}/includes/media/MediaHandlerTest.php (96%) rename tests/phpunit/{ => unit}/includes/objectcache/MemcachedBagOStuffTest.php (98%) rename tests/phpunit/{ => unit}/includes/objectcache/RESTBagOStuffTest.php (98%) rename tests/phpunit/{ => unit}/includes/parser/TidyTest.php (97%) rename tests/phpunit/{ => unit}/includes/password/PasswordTest.php (95%) rename tests/phpunit/{ => unit}/includes/preferences/FiltersTest.php (98%) rename tests/phpunit/{ => unit}/includes/registration/ExtensionProcessorTest.php (99%) rename tests/phpunit/{ => unit}/includes/search/SearchIndexFieldTest.php (95%) rename tests/phpunit/{ => unit}/includes/session/MetadataMergeExceptionTest.php (88%) rename tests/phpunit/{ => unit}/includes/session/SessionIdTest.php (83%) rename tests/phpunit/{ => unit}/includes/skins/SkinFactoryTest.php (97%) rename tests/phpunit/{ => unit}/includes/title/ForeignTitleTest.php (98%) rename tests/phpunit/{ => unit}/includes/title/NamespaceAwareForeignTitleFactoryTest.php (97%) rename tests/phpunit/{ => unit}/includes/title/TitleValueTest.php (98%) rename tests/phpunit/{ => unit}/includes/user/UserArrayFromResultTest.php (97%) rename tests/phpunit/{ => unit}/includes/watcheditem/NoWriteWatchedItemStoreUnitTest.php (99%) diff --git a/tests/common/TestSetup.php b/tests/common/TestSetup.php index e24c4c5442..a42f573bb3 100644 --- a/tests/common/TestSetup.php +++ b/tests/common/TestSetup.php @@ -18,6 +18,9 @@ class TestSetup { global $wgSessionProviders, $wgSessionPbkdf2Iterations; global $wgJobTypeConf; global $wgAuthManagerConfig; + global $wgShowExceptionDetails; + + $wgShowExceptionDetails = true; // wfWarn should cause tests to fail $wgDevelopmentWarnings = true; diff --git a/tests/common/TestsAutoLoader.php b/tests/common/TestsAutoLoader.php index e1dde22436..c35e80fada 100644 --- a/tests/common/TestsAutoLoader.php +++ b/tests/common/TestsAutoLoader.php @@ -54,6 +54,7 @@ $wgAutoloadClasses += [ 'HamcrestPHPUnitIntegration' => "$testDir/phpunit/HamcrestPHPUnitIntegration.php", 'LessFileCompilationTest' => "$testDir/phpunit/LessFileCompilationTest.php", 'MediaWikiCoversValidator' => "$testDir/phpunit/MediaWikiCoversValidator.php", + 'MediaWikiGroupValidator' => "$testDir/phpunit/MediaWikiGroupValidator.php", 'MediaWikiLangTestCase' => "$testDir/phpunit/MediaWikiLangTestCase.php", 'MediaWikiLoggerPHPUnitTestListener' => "$testDir/phpunit/MediaWikiLoggerPHPUnitTestListener.php", 'MediaWikiPHPUnitCommand' => "$testDir/phpunit/MediaWikiPHPUnitCommand.php", diff --git a/tests/phpunit/MediaWikiGroupValidator.php b/tests/phpunit/MediaWikiGroupValidator.php new file mode 100644 index 0000000000..4daff34aca --- /dev/null +++ b/tests/phpunit/MediaWikiGroupValidator.php @@ -0,0 +1,38 @@ +getDocComment() ); + } +} diff --git a/tests/phpunit/MediaWikiIntegrationTestCase.php b/tests/phpunit/MediaWikiIntegrationTestCase.php index a5c9ab19a2..3216d213a4 100644 --- a/tests/phpunit/MediaWikiIntegrationTestCase.php +++ b/tests/phpunit/MediaWikiIntegrationTestCase.php @@ -24,6 +24,7 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase { use MediaWikiCoversValidator; use PHPUnit4And6Compat; + use MediaWikiGroupValidator; /** * The original service locator. This is overridden during setUp(). @@ -1319,17 +1320,6 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase { return $this->tablesUsed || $this->isTestInDatabaseGroup(); } - /** - * @return bool - * @since 1.32 - */ - protected function isTestInDatabaseGroup() { - // If the test class says it belongs to the Database group, it needs the database. - // NOTE: This ONLY checks for the group in the class level doc comment. - $rc = new ReflectionClass( $this ); - return (bool)preg_match( '/@group +Database/im', $rc->getDocComment() ); - } - /** * Insert a new page. * diff --git a/tests/phpunit/MediaWikiUnitTestCase.php b/tests/phpunit/MediaWikiUnitTestCase.php index 06f0c9cd01..c1dc0f9099 100644 --- a/tests/phpunit/MediaWikiUnitTestCase.php +++ b/tests/phpunit/MediaWikiUnitTestCase.php @@ -30,4 +30,17 @@ use PHPUnit\Framework\TestCase; abstract class MediaWikiUnitTestCase extends TestCase { use PHPUnit4And6Compat; use MediaWikiCoversValidator; + use MediaWikiGroupValidator; + + /** + * @throws ReflectionException + */ + protected function setUp() { + parent::setUp(); + if ( $this->isTestInDatabaseGroup() ) { + throw new \Exception( get_class( $this ) . + ' extends MediaWikiUnitTestCase, and may not have the @group Database annotation.' ); + } + } + } diff --git a/tests/phpunit/bootstrap.php b/tests/phpunit/bootstrap.php index 258c822553..4b1ade2906 100644 --- a/tests/phpunit/bootstrap.php +++ b/tests/phpunit/bootstrap.php @@ -65,3 +65,4 @@ require_once "$IP/tests/common/TestSetup.php"; wfRequireOnceInGlobalScope( "$IP/includes/AutoLoader.php" ); wfRequireOnceInGlobalScope( "$IP/tests/common/TestsAutoLoader.php" ); +wfRequireOnceInGlobalScope( "$IP/includes/Defines.php" ); diff --git a/tests/phpunit/languages/SpecialPageAliasTest.php b/tests/phpunit/languages/SpecialPageAliasTest.php index d406c88933..cce9d0eb0f 100644 --- a/tests/phpunit/languages/SpecialPageAliasTest.php +++ b/tests/phpunit/languages/SpecialPageAliasTest.php @@ -11,7 +11,7 @@ * * @author Katie Filbert < aude.wiki@gmail.com > */ -class SpecialPageAliasTest extends MediaWikiTestCase { +class SpecialPageAliasTest extends \MediaWikiUnitTestCase { /** * @coversNothing diff --git a/tests/phpunit/includes/FauxResponseTest.php b/tests/phpunit/unit/includes/FauxResponseTest.php similarity index 98% rename from tests/phpunit/includes/FauxResponseTest.php rename to tests/phpunit/unit/includes/FauxResponseTest.php index 8085bc710c..5e208aceda 100644 --- a/tests/phpunit/includes/FauxResponseTest.php +++ b/tests/phpunit/unit/includes/FauxResponseTest.php @@ -20,7 +20,7 @@ * @file */ -class FauxResponseTest extends MediaWikiTestCase { +class FauxResponseTest extends \MediaWikiUnitTestCase { /** @var FauxResponse */ protected $response; diff --git a/tests/phpunit/includes/FormOptionsInitializationTest.php b/tests/phpunit/unit/includes/FormOptionsInitializationTest.php similarity index 94% rename from tests/phpunit/includes/FormOptionsInitializationTest.php rename to tests/phpunit/unit/includes/FormOptionsInitializationTest.php index 2c78618aa1..708956d260 100644 --- a/tests/phpunit/includes/FormOptionsInitializationTest.php +++ b/tests/phpunit/unit/includes/FormOptionsInitializationTest.php @@ -10,7 +10,7 @@ use Wikimedia\TestingAccessWrapper; * * @author Antoine Musso */ -class FormOptionsInitializationTest extends MediaWikiTestCase { +class FormOptionsInitializationTest extends \MediaWikiUnitTestCase { /** * @var FormOptions */ diff --git a/tests/phpunit/includes/FormOptionsTest.php b/tests/phpunit/unit/includes/FormOptionsTest.php similarity index 97% rename from tests/phpunit/includes/FormOptionsTest.php rename to tests/phpunit/unit/includes/FormOptionsTest.php index da08670f57..c14595bc4a 100644 --- a/tests/phpunit/includes/FormOptionsTest.php +++ b/tests/phpunit/unit/includes/FormOptionsTest.php @@ -15,7 +15,7 @@ * * @author Antoine Musso */ -class FormOptionsTest extends MediaWikiTestCase { +class FormOptionsTest extends \MediaWikiUnitTestCase { /** * @var FormOptions */ diff --git a/tests/phpunit/includes/LicensesTest.php b/tests/phpunit/unit/includes/LicensesTest.php similarity index 90% rename from tests/phpunit/includes/LicensesTest.php rename to tests/phpunit/unit/includes/LicensesTest.php index 0e96bf44ee..e5a6baeff6 100644 --- a/tests/phpunit/includes/LicensesTest.php +++ b/tests/phpunit/unit/includes/LicensesTest.php @@ -3,7 +3,7 @@ /** * @covers Licenses */ -class LicensesTest extends MediaWikiTestCase { +class LicensesTest extends \MediaWikiUnitTestCase { public function testLicenses() { $str = " diff --git a/tests/phpunit/includes/Rest/HeaderContainerTest.php b/tests/phpunit/unit/includes/Rest/HeaderContainerTest.php similarity index 97% rename from tests/phpunit/includes/Rest/HeaderContainerTest.php rename to tests/phpunit/unit/includes/Rest/HeaderContainerTest.php index e0dbfdf4f6..e65251e350 100644 --- a/tests/phpunit/includes/Rest/HeaderContainerTest.php +++ b/tests/phpunit/unit/includes/Rest/HeaderContainerTest.php @@ -2,13 +2,12 @@ namespace MediaWiki\Tests\Rest; -use MediaWikiTestCase; use MediaWiki\Rest\HeaderContainer; /** * @covers \MediaWiki\Rest\HeaderContainer */ -class HeaderContainerTest extends MediaWikiTestCase { +class HeaderContainerTest extends \MediaWikiUnitTestCase { public static function provideSetHeader() { return [ 'simple' => [ diff --git a/tests/phpunit/includes/Rest/PathTemplateMatcher/PathMatcherTest.php b/tests/phpunit/unit/includes/Rest/PathTemplateMatcher/PathMatcherTest.php similarity index 96% rename from tests/phpunit/includes/Rest/PathTemplateMatcher/PathMatcherTest.php rename to tests/phpunit/unit/includes/Rest/PathTemplateMatcher/PathMatcherTest.php index 935cec19e9..f56024cfdf 100644 --- a/tests/phpunit/includes/Rest/PathTemplateMatcher/PathMatcherTest.php +++ b/tests/phpunit/unit/includes/Rest/PathTemplateMatcher/PathMatcherTest.php @@ -4,13 +4,12 @@ namespace MediaWiki\Tests\Rest\PathTemplateMatcher; use MediaWiki\Rest\PathTemplateMatcher\PathConflict; use MediaWiki\Rest\PathTemplateMatcher\PathMatcher; -use MediaWikiTestCase; /** * @covers \MediaWiki\Rest\PathTemplateMatcher\PathMatcher * @covers \MediaWiki\Rest\PathTemplateMatcher\PathConflict */ -class PathMatcherTest extends MediaWikiTestCase { +class PathMatcherTest extends \MediaWikiUnitTestCase { private static $normalRoutes = [ '/a/b', '/b/{x}', diff --git a/tests/phpunit/includes/Rest/StringStreamTest.php b/tests/phpunit/unit/includes/Rest/StringStreamTest.php similarity index 97% rename from tests/phpunit/includes/Rest/StringStreamTest.php rename to tests/phpunit/unit/includes/Rest/StringStreamTest.php index f474643879..1e72239d1d 100644 --- a/tests/phpunit/includes/Rest/StringStreamTest.php +++ b/tests/phpunit/unit/includes/Rest/StringStreamTest.php @@ -3,10 +3,9 @@ namespace MediaWiki\Tests\Rest; use MediaWiki\Rest\StringStream; -use MediaWikiTestCase; /** @covers \MediaWiki\Rest\StringStream */ -class StringStreamTest extends MediaWikiTestCase { +class StringStreamTest extends \MediaWikiUnitTestCase { public static function provideSeekGetContents() { return [ [ 'abcde', 0, SEEK_SET, 'abcde' ], diff --git a/tests/phpunit/includes/Revision/FallbackSlotRoleHandlerTest.php b/tests/phpunit/unit/includes/Revision/FallbackSlotRoleHandlerTest.php similarity index 96% rename from tests/phpunit/includes/Revision/FallbackSlotRoleHandlerTest.php rename to tests/phpunit/unit/includes/Revision/FallbackSlotRoleHandlerTest.php index 898a35f23f..17b3504952 100644 --- a/tests/phpunit/includes/Revision/FallbackSlotRoleHandlerTest.php +++ b/tests/phpunit/unit/includes/Revision/FallbackSlotRoleHandlerTest.php @@ -3,13 +3,12 @@ namespace MediaWiki\Tests\Revision; use MediaWiki\Revision\FallbackSlotRoleHandler; -use MediaWikiTestCase; use Title; /** * @covers \MediaWiki\Revision\FallbackSlotRoleHandler */ -class FallbackSlotRoleHandlerTest extends MediaWikiTestCase { +class FallbackSlotRoleHandlerTest extends \MediaWikiUnitTestCase { /** * @return Title diff --git a/tests/phpunit/includes/Revision/SlotRoleHandlerTest.php b/tests/phpunit/unit/includes/Revision/SlotRoleHandlerTest.php similarity index 96% rename from tests/phpunit/includes/Revision/SlotRoleHandlerTest.php rename to tests/phpunit/unit/includes/Revision/SlotRoleHandlerTest.php index 372a879313..39217c2597 100644 --- a/tests/phpunit/includes/Revision/SlotRoleHandlerTest.php +++ b/tests/phpunit/unit/includes/Revision/SlotRoleHandlerTest.php @@ -3,13 +3,12 @@ namespace MediaWiki\Tests\Revision; use MediaWiki\Revision\SlotRoleHandler; -use MediaWikiTestCase; use Title; /** * @covers \MediaWiki\Revision\SlotRoleHandler */ -class SlotRoleHandlerTest extends MediaWikiTestCase { +class SlotRoleHandlerTest extends \MediaWikiUnitTestCase { /** * @return Title diff --git a/tests/phpunit/includes/ServiceWiringTest.php b/tests/phpunit/unit/includes/ServiceWiringTest.php similarity index 85% rename from tests/phpunit/includes/ServiceWiringTest.php rename to tests/phpunit/unit/includes/ServiceWiringTest.php index 02e06f8dda..25b0214db1 100644 --- a/tests/phpunit/includes/ServiceWiringTest.php +++ b/tests/phpunit/unit/includes/ServiceWiringTest.php @@ -3,7 +3,7 @@ /** * @coversNothing */ -class ServiceWiringTest extends MediaWikiTestCase { +class ServiceWiringTest extends \MediaWikiUnitTestCase { public function testServicesAreSorted() { global $IP; $services = array_keys( require "$IP/includes/ServiceWiring.php" ); diff --git a/tests/phpunit/includes/SiteConfigurationTest.php b/tests/phpunit/unit/includes/SiteConfigurationTest.php similarity index 99% rename from tests/phpunit/includes/SiteConfigurationTest.php rename to tests/phpunit/unit/includes/SiteConfigurationTest.php index 3b7226245f..b992a86471 100644 --- a/tests/phpunit/includes/SiteConfigurationTest.php +++ b/tests/phpunit/unit/includes/SiteConfigurationTest.php @@ -1,6 +1,6 @@ newFromPlaintext( null ); diff --git a/tests/phpunit/includes/preferences/FiltersTest.php b/tests/phpunit/unit/includes/preferences/FiltersTest.php similarity index 98% rename from tests/phpunit/includes/preferences/FiltersTest.php rename to tests/phpunit/unit/includes/preferences/FiltersTest.php index 60b01b880c..d2b5d05bb3 100644 --- a/tests/phpunit/includes/preferences/FiltersTest.php +++ b/tests/phpunit/unit/includes/preferences/FiltersTest.php @@ -25,7 +25,7 @@ use MediaWiki\Preferences\TimezoneFilter; /** * @group Preferences */ -class FiltersTest extends MediaWikiTestCase { +class FiltersTest extends \MediaWikiUnitTestCase { /** * @covers MediaWiki\Preferences\IntvalFilter::filterFromForm() * @covers MediaWiki\Preferences\IntvalFilter::filterForForm() diff --git a/tests/phpunit/includes/registration/ExtensionProcessorTest.php b/tests/phpunit/unit/includes/registration/ExtensionProcessorTest.php similarity index 99% rename from tests/phpunit/includes/registration/ExtensionProcessorTest.php rename to tests/phpunit/unit/includes/registration/ExtensionProcessorTest.php index cdd5c63eff..13de142ae6 100644 --- a/tests/phpunit/includes/registration/ExtensionProcessorTest.php +++ b/tests/phpunit/unit/includes/registration/ExtensionProcessorTest.php @@ -5,7 +5,7 @@ use Wikimedia\TestingAccessWrapper; /** * @covers ExtensionProcessor */ -class ExtensionProcessorTest extends MediaWikiTestCase { +class ExtensionProcessorTest extends \MediaWikiUnitTestCase { private $dir, $dirname; diff --git a/tests/phpunit/includes/search/SearchIndexFieldTest.php b/tests/phpunit/unit/includes/search/SearchIndexFieldTest.php similarity index 95% rename from tests/phpunit/includes/search/SearchIndexFieldTest.php rename to tests/phpunit/unit/includes/search/SearchIndexFieldTest.php index 8b4119e0d3..a640c967cc 100644 --- a/tests/phpunit/includes/search/SearchIndexFieldTest.php +++ b/tests/phpunit/unit/includes/search/SearchIndexFieldTest.php @@ -4,7 +4,7 @@ * @group Search * @covers SearchIndexFieldDefinition */ -class SearchIndexFieldTest extends MediaWikiTestCase { +class SearchIndexFieldTest extends \MediaWikiUnitTestCase { public function getMergeCases() { return [ diff --git a/tests/phpunit/includes/session/MetadataMergeExceptionTest.php b/tests/phpunit/unit/includes/session/MetadataMergeExceptionTest.php similarity index 88% rename from tests/phpunit/includes/session/MetadataMergeExceptionTest.php rename to tests/phpunit/unit/includes/session/MetadataMergeExceptionTest.php index 8cb4302a4e..707adfe5b0 100644 --- a/tests/phpunit/includes/session/MetadataMergeExceptionTest.php +++ b/tests/phpunit/unit/includes/session/MetadataMergeExceptionTest.php @@ -2,13 +2,11 @@ namespace MediaWiki\Session; -use MediaWikiTestCase; - /** * @group Session * @covers MediaWiki\Session\MetadataMergeException */ -class MetadataMergeExceptionTest extends MediaWikiTestCase { +class MetadataMergeExceptionTest extends \MediaWikiUnitTestCase { public function testBasics() { $data = [ 'foo' => 'bar' ]; diff --git a/tests/phpunit/includes/session/SessionIdTest.php b/tests/phpunit/unit/includes/session/SessionIdTest.php similarity index 83% rename from tests/phpunit/includes/session/SessionIdTest.php rename to tests/phpunit/unit/includes/session/SessionIdTest.php index 2b06d971a6..3c7f8cbfdf 100644 --- a/tests/phpunit/includes/session/SessionIdTest.php +++ b/tests/phpunit/unit/includes/session/SessionIdTest.php @@ -2,13 +2,11 @@ namespace MediaWiki\Session; -use MediaWikiTestCase; - /** * @group Session * @covers MediaWiki\Session\SessionId */ -class SessionIdTest extends MediaWikiTestCase { +class SessionIdTest extends \MediaWikiUnitTestCase { public function testEverything() { $id = new SessionId( 'foo' ); diff --git a/tests/phpunit/includes/skins/SkinFactoryTest.php b/tests/phpunit/unit/includes/skins/SkinFactoryTest.php similarity index 97% rename from tests/phpunit/includes/skins/SkinFactoryTest.php rename to tests/phpunit/unit/includes/skins/SkinFactoryTest.php index 4289fd9188..8443c8d1f6 100644 --- a/tests/phpunit/includes/skins/SkinFactoryTest.php +++ b/tests/phpunit/unit/includes/skins/SkinFactoryTest.php @@ -1,6 +1,6 @@ getMockBuilder( Wikimedia\Rdbms\ResultWrapper::class ) diff --git a/tests/phpunit/includes/watcheditem/NoWriteWatchedItemStoreUnitTest.php b/tests/phpunit/unit/includes/watcheditem/NoWriteWatchedItemStoreUnitTest.php similarity index 99% rename from tests/phpunit/includes/watcheditem/NoWriteWatchedItemStoreUnitTest.php rename to tests/phpunit/unit/includes/watcheditem/NoWriteWatchedItemStoreUnitTest.php index f424b21b3e..556f518e54 100644 --- a/tests/phpunit/includes/watcheditem/NoWriteWatchedItemStoreUnitTest.php +++ b/tests/phpunit/unit/includes/watcheditem/NoWriteWatchedItemStoreUnitTest.php @@ -7,7 +7,7 @@ use MediaWiki\User\UserIdentityValue; * * @covers NoWriteWatchedItemStore */ -class NoWriteWatchedItemStoreUnitTest extends MediaWikiTestCase { +class NoWriteWatchedItemStoreUnitTest extends \MediaWikiUnitTestCase { public function testAddWatch() { /** @var WatchedItemStoreInterface|PHPUnit_Framework_MockObject_MockObject $innerService */ -- 2.20.1