2014-07-18 03:58:21 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class MWEchoDbFactoryTest extends MediaWikiTestCase {
|
|
|
|
|
|
|
|
public function testNewFromDefault() {
|
|
|
|
$db = MWEchoDbFactory::newFromDefault();
|
|
|
|
$this->assertInstanceOf( 'MWEchoDbFactory', $db );
|
2015-10-01 13:48:52 +00:00
|
|
|
|
2014-07-18 03:58:21 +00:00
|
|
|
return $db;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @depends testNewFromDefault
|
|
|
|
*/
|
|
|
|
public function testGetEchoDb( MWEchoDbFactory $db ) {
|
|
|
|
$this->assertInstanceOf( 'DatabaseBase', $db->getEchoDb( DB_MASTER ) );
|
2017-09-24 05:23:47 +00:00
|
|
|
$this->assertInstanceOf( 'DatabaseBase', $db->getEchoDb( DB_REPLICA ) );
|
2014-07-18 03:58:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @depends testNewFromDefault
|
|
|
|
*/
|
|
|
|
public function testGetLB( MWEchoDbFactory $db ) {
|
|
|
|
$reflection = new ReflectionClass( 'MWEchoDbFactory' );
|
|
|
|
$method = $reflection->getMethod( 'getLB' );
|
|
|
|
$method->setAccessible( true );
|
|
|
|
$this->assertInstanceOf( 'LoadBalancer', $method->invoke( $db ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|