getMockBuilder( 'DatabaseMysql' ) -> disableOriginalConstructor() ->getMock(); $this->setMwGlobals( 'wgLBFactoryConf', array( 'class' => $deprecated, 'connection' => $mockDB, # Various other parameters required: 'sectionsByDB' => array(), 'sectionLoads' => array(), 'serverTemplate' => array(), ) ); global $wgLBFactoryConf; $this->assertArrayHasKey( 'class', $wgLBFactoryConf ); $this->assertEquals( $wgLBFactoryConf['class'], $deprecated ); # The point of this test is to call a deprecated interface and make # sure it keeps back compatibility, so skip the deprecation warning. $this->hideDeprecated( '$wgLBFactoryConf must be updated. See RELEASE-NOTES for details' ); $lbfactory = FakeLBFactory::singleton(); $this->assertInstanceOf( $expected, $lbfactory, "LBFactory passed $deprecated should yield the new class $expected" ); } function provideDeprecatedLbfactoryClasses() { return array( # Format: new class, old class array( 'LBFactorySimple', 'LBFactory_Simple' ), array( 'LBFactorySingle', 'LBFactory_Single' ), array( 'LBFactoryMulti', 'LBFactory_Multi' ), array( 'LBFactoryFake', 'LBFactory_Fake' ), ); } }