MediaWiki  REL1_24
LBFactoryTest.php
Go to the documentation of this file.
00001 <?php
00027 class LBFactoryTest extends MediaWikiTestCase {
00028 
00032     public function testGetLBFactoryClass( $expected, $deprecated ) {
00033         $mockDB = $this->getMockBuilder( 'DatabaseMysql' )
00034             ->disableOriginalConstructor()
00035             ->getMock();
00036 
00037         $config = array(
00038             'class'          => $deprecated,
00039             'connection'     => $mockDB,
00040             # Various other parameters required:
00041             'sectionsByDB'   => array(),
00042             'sectionLoads'   => array(),
00043             'serverTemplate' => array(),
00044         );
00045 
00046         $this->hideDeprecated( '$wgLBFactoryConf must be updated. See RELEASE-NOTES for details' );
00047         $result = LBFactory::getLBFactoryClass( $config );
00048 
00049         $this->assertEquals( $expected, $result );
00050     }
00051 
00052     public function getLBFactoryClassProvider() {
00053         return array(
00054             # Format: new class, old class
00055             array( 'LBFactorySimple', 'LBFactory_Simple' ),
00056             array( 'LBFactorySingle', 'LBFactory_Single' ),
00057             array( 'LBFactoryMulti', 'LBFactory_Multi' ),
00058             array( 'LBFactoryFake', 'LBFactory_Fake' ),
00059         );
00060     }
00061 }