mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-12-02 11:26:26 +00:00
291ea47dd3
This might make dependencies easier to find. Change-Id: I158fd9f63f18a2b8da0368ac95d5fb5aa9bca3ff
43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace MediaWiki\Extension\Notifications\Test;
|
|
|
|
use MediaWiki\Extension\Notifications\DbFactory;
|
|
use MediaWikiIntegrationTestCase;
|
|
use ReflectionClass;
|
|
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 ) );
|
|
}
|
|
|
|
}
|