MediaWiki
REL1_24
|
00001 <?php 00002 00003 class ResourceLoaderWikiModuleTest extends ResourceLoaderTestCase { 00004 00009 public function testIsKnownEmpty( $titleInfo, $group, $expected ) { 00010 $module = $this->getMockBuilder( 'ResourceLoaderWikiModuleTestModule' ) 00011 ->setMethods( array( 'getTitleInfo', 'getGroup' ) ) 00012 ->getMock(); 00013 $module->expects( $this->any() ) 00014 ->method( 'getTitleInfo' ) 00015 ->will( $this->returnValue( $titleInfo ) ); 00016 $module->expects( $this->any() ) 00017 ->method( 'getGroup' ) 00018 ->will( $this->returnValue( $group ) ); 00019 $context = $this->getMockBuilder( 'ResourceLoaderContext' ) 00020 ->disableOriginalConstructor() 00021 ->getMock(); 00022 $this->assertEquals( $expected, $module->isKnownEmpty( $context ) ); 00023 } 00024 00025 public static function provideIsKnownEmpty() { 00026 return array( 00027 // No valid pages 00028 array( array(), 'test1', true ), 00029 // 'site' module with a non-empty page 00030 array( 00031 array( 00032 'MediaWiki:Common.js' => array( 00033 'timestamp' => 123456789, 00034 'length' => 1234 00035 ) 00036 ), 'site', false, 00037 ), 00038 // 'site' module with an empty page 00039 array( 00040 array( 00041 'MediaWiki:Monobook.js' => array( 00042 'timestamp' => 987654321, 00043 'length' => 0, 00044 ), 00045 ), 'site', false, 00046 ), 00047 // 'user' module with a non-empty page 00048 array( 00049 array( 00050 'User:FooBar/common.js' => array( 00051 'timestamp' => 246813579, 00052 'length' => 25, 00053 ), 00054 ), 'user', false, 00055 ), 00056 // 'user' module with an empty page 00057 array( 00058 array( 00059 'User:FooBar/monobook.js' => array( 00060 'timestamp' => 1357924680, 00061 'length' => 0, 00062 ), 00063 ), 'user', true, 00064 ), 00065 ); 00066 } 00067 }