From 06f645c453ebd1a3bbd065abd4f29e909f5656c7 Mon Sep 17 00:00:00 2001 From: Amir Sarabadani Date: Sat, 13 Jul 2019 22:50:28 +0200 Subject: [PATCH] Load GlobalFunctions.php to tests/phpunit/bootstrap.php That mostly enables testing global functions Bug: T87781 Change-Id: Ib42c56a67926ebcdba53f4c6c54a5bff98cb77a3 --- .phpcs.xml | 1 + tests/phpunit/bootstrap.php | 1 + .../includes/GlobalFunctions/wfAppendQueryTest.php | 2 +- .../includes/GlobalFunctions/wfArrayPlus2dTest.php | 2 +- .../includes/GlobalFunctions/wfAssembleUrlTest.php | 2 +- .../{ => unit}/includes/GlobalFunctions/wfBaseNameTest.php | 2 +- .../includes/GlobalFunctions/wfEscapeShellArgTest.php | 2 +- .../{ => unit}/includes/GlobalFunctions/wfGetCallerTest.php | 2 +- .../includes/GlobalFunctions/wfRemoveDotSegmentsTest.php | 2 +- .../includes/GlobalFunctions/wfShorthandToIntegerTest.php | 2 +- .../includes/GlobalFunctions/wfStringToBoolTest.php | 2 +- .../{ => unit}/includes/GlobalFunctions/wfTimestampTest.php | 2 +- .../{ => unit}/includes/GlobalFunctions/wfUrlencodeTest.php | 2 +- tests/phpunit/{ => unit}/includes/PathRouterTest.php | 2 +- .../{ => unit}/includes/Rest/ResponseFactoryTest.php | 4 ++-- .../includes/Revision/MainSlotRoleHandlerTest.php | 4 ++-- .../phpunit/{ => unit}/includes/Revision/SlotRecordTest.php | 4 ++-- .../{ => unit}/includes/TitleArrayFromResultTest.php | 4 +--- tests/phpunit/{ => unit}/includes/WikiReferenceTest.php | 4 +--- .../includes/debug/logger/monolog/CeeFormatterTest.php | 2 +- .../includes/diff/DifferenceEngineSlotDiffRendererTest.php | 2 +- .../{ => unit}/includes/diff/SlotDiffRendererTest.php | 2 +- .../includes/filerepo/FileBackendDBRepoWrapperTest.php | 2 +- .../{ => unit}/includes/filerepo/file/ForeignDBFileTest.php | 4 +--- .../{ => unit}/includes/htmlform/HTMLCheckMatrixTest.php | 2 +- tests/phpunit/{ => unit}/includes/json/FormatJsonTest.php | 2 +- .../{ => unit}/includes/media/JpegMetadataExtractorTest.php | 4 ++-- tests/phpunit/{ => unit}/includes/page/ArticleTest.php | 2 +- tests/phpunit/{ => unit}/includes/session/TokenTest.php | 4 ++-- .../{ => unit}/includes/shell/FirejailCommandTest.php | 4 +--- .../includes/site/MediaWikiPageNameNormalizerTest.php | 4 +--- .../{ => unit}/includes/utils/ZipDirectoryReaderTest.php | 6 ++---- 32 files changed, 38 insertions(+), 48 deletions(-) rename tests/phpunit/{ => unit}/includes/GlobalFunctions/wfAppendQueryTest.php (97%) rename tests/phpunit/{ => unit}/includes/GlobalFunctions/wfArrayPlus2dTest.php (96%) rename tests/phpunit/{ => unit}/includes/GlobalFunctions/wfAssembleUrlTest.php (97%) rename tests/phpunit/{ => unit}/includes/GlobalFunctions/wfBaseNameTest.php (94%) rename tests/phpunit/{ => unit}/includes/GlobalFunctions/wfEscapeShellArgTest.php (93%) rename tests/phpunit/{ => unit}/includes/GlobalFunctions/wfGetCallerTest.php (94%) rename tests/phpunit/{ => unit}/includes/GlobalFunctions/wfRemoveDotSegmentsTest.php (96%) rename tests/phpunit/{ => unit}/includes/GlobalFunctions/wfShorthandToIntegerTest.php (92%) rename tests/phpunit/{ => unit}/includes/GlobalFunctions/wfStringToBoolTest.php (93%) rename tests/phpunit/{ => unit}/includes/GlobalFunctions/wfTimestampTest.php (99%) rename tests/phpunit/{ => unit}/includes/GlobalFunctions/wfUrlencodeTest.php (98%) rename tests/phpunit/{ => unit}/includes/PathRouterTest.php (99%) rename tests/phpunit/{ => unit}/includes/Rest/ResponseFactoryTest.php (98%) rename tests/phpunit/{ => unit}/includes/Revision/MainSlotRoleHandlerTest.php (96%) rename tests/phpunit/{ => unit}/includes/Revision/SlotRecordTest.php (99%) rename tests/phpunit/{ => unit}/includes/TitleArrayFromResultTest.php (96%) rename tests/phpunit/{ => unit}/includes/WikiReferenceTest.php (97%) rename tests/phpunit/{ => unit}/includes/debug/logger/monolog/CeeFormatterTest.php (90%) rename tests/phpunit/{ => unit}/includes/diff/DifferenceEngineSlotDiffRendererTest.php (94%) rename tests/phpunit/{ => unit}/includes/diff/SlotDiffRendererTest.php (97%) rename tests/phpunit/{ => unit}/includes/filerepo/FileBackendDBRepoWrapperTest.php (98%) rename tests/phpunit/{ => unit}/includes/filerepo/file/ForeignDBFileTest.php (79%) rename tests/phpunit/{ => unit}/includes/htmlform/HTMLCheckMatrixTest.php (98%) rename tests/phpunit/{ => unit}/includes/json/FormatJsonTest.php (98%) rename tests/phpunit/{ => unit}/includes/media/JpegMetadataExtractorTest.php (97%) rename tests/phpunit/{ => unit}/includes/page/ArticleTest.php (96%) rename tests/phpunit/{ => unit}/includes/session/TokenTest.php (96%) rename tests/phpunit/{ => unit}/includes/shell/FirejailCommandTest.php (96%) rename tests/phpunit/{ => unit}/includes/site/MediaWikiPageNameNormalizerTest.php (97%) rename tests/phpunit/{ => unit}/includes/utils/ZipDirectoryReaderTest.php (94%) diff --git a/.phpcs.xml b/.phpcs.xml index 8f3bd8c527..9f11ebcf5c 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -179,6 +179,7 @@ */maintenance/storage/recompressTracked\.php */maintenance/storage/trackBlobs\.php + */tests/phpunit/unit/includes/GlobalFunctions/*\.php */tests/phpunit/includes/GlobalFunctions/*\.php */tests/phpunit/maintenance/*\.php */tests/phpunit/integration/includes/GlobalFunctions/*\.php diff --git a/tests/phpunit/bootstrap.php b/tests/phpunit/bootstrap.php index a7f0c09736..4400475bee 100644 --- a/tests/phpunit/bootstrap.php +++ b/tests/phpunit/bootstrap.php @@ -73,6 +73,7 @@ wfRequireOnceInGlobalScope( "$IP/includes/AutoLoader.php" ); wfRequireOnceInGlobalScope( "$IP/tests/common/TestsAutoLoader.php" ); wfRequireOnceInGlobalScope( "$IP/includes/Defines.php" ); wfRequireOnceInGlobalScope( "$IP/includes/DefaultSettings.php" ); +wfRequireOnceInGlobalScope( "$IP/includes/GlobalFunctions.php" ); // Load extensions/skins present in filesystem so that classes can be discovered. $directoryToJsonMap = [ diff --git a/tests/phpunit/includes/GlobalFunctions/wfAppendQueryTest.php b/tests/phpunit/unit/includes/GlobalFunctions/wfAppendQueryTest.php similarity index 97% rename from tests/phpunit/includes/GlobalFunctions/wfAppendQueryTest.php rename to tests/phpunit/unit/includes/GlobalFunctions/wfAppendQueryTest.php index bb71610b64..11d44758c6 100644 --- a/tests/phpunit/includes/GlobalFunctions/wfAppendQueryTest.php +++ b/tests/phpunit/unit/includes/GlobalFunctions/wfAppendQueryTest.php @@ -4,7 +4,7 @@ * @group GlobalFunctions * @covers ::wfAppendQuery */ -class WfAppendQueryTest extends MediaWikiTestCase { +class WfAppendQueryTest extends MediaWikiUnitTestCase { /** * @dataProvider provideAppendQuery */ diff --git a/tests/phpunit/includes/GlobalFunctions/wfArrayPlus2dTest.php b/tests/phpunit/unit/includes/GlobalFunctions/wfArrayPlus2dTest.php similarity index 96% rename from tests/phpunit/includes/GlobalFunctions/wfArrayPlus2dTest.php rename to tests/phpunit/unit/includes/GlobalFunctions/wfArrayPlus2dTest.php index 65b56ef4b3..9c3e56c0e8 100644 --- a/tests/phpunit/includes/GlobalFunctions/wfArrayPlus2dTest.php +++ b/tests/phpunit/unit/includes/GlobalFunctions/wfArrayPlus2dTest.php @@ -3,7 +3,7 @@ * @group GlobalFunctions * @covers ::wfArrayPlus2d */ -class WfArrayPlus2dTest extends MediaWikiTestCase { +class WfArrayPlus2dTest extends MediaWikiUnitTestCase { /** * @dataProvider provideArrays */ diff --git a/tests/phpunit/includes/GlobalFunctions/wfAssembleUrlTest.php b/tests/phpunit/unit/includes/GlobalFunctions/wfAssembleUrlTest.php similarity index 97% rename from tests/phpunit/includes/GlobalFunctions/wfAssembleUrlTest.php rename to tests/phpunit/unit/includes/GlobalFunctions/wfAssembleUrlTest.php index 7ddad369bd..f1f1986e5b 100644 --- a/tests/phpunit/includes/GlobalFunctions/wfAssembleUrlTest.php +++ b/tests/phpunit/unit/includes/GlobalFunctions/wfAssembleUrlTest.php @@ -3,7 +3,7 @@ * @group GlobalFunctions * @covers ::wfAssembleUrl */ -class WfAssembleUrlTest extends MediaWikiTestCase { +class WfAssembleUrlTest extends MediaWikiUnitTestCase { /** * @dataProvider provideURLParts */ diff --git a/tests/phpunit/includes/GlobalFunctions/wfBaseNameTest.php b/tests/phpunit/unit/includes/GlobalFunctions/wfBaseNameTest.php similarity index 94% rename from tests/phpunit/includes/GlobalFunctions/wfBaseNameTest.php rename to tests/phpunit/unit/includes/GlobalFunctions/wfBaseNameTest.php index 78e09e60ba..4d55fb77af 100644 --- a/tests/phpunit/includes/GlobalFunctions/wfBaseNameTest.php +++ b/tests/phpunit/unit/includes/GlobalFunctions/wfBaseNameTest.php @@ -3,7 +3,7 @@ * @group GlobalFunctions * @covers ::wfBaseName */ -class WfBaseNameTest extends MediaWikiTestCase { +class WfBaseNameTest extends MediaWikiUnitTestCase { /** * @dataProvider providePaths */ diff --git a/tests/phpunit/includes/GlobalFunctions/wfEscapeShellArgTest.php b/tests/phpunit/unit/includes/GlobalFunctions/wfEscapeShellArgTest.php similarity index 93% rename from tests/phpunit/includes/GlobalFunctions/wfEscapeShellArgTest.php rename to tests/phpunit/unit/includes/GlobalFunctions/wfEscapeShellArgTest.php index 7402054ea4..d86b3979b5 100644 --- a/tests/phpunit/includes/GlobalFunctions/wfEscapeShellArgTest.php +++ b/tests/phpunit/unit/includes/GlobalFunctions/wfEscapeShellArgTest.php @@ -4,7 +4,7 @@ * @group GlobalFunctions * @covers ::wfEscapeShellArg */ -class WfEscapeShellArgTest extends MediaWikiTestCase { +class WfEscapeShellArgTest extends MediaWikiUnitTestCase { public function testSingleInput() { if ( wfIsWindows() ) { $expected = '"blah"'; diff --git a/tests/phpunit/includes/GlobalFunctions/wfGetCallerTest.php b/tests/phpunit/unit/includes/GlobalFunctions/wfGetCallerTest.php similarity index 94% rename from tests/phpunit/includes/GlobalFunctions/wfGetCallerTest.php rename to tests/phpunit/unit/includes/GlobalFunctions/wfGetCallerTest.php index 8a7bfa5a8c..ae397d532b 100644 --- a/tests/phpunit/includes/GlobalFunctions/wfGetCallerTest.php +++ b/tests/phpunit/unit/includes/GlobalFunctions/wfGetCallerTest.php @@ -4,7 +4,7 @@ * @group GlobalFunctions * @covers ::wfGetCaller */ -class WfGetCallerTest extends MediaWikiTestCase { +class WfGetCallerTest extends MediaWikiUnitTestCase { public function testZero() { $this->assertEquals( 'WfGetCallerTest->testZero', wfGetCaller( 1 ) ); } diff --git a/tests/phpunit/includes/GlobalFunctions/wfRemoveDotSegmentsTest.php b/tests/phpunit/unit/includes/GlobalFunctions/wfRemoveDotSegmentsTest.php similarity index 96% rename from tests/phpunit/includes/GlobalFunctions/wfRemoveDotSegmentsTest.php rename to tests/phpunit/unit/includes/GlobalFunctions/wfRemoveDotSegmentsTest.php index eae5588b94..199fa21eca 100644 --- a/tests/phpunit/includes/GlobalFunctions/wfRemoveDotSegmentsTest.php +++ b/tests/phpunit/unit/includes/GlobalFunctions/wfRemoveDotSegmentsTest.php @@ -4,7 +4,7 @@ * @group GlobalFunctions * @covers ::wfRemoveDotSegments */ -class WfRemoveDotSegmentsTest extends MediaWikiTestCase { +class WfRemoveDotSegmentsTest extends MediaWikiUnitTestCase { /** * @dataProvider providePaths */ diff --git a/tests/phpunit/includes/GlobalFunctions/wfShorthandToIntegerTest.php b/tests/phpunit/unit/includes/GlobalFunctions/wfShorthandToIntegerTest.php similarity index 92% rename from tests/phpunit/includes/GlobalFunctions/wfShorthandToIntegerTest.php rename to tests/phpunit/unit/includes/GlobalFunctions/wfShorthandToIntegerTest.php index 40b2e636c9..c2d1f4ab94 100644 --- a/tests/phpunit/includes/GlobalFunctions/wfShorthandToIntegerTest.php +++ b/tests/phpunit/unit/includes/GlobalFunctions/wfShorthandToIntegerTest.php @@ -4,7 +4,7 @@ * @group GlobalFunctions * @covers ::wfShorthandToInteger */ -class WfShorthandToIntegerTest extends MediaWikiTestCase { +class WfShorthandToIntegerTest extends MediaWikiUnitTestCase { /** * @dataProvider provideABunchOfShorthands */ diff --git a/tests/phpunit/includes/GlobalFunctions/wfStringToBoolTest.php b/tests/phpunit/unit/includes/GlobalFunctions/wfStringToBoolTest.php similarity index 93% rename from tests/phpunit/includes/GlobalFunctions/wfStringToBoolTest.php rename to tests/phpunit/unit/includes/GlobalFunctions/wfStringToBoolTest.php index 7f56b60529..b99d695ffc 100644 --- a/tests/phpunit/includes/GlobalFunctions/wfStringToBoolTest.php +++ b/tests/phpunit/unit/includes/GlobalFunctions/wfStringToBoolTest.php @@ -4,7 +4,7 @@ * @group GlobalFunctions * @covers ::wfStringToBool */ -class WfStringToBoolTest extends MediaWikiTestCase { +class WfStringToBoolTest extends MediaWikiUnitTestCase { public function getTestCases() { return [ diff --git a/tests/phpunit/includes/GlobalFunctions/wfTimestampTest.php b/tests/phpunit/unit/includes/GlobalFunctions/wfTimestampTest.php similarity index 99% rename from tests/phpunit/includes/GlobalFunctions/wfTimestampTest.php rename to tests/phpunit/unit/includes/GlobalFunctions/wfTimestampTest.php index a70f136a1c..94347bd19a 100644 --- a/tests/phpunit/includes/GlobalFunctions/wfTimestampTest.php +++ b/tests/phpunit/unit/includes/GlobalFunctions/wfTimestampTest.php @@ -4,7 +4,7 @@ * @group GlobalFunctions * @covers ::wfTimestamp */ -class WfTimestampTest extends MediaWikiTestCase { +class WfTimestampTest extends MediaWikiUnitTestCase { /** * @dataProvider provideNormalTimestamps */ diff --git a/tests/phpunit/includes/GlobalFunctions/wfUrlencodeTest.php b/tests/phpunit/unit/includes/GlobalFunctions/wfUrlencodeTest.php similarity index 98% rename from tests/phpunit/includes/GlobalFunctions/wfUrlencodeTest.php rename to tests/phpunit/unit/includes/GlobalFunctions/wfUrlencodeTest.php index f9735c1ab1..2fc038c268 100644 --- a/tests/phpunit/includes/GlobalFunctions/wfUrlencodeTest.php +++ b/tests/phpunit/unit/includes/GlobalFunctions/wfUrlencodeTest.php @@ -6,7 +6,7 @@ * @group GlobalFunctions * @covers ::wfUrlencode */ -class WfUrlencodeTest extends MediaWikiTestCase { +class WfUrlencodeTest extends MediaWikiUnitTestCase { # ### TESTS ############################################################## /** diff --git a/tests/phpunit/includes/PathRouterTest.php b/tests/phpunit/unit/includes/PathRouterTest.php similarity index 99% rename from tests/phpunit/includes/PathRouterTest.php rename to tests/phpunit/unit/includes/PathRouterTest.php index d8916751c0..fb23706150 100644 --- a/tests/phpunit/includes/PathRouterTest.php +++ b/tests/phpunit/unit/includes/PathRouterTest.php @@ -5,7 +5,7 @@ * * @covers PathRouter */ -class PathRouterTest extends MediaWikiTestCase { +class PathRouterTest extends MediaWikiUnitTestCase { /** * @var PathRouter diff --git a/tests/phpunit/includes/Rest/ResponseFactoryTest.php b/tests/phpunit/unit/includes/Rest/ResponseFactoryTest.php similarity index 98% rename from tests/phpunit/includes/Rest/ResponseFactoryTest.php rename to tests/phpunit/unit/includes/Rest/ResponseFactoryTest.php index ae71272f6b..04d54de899 100644 --- a/tests/phpunit/includes/Rest/ResponseFactoryTest.php +++ b/tests/phpunit/unit/includes/Rest/ResponseFactoryTest.php @@ -5,10 +5,10 @@ namespace MediaWiki\Tests\Rest; use ArrayIterator; use MediaWiki\Rest\HttpException; use MediaWiki\Rest\ResponseFactory; -use MediaWikiTestCase; +use MediaWikiUnitTestCase; /** @covers \MediaWiki\Rest\ResponseFactory */ -class ResponseFactoryTest extends MediaWikiTestCase { +class ResponseFactoryTest extends MediaWikiUnitTestCase { public static function provideEncodeJson() { return [ [ (object)[], '{}' ], diff --git a/tests/phpunit/includes/Revision/MainSlotRoleHandlerTest.php b/tests/phpunit/unit/includes/Revision/MainSlotRoleHandlerTest.php similarity index 96% rename from tests/phpunit/includes/Revision/MainSlotRoleHandlerTest.php rename to tests/phpunit/unit/includes/Revision/MainSlotRoleHandlerTest.php index 5e32574d40..9dff2cc500 100644 --- a/tests/phpunit/includes/Revision/MainSlotRoleHandlerTest.php +++ b/tests/phpunit/unit/includes/Revision/MainSlotRoleHandlerTest.php @@ -3,14 +3,14 @@ namespace MediaWiki\Tests\Revision; use MediaWiki\Revision\MainSlotRoleHandler; -use MediaWikiTestCase; +use MediaWikiUnitTestCase; use PHPUnit\Framework\MockObject\MockObject; use Title; /** * @covers \MediaWiki\Revision\MainSlotRoleHandler */ -class MainSlotRoleHandlerTest extends MediaWikiTestCase { +class MainSlotRoleHandlerTest extends MediaWikiUnitTestCase { private function makeTitleObject( $ns ) { /** @var Title|MockObject $title */ diff --git a/tests/phpunit/includes/Revision/SlotRecordTest.php b/tests/phpunit/unit/includes/Revision/SlotRecordTest.php similarity index 99% rename from tests/phpunit/includes/Revision/SlotRecordTest.php rename to tests/phpunit/unit/includes/Revision/SlotRecordTest.php index 6495967ff4..aab430aaa6 100644 --- a/tests/phpunit/includes/Revision/SlotRecordTest.php +++ b/tests/phpunit/unit/includes/Revision/SlotRecordTest.php @@ -7,13 +7,13 @@ use LogicException; use MediaWiki\Revision\IncompleteRevisionException; use MediaWiki\Revision\SlotRecord; use MediaWiki\Revision\SuppressedDataException; -use MediaWikiTestCase; +use MediaWikiUnitTestCase; use WikitextContent; /** * @covers \MediaWiki\Revision\SlotRecord */ -class SlotRecordTest extends MediaWikiTestCase { +class SlotRecordTest extends MediaWikiUnitTestCase { private function makeRow( $data = [] ) { $data = $data + [ diff --git a/tests/phpunit/includes/TitleArrayFromResultTest.php b/tests/phpunit/unit/includes/TitleArrayFromResultTest.php similarity index 96% rename from tests/phpunit/includes/TitleArrayFromResultTest.php rename to tests/phpunit/unit/includes/TitleArrayFromResultTest.php index 32c757101a..10b7d36c66 100644 --- a/tests/phpunit/includes/TitleArrayFromResultTest.php +++ b/tests/phpunit/unit/includes/TitleArrayFromResultTest.php @@ -4,9 +4,7 @@ * @author Addshore * @covers TitleArrayFromResult */ -class TitleArrayFromResultTest extends PHPUnit\Framework\TestCase { - - use MediaWikiCoversValidator; +class TitleArrayFromResultTest extends MediaWikiUnitTestCase { private function getMockResultWrapper( $row = null, $numRows = 1 ) { $resultWrapper = $this->getMockBuilder( Wikimedia\Rdbms\ResultWrapper::class ) diff --git a/tests/phpunit/includes/WikiReferenceTest.php b/tests/phpunit/unit/includes/WikiReferenceTest.php similarity index 97% rename from tests/phpunit/includes/WikiReferenceTest.php rename to tests/phpunit/unit/includes/WikiReferenceTest.php index e4b21ce5ac..a4aae86c0f 100644 --- a/tests/phpunit/includes/WikiReferenceTest.php +++ b/tests/phpunit/unit/includes/WikiReferenceTest.php @@ -3,9 +3,7 @@ /** * @covers WikiReference */ -class WikiReferenceTest extends PHPUnit\Framework\TestCase { - - use MediaWikiCoversValidator; +class WikiReferenceTest extends MediaWikiUnitTestCase { public function provideGetDisplayName() { return [ diff --git a/tests/phpunit/includes/debug/logger/monolog/CeeFormatterTest.php b/tests/phpunit/unit/includes/debug/logger/monolog/CeeFormatterTest.php similarity index 90% rename from tests/phpunit/includes/debug/logger/monolog/CeeFormatterTest.php rename to tests/phpunit/unit/includes/debug/logger/monolog/CeeFormatterTest.php index b30c7a4c92..946a1a274d 100644 --- a/tests/phpunit/includes/debug/logger/monolog/CeeFormatterTest.php +++ b/tests/phpunit/unit/includes/debug/logger/monolog/CeeFormatterTest.php @@ -8,7 +8,7 @@ namespace MediaWiki\Logger\Monolog; * @group Broken * @covers \MediaWiki\Logger\Monolog\CeeFormatter */ -class CeeFormatterTest extends \PHPUnit\Framework\TestCase { +class CeeFormatterTest extends \MediaWikiUnitTestCase { public function testV1() { $ls_formatter = new LogstashFormatter( 'app', 'system', null, 'ctx_', LogstashFormatter::V1 ); $cee_formatter = new CeeFormatter( 'app', 'system', null, 'ctx_', LogstashFormatter::V1 ); diff --git a/tests/phpunit/includes/diff/DifferenceEngineSlotDiffRendererTest.php b/tests/phpunit/unit/includes/diff/DifferenceEngineSlotDiffRendererTest.php similarity index 94% rename from tests/phpunit/includes/diff/DifferenceEngineSlotDiffRendererTest.php rename to tests/phpunit/unit/includes/diff/DifferenceEngineSlotDiffRendererTest.php index fe129b751a..1a8b58590a 100644 --- a/tests/phpunit/includes/diff/DifferenceEngineSlotDiffRendererTest.php +++ b/tests/phpunit/unit/includes/diff/DifferenceEngineSlotDiffRendererTest.php @@ -3,7 +3,7 @@ /** * @covers DifferenceEngineSlotDiffRenderer */ -class DifferenceEngineSlotDiffRendererTest extends \PHPUnit\Framework\TestCase { +class DifferenceEngineSlotDiffRendererTest extends \MediaWikiUnitTestCase { public function testGetDiff() { $differenceEngine = new CustomDifferenceEngine(); diff --git a/tests/phpunit/includes/diff/SlotDiffRendererTest.php b/tests/phpunit/unit/includes/diff/SlotDiffRendererTest.php similarity index 97% rename from tests/phpunit/includes/diff/SlotDiffRendererTest.php rename to tests/phpunit/unit/includes/diff/SlotDiffRendererTest.php index a03280ddb2..f778115780 100644 --- a/tests/phpunit/includes/diff/SlotDiffRendererTest.php +++ b/tests/phpunit/unit/includes/diff/SlotDiffRendererTest.php @@ -6,7 +6,7 @@ use Wikimedia\TestingAccessWrapper; /** * @covers SlotDiffRenderer */ -class SlotDiffRendererTest extends \PHPUnit\Framework\TestCase { +class SlotDiffRendererTest extends \MediaWikiUnitTestCase { /** * @dataProvider provideNormalizeContents diff --git a/tests/phpunit/includes/filerepo/FileBackendDBRepoWrapperTest.php b/tests/phpunit/unit/includes/filerepo/FileBackendDBRepoWrapperTest.php similarity index 98% rename from tests/phpunit/includes/filerepo/FileBackendDBRepoWrapperTest.php rename to tests/phpunit/unit/includes/filerepo/FileBackendDBRepoWrapperTest.php index 346be7afa3..6084601b05 100644 --- a/tests/phpunit/includes/filerepo/FileBackendDBRepoWrapperTest.php +++ b/tests/phpunit/unit/includes/filerepo/FileBackendDBRepoWrapperTest.php @@ -1,6 +1,6 @@ [ 'r1', 'r2' ], 'columns' => [ 'c1', 'c2' ], diff --git a/tests/phpunit/includes/json/FormatJsonTest.php b/tests/phpunit/unit/includes/json/FormatJsonTest.php similarity index 98% rename from tests/phpunit/includes/json/FormatJsonTest.php rename to tests/phpunit/unit/includes/json/FormatJsonTest.php index 1a99775833..94c7d91457 100644 --- a/tests/phpunit/includes/json/FormatJsonTest.php +++ b/tests/phpunit/unit/includes/json/FormatJsonTest.php @@ -3,7 +3,7 @@ /** * @covers FormatJson */ -class FormatJsonTest extends MediaWikiTestCase { +class FormatJsonTest extends MediaWikiUnitTestCase { /** * Test data for testParseTryFixing. diff --git a/tests/phpunit/includes/media/JpegMetadataExtractorTest.php b/tests/phpunit/unit/includes/media/JpegMetadataExtractorTest.php similarity index 97% rename from tests/phpunit/includes/media/JpegMetadataExtractorTest.php rename to tests/phpunit/unit/includes/media/JpegMetadataExtractorTest.php index c943cef906..365c140405 100644 --- a/tests/phpunit/includes/media/JpegMetadataExtractorTest.php +++ b/tests/phpunit/unit/includes/media/JpegMetadataExtractorTest.php @@ -9,14 +9,14 @@ * @group Media * @covers JpegMetadataExtractor */ -class JpegMetadataExtractorTest extends MediaWikiTestCase { +class JpegMetadataExtractorTest extends MediaWikiUnitTestCase { protected $filePath; protected function setUp() { parent::setUp(); - $this->filePath = __DIR__ . '/../../data/media/'; + $this->filePath = __DIR__ . '/../../../data/media/'; } /** diff --git a/tests/phpunit/includes/page/ArticleTest.php b/tests/phpunit/unit/includes/page/ArticleTest.php similarity index 96% rename from tests/phpunit/includes/page/ArticleTest.php rename to tests/phpunit/unit/includes/page/ArticleTest.php index df4a281701..9995793806 100644 --- a/tests/phpunit/includes/page/ArticleTest.php +++ b/tests/phpunit/unit/includes/page/ArticleTest.php @@ -1,6 +1,6 @@ getMockBuilder( Token::class ) diff --git a/tests/phpunit/includes/shell/FirejailCommandTest.php b/tests/phpunit/unit/includes/shell/FirejailCommandTest.php similarity index 96% rename from tests/phpunit/includes/shell/FirejailCommandTest.php rename to tests/phpunit/unit/includes/shell/FirejailCommandTest.php index 681c3dcda0..e3a3b86b24 100644 --- a/tests/phpunit/includes/shell/FirejailCommandTest.php +++ b/tests/phpunit/unit/includes/shell/FirejailCommandTest.php @@ -23,9 +23,7 @@ use MediaWiki\Shell\FirejailCommand; use MediaWiki\Shell\Shell; use Wikimedia\TestingAccessWrapper; -class FirejailCommandTest extends PHPUnit\Framework\TestCase { - - use MediaWikiCoversValidator; +class FirejailCommandTest extends MediaWikiUnitTestCase { public function provideBuildFinalCommand() { global $IP; diff --git a/tests/phpunit/includes/site/MediaWikiPageNameNormalizerTest.php b/tests/phpunit/unit/includes/site/MediaWikiPageNameNormalizerTest.php similarity index 97% rename from tests/phpunit/includes/site/MediaWikiPageNameNormalizerTest.php rename to tests/phpunit/unit/includes/site/MediaWikiPageNameNormalizerTest.php index 15894a3d9a..d426306e3f 100644 --- a/tests/phpunit/includes/site/MediaWikiPageNameNormalizerTest.php +++ b/tests/phpunit/unit/includes/site/MediaWikiPageNameNormalizerTest.php @@ -27,9 +27,7 @@ use MediaWiki\Site\MediaWikiPageNameNormalizer; * * @author Marius Hoch */ -class MediaWikiPageNameNormalizerTest extends PHPUnit\Framework\TestCase { - - use MediaWikiCoversValidator; +class MediaWikiPageNameNormalizerTest extends MediaWikiUnitTestCase { /** * @dataProvider normalizePageTitleProvider diff --git a/tests/phpunit/includes/utils/ZipDirectoryReaderTest.php b/tests/phpunit/unit/includes/utils/ZipDirectoryReaderTest.php similarity index 94% rename from tests/phpunit/includes/utils/ZipDirectoryReaderTest.php rename to tests/phpunit/unit/includes/utils/ZipDirectoryReaderTest.php index a1a3fd7309..be7e224e03 100644 --- a/tests/phpunit/includes/utils/ZipDirectoryReaderTest.php +++ b/tests/phpunit/unit/includes/utils/ZipDirectoryReaderTest.php @@ -4,16 +4,14 @@ * @covers ZipDirectoryReader * NOTE: this test is more like an integration test than a unit test */ -class ZipDirectoryReaderTest extends PHPUnit\Framework\TestCase { - - use MediaWikiCoversValidator; +class ZipDirectoryReaderTest extends MediaWikiUnitTestCase { protected $zipDir; protected $entries; protected function setUp() { parent::setUp(); - $this->zipDir = __DIR__ . '/../../data/zip'; + $this->zipDir = __DIR__ . '/../../../data/zip'; } function zipCallback( $entry ) { -- 2.20.1