mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-24 07:54:13 +00:00
b3f948c59c
* mediawiki/mediawiki-codesniffer: 35.0.0 → 36.0.0 * php-parallel-lint/php-parallel-lint: 1.2.0 → 1.3.0 Change-Id: I4b2fb7f46b6c0a5c33a6ad25f085de8ae13eb084
37 lines
900 B
PHP
37 lines
900 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_PRIMARY ) );
|
|
$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 ) );
|
|
}
|
|
|
|
}
|