Follows-upb36d883. By far most data providers are static (and PHPUnit expects them to be static and calls them that way). Most of these classes already had their data providers static but additional commits sloppily introduced non-static ones. * ResourceLoaderWikiModuleTest,8968d8787f. * TitleTest,545f1d3a73. Odd unused method 'dataTestIsValidMoveOperation' was introduced in550b878e63. * GlobalVarConfigTest,a3e18c3670. Change-Id: I5da99f7cd3da68c550ae507ffe1f725d31e7666f
67 lines
1.6 KiB
PHP
67 lines
1.6 KiB
PHP
<?php
|
|
|
|
class ResourceLoaderWikiModuleTest extends ResourceLoaderTestCase {
|
|
|
|
/**
|
|
* @covers ResourceLoaderWikiModule::isKnownEmpty
|
|
* @dataProvider provideIsKnownEmpty
|
|
*/
|
|
public function testIsKnownEmpty( $titleInfo, $group, $expected ) {
|
|
$module = $this->getMockBuilder( 'ResourceLoaderWikiModuleTestModule' )
|
|
->setMethods( array( 'getTitleInfo', 'getGroup' ) )
|
|
->getMock();
|
|
$module->expects( $this->any() )
|
|
->method( 'getTitleInfo' )
|
|
->will( $this->returnValue( $titleInfo ) );
|
|
$module->expects( $this->any() )
|
|
->method( 'getGroup' )
|
|
->will( $this->returnValue( $group ) );
|
|
$context = $this->getMockBuilder( 'ResourceLoaderContext' )
|
|
->disableOriginalConstructor()
|
|
->getMock();
|
|
$this->assertEquals( $expected, $module->isKnownEmpty( $context ) );
|
|
}
|
|
|
|
public static function provideIsKnownEmpty() {
|
|
return array(
|
|
// No valid pages
|
|
array( array(), 'test1', true ),
|
|
// 'site' module with a non-empty page
|
|
array(
|
|
array(
|
|
'MediaWiki:Common.js' => array(
|
|
'timestamp' => 123456789,
|
|
'length' => 1234
|
|
)
|
|
), 'site', false,
|
|
),
|
|
// 'site' module with an empty page
|
|
array(
|
|
array(
|
|
'MediaWiki:Monobook.js' => array(
|
|
'timestamp' => 987654321,
|
|
'length' => 0,
|
|
),
|
|
), 'site', false,
|
|
),
|
|
// 'user' module with a non-empty page
|
|
array(
|
|
array(
|
|
'User:FooBar/common.js' => array(
|
|
'timestamp' => 246813579,
|
|
'length' => 25,
|
|
),
|
|
), 'user', false,
|
|
),
|
|
// 'user' module with an empty page
|
|
array(
|
|
array(
|
|
'User:FooBar/monobook.js' => array(
|
|
'timestamp' => 1357924680,
|
|
'length' => 0,
|
|
),
|
|
), 'user', true,
|
|
),
|
|
);
|
|
}
|
|
}
|