3 * Holds tests for LBFactory abstract MediaWiki class.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * http://www.gnu.org/copyleft/gpl.html
23 * @author Antoine Musso
24 * @copyright © 2013 Antoine Musso
25 * @copyright © 2013 Wikimedia Foundation Inc.
27 class LBFactoryTest
extends MediaWikiTestCase
{
30 * @dataProvider getLBFactoryClassProvider
32 public function testGetLBFactoryClass( $expected, $deprecated ) {
33 $mockDB = $this->getMockBuilder( 'DatabaseMysql' )
34 ->disableOriginalConstructor()
38 'class' => $deprecated,
39 'connection' => $mockDB,
40 # Various other parameters required:
41 'sectionsByDB' => array(),
42 'sectionLoads' => array(),
43 'serverTemplate' => array(),
46 $this->hideDeprecated( '$wgLBFactoryConf must be updated. See RELEASE-NOTES for details' );
47 $result = LBFactory
::getLBFactoryClass( $config );
49 $this->assertEquals( $expected, $result );
52 public function getLBFactoryClassProvider() {
54 # Format: new class, old class
55 array( 'LBFactorySimple', 'LBFactory_Simple' ),
56 array( 'LBFactorySingle', 'LBFactory_Single' ),
57 array( 'LBFactoryMulti', 'LBFactory_Multi' ),
58 array( 'LBFactoryFake', 'LBFactory_Fake' ),