mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-14 19:28:31 +00:00
449f82faa3
MediaWikiTestCase has been renamed to MediaWikiIntegrationTestCase in 1.34. Bug: T293043 Change-Id: I68efac2c458748fa3ab16c4c652bd2c4af9cbb75
37 lines
911 B
PHP
37 lines
911 B
PHP
<?php
|
|
|
|
use Wikimedia\Rdbms\IDatabase;
|
|
use Wikimedia\Rdbms\ILoadBalancer;
|
|
|
|
/**
|
|
* @covers \MWEchoDbFactory
|
|
*/
|
|
class MWEchoDbFactoryTest extends MediaWikiIntegrationTestCase {
|
|
|
|
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 ) );
|
|
}
|
|
|
|
}
|