mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-30 18:45:07 +00:00
1bc5b6daf8
Change-Id: Ieeeaf80d04b060d6dbca1959d5e66f4c69c5a7f2
39 lines
971 B
PHP
39 lines
971 B
PHP
<?php
|
|
|
|
use MediaWiki\Extension\Notifications\DbFactory;
|
|
use Wikimedia\Rdbms\IDatabase;
|
|
use Wikimedia\Rdbms\ILoadBalancer;
|
|
|
|
/**
|
|
* @covers \MediaWiki\Extension\Notifications\DbFactory
|
|
* @group Database
|
|
*/
|
|
class DbFactoryTest extends MediaWikiIntegrationTestCase {
|
|
|
|
public function testNewFromDefault() {
|
|
$db = DbFactory::newFromDefault();
|
|
$this->assertInstanceOf( DbFactory::class, $db );
|
|
|
|
return $db;
|
|
}
|
|
|
|
/**
|
|
* @depends testNewFromDefault
|
|
*/
|
|
public function testGetEchoDb( DbFactory $db ) {
|
|
$this->assertInstanceOf( IDatabase::class, $db->getEchoDb( DB_PRIMARY ) );
|
|
$this->assertInstanceOf( IDatabase::class, $db->getEchoDb( DB_REPLICA ) );
|
|
}
|
|
|
|
/**
|
|
* @depends testNewFromDefault
|
|
*/
|
|
public function testGetLB( DbFactory $db ) {
|
|
$reflection = new ReflectionClass( DbFactory::class );
|
|
$method = $reflection->getMethod( 'getLB' );
|
|
$method->setAccessible( true );
|
|
$this->assertInstanceOf( ILoadBalancer::class, $method->invoke( $db ) );
|
|
}
|
|
|
|
}
|