mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-24 16:04:35 +00:00
967a0b54e9
Not all tools require these to be absolute, full qualified class names. But some do. This does make the code more compatible with all kinds of tools. Change-Id: Ie7f9d9469b7a48b2fe908d3428fca9ec0120f855
37 lines
899 B
PHP
37 lines
899 B
PHP
<?php
|
|
|
|
use Wikimedia\Rdbms\IDatabase;
|
|
use Wikimedia\Rdbms\ILoadBalancer;
|
|
|
|
/**
|
|
* @covers \MWEchoDbFactory
|
|
*/
|
|
class MWEchoDbFactoryTest extends MediaWikiTestCase {
|
|
|
|
public function testNewFromDefault() {
|
|
$db = MWEchoDbFactory::newFromDefault();
|
|
$this->assertInstanceOf( MWEchoDbFactory::class, $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::class );
|
|
$method = $reflection->getMethod( 'getLB' );
|
|
$method->setAccessible( true );
|
|
$this->assertInstanceOf( ILoadBalancer::class, $method->invoke( $db ) );
|
|
}
|
|
|
|
}
|