mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-12-04 20:28:49 +00:00
774610c0d4
Change-Id: Ia94fcae2a1dd28761b4e2f40fa1491f8401ad491
34 lines
853 B
PHP
34 lines
853 B
PHP
<?php
|
|
|
|
use Wikimedia\Rdbms\IDatabase;
|
|
use Wikimedia\Rdbms\ILoadBalancer;
|
|
|
|
class MWEchoDbFactoryTest extends MediaWikiTestCase {
|
|
|
|
public function testNewFromDefault() {
|
|
$db = MWEchoDbFactory::newFromDefault();
|
|
$this->assertInstanceOf( 'MWEchoDbFactory', $db );
|
|
|
|
return $db;
|
|
}
|
|
|
|
/**
|
|
* @depends testNewFromDefault
|
|
*/
|
|
public function testGetEchoDb( MWEchoDbFactory $db ) {
|
|
$this->assertInstanceOf( IDatabase::class, $db->getEchoDb( DB_MASTER ) );
|
|
$this->assertInstanceOf( IDatabase::class, $db->getEchoDb( DB_REPLICA ) );
|
|
}
|
|
|
|
/**
|
|
* @depends testNewFromDefault
|
|
*/
|
|
public function testGetLB( MWEchoDbFactory $db ) {
|
|
$reflection = new ReflectionClass( 'MWEchoDbFactory' );
|
|
$method = $reflection->getMethod( 'getLB' );
|
|
$method->setAccessible( true );
|
|
$this->assertInstanceOf( ILoadBalancer::class, $method->invoke( $db ) );
|
|
}
|
|
|
|
}
|