Load GlobalFunctions.php to tests/phpunit/bootstrap.php
That mostly enables testing global functions Bug: T87781 Change-Id: Ib42c56a67926ebcdba53f4c6c54a5bff98cb77a3
This commit is contained in:
parent
3fda59f962
commit
06f645c453
32 changed files with 38 additions and 48 deletions
|
|
@ -179,6 +179,7 @@
|
|||
<exclude-pattern>*/maintenance/storage/recompressTracked\.php</exclude-pattern>
|
||||
<exclude-pattern>*/maintenance/storage/trackBlobs\.php</exclude-pattern>
|
||||
<!-- Skip violations in some tests for now -->
|
||||
<exclude-pattern>*/tests/phpunit/unit/includes/GlobalFunctions/*\.php</exclude-pattern>
|
||||
<exclude-pattern>*/tests/phpunit/includes/GlobalFunctions/*\.php</exclude-pattern>
|
||||
<exclude-pattern>*/tests/phpunit/maintenance/*\.php</exclude-pattern>
|
||||
<exclude-pattern>*/tests/phpunit/integration/includes/GlobalFunctions/*\.php</exclude-pattern>
|
||||
|
|
|
|||
|
|
@ -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 = [
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* @group GlobalFunctions
|
||||
* @covers ::wfAppendQuery
|
||||
*/
|
||||
class WfAppendQueryTest extends MediaWikiTestCase {
|
||||
class WfAppendQueryTest extends MediaWikiUnitTestCase {
|
||||
/**
|
||||
* @dataProvider provideAppendQuery
|
||||
*/
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
* @group GlobalFunctions
|
||||
* @covers ::wfArrayPlus2d
|
||||
*/
|
||||
class WfArrayPlus2dTest extends MediaWikiTestCase {
|
||||
class WfArrayPlus2dTest extends MediaWikiUnitTestCase {
|
||||
/**
|
||||
* @dataProvider provideArrays
|
||||
*/
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
* @group GlobalFunctions
|
||||
* @covers ::wfAssembleUrl
|
||||
*/
|
||||
class WfAssembleUrlTest extends MediaWikiTestCase {
|
||||
class WfAssembleUrlTest extends MediaWikiUnitTestCase {
|
||||
/**
|
||||
* @dataProvider provideURLParts
|
||||
*/
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
* @group GlobalFunctions
|
||||
* @covers ::wfBaseName
|
||||
*/
|
||||
class WfBaseNameTest extends MediaWikiTestCase {
|
||||
class WfBaseNameTest extends MediaWikiUnitTestCase {
|
||||
/**
|
||||
* @dataProvider providePaths
|
||||
*/
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
* @group GlobalFunctions
|
||||
* @covers ::wfEscapeShellArg
|
||||
*/
|
||||
class WfEscapeShellArgTest extends MediaWikiTestCase {
|
||||
class WfEscapeShellArgTest extends MediaWikiUnitTestCase {
|
||||
public function testSingleInput() {
|
||||
if ( wfIsWindows() ) {
|
||||
$expected = '"blah"';
|
||||
|
|
@ -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 ) );
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
* @group GlobalFunctions
|
||||
* @covers ::wfRemoveDotSegments
|
||||
*/
|
||||
class WfRemoveDotSegmentsTest extends MediaWikiTestCase {
|
||||
class WfRemoveDotSegmentsTest extends MediaWikiUnitTestCase {
|
||||
/**
|
||||
* @dataProvider providePaths
|
||||
*/
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
* @group GlobalFunctions
|
||||
* @covers ::wfShorthandToInteger
|
||||
*/
|
||||
class WfShorthandToIntegerTest extends MediaWikiTestCase {
|
||||
class WfShorthandToIntegerTest extends MediaWikiUnitTestCase {
|
||||
/**
|
||||
* @dataProvider provideABunchOfShorthands
|
||||
*/
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
* @group GlobalFunctions
|
||||
* @covers ::wfStringToBool
|
||||
*/
|
||||
class WfStringToBoolTest extends MediaWikiTestCase {
|
||||
class WfStringToBoolTest extends MediaWikiUnitTestCase {
|
||||
|
||||
public function getTestCases() {
|
||||
return [
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
* @group GlobalFunctions
|
||||
* @covers ::wfTimestamp
|
||||
*/
|
||||
class WfTimestampTest extends MediaWikiTestCase {
|
||||
class WfTimestampTest extends MediaWikiUnitTestCase {
|
||||
/**
|
||||
* @dataProvider provideNormalTimestamps
|
||||
*/
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
* @group GlobalFunctions
|
||||
* @covers ::wfUrlencode
|
||||
*/
|
||||
class WfUrlencodeTest extends MediaWikiTestCase {
|
||||
class WfUrlencodeTest extends MediaWikiUnitTestCase {
|
||||
# ### TESTS ##############################################################
|
||||
|
||||
/**
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
*
|
||||
* @covers PathRouter
|
||||
*/
|
||||
class PathRouterTest extends MediaWikiTestCase {
|
||||
class PathRouterTest extends MediaWikiUnitTestCase {
|
||||
|
||||
/**
|
||||
* @var PathRouter
|
||||
|
|
@ -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)[], '{}' ],
|
||||
|
|
@ -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 */
|
||||
|
|
@ -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 + [
|
||||
|
|
@ -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 )
|
||||
|
|
@ -3,9 +3,7 @@
|
|||
/**
|
||||
* @covers WikiReference
|
||||
*/
|
||||
class WikiReferenceTest extends PHPUnit\Framework\TestCase {
|
||||
|
||||
use MediaWikiCoversValidator;
|
||||
class WikiReferenceTest extends MediaWikiUnitTestCase {
|
||||
|
||||
public function provideGetDisplayName() {
|
||||
return [
|
||||
|
|
@ -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 );
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
* @covers DifferenceEngineSlotDiffRenderer
|
||||
*/
|
||||
class DifferenceEngineSlotDiffRendererTest extends \PHPUnit\Framework\TestCase {
|
||||
class DifferenceEngineSlotDiffRendererTest extends \MediaWikiUnitTestCase {
|
||||
|
||||
public function testGetDiff() {
|
||||
$differenceEngine = new CustomDifferenceEngine();
|
||||
|
|
@ -6,7 +6,7 @@ use Wikimedia\TestingAccessWrapper;
|
|||
/**
|
||||
* @covers SlotDiffRenderer
|
||||
*/
|
||||
class SlotDiffRendererTest extends \PHPUnit\Framework\TestCase {
|
||||
class SlotDiffRendererTest extends \MediaWikiUnitTestCase {
|
||||
|
||||
/**
|
||||
* @dataProvider provideNormalizeContents
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
class FileBackendDBRepoWrapperTest extends MediaWikiTestCase {
|
||||
class FileBackendDBRepoWrapperTest extends MediaWikiUnitTestCase {
|
||||
protected $backendName = 'foo-backend';
|
||||
protected $repoName = 'pureTestRepo';
|
||||
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
|
||||
/** @covers ForeignDBFile */
|
||||
class ForeignDBFileTest extends \PHPUnit\Framework\TestCase {
|
||||
|
||||
use PHPUnit4And6Compat;
|
||||
class ForeignDBFileTest extends \MediaWikiUnitTestCase {
|
||||
|
||||
public function testShouldConstructCorrectInstanceFromTitle() {
|
||||
$title = Title::makeTitle( NS_FILE, 'Awesome_file' );
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
* @covers HTMLCheckMatrix
|
||||
*/
|
||||
class HTMLCheckMatrixTest extends MediaWikiTestCase {
|
||||
class HTMLCheckMatrixTest extends MediaWikiUnitTestCase {
|
||||
private static $defaultOptions = [
|
||||
'rows' => [ 'r1', 'r2' ],
|
||||
'columns' => [ 'c1', 'c2' ],
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
* @covers FormatJson
|
||||
*/
|
||||
class FormatJsonTest extends MediaWikiTestCase {
|
||||
class FormatJsonTest extends MediaWikiUnitTestCase {
|
||||
|
||||
/**
|
||||
* Test data for testParseTryFixing.
|
||||
|
|
@ -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/';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
class ArticleTest extends MediaWikiTestCase {
|
||||
class ArticleTest extends MediaWikiUnitTestCase {
|
||||
|
||||
/**
|
||||
* @var Title
|
||||
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
namespace MediaWiki\Session;
|
||||
|
||||
use MediaWikiTestCase;
|
||||
use MediaWikiUnitTestCase;
|
||||
use Wikimedia\TestingAccessWrapper;
|
||||
|
||||
/**
|
||||
* @group Session
|
||||
* @covers MediaWiki\Session\Token
|
||||
*/
|
||||
class TokenTest extends MediaWikiTestCase {
|
||||
class TokenTest extends MediaWikiUnitTestCase {
|
||||
|
||||
public function testBasics() {
|
||||
$token = $this->getMockBuilder( Token::class )
|
||||
|
|
@ -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;
|
||||
|
|
@ -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
|
||||
|
|
@ -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 ) {
|
||||
Loading…
Reference in a new issue