mediawiki-extensions-Echo/tests/phpunit/EchoDbFactoryTest.php
Kunal Mehta 59a125fc38 Add @covers tags
Change-Id: Ib8cf432b58470c9218519639379c83254acef1c8
2018-01-23 16:44:45 -08:00

37 lines
888 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', $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' );
$method = $reflection->getMethod( 'getLB' );
$method->setAccessible( true );
$this->assertInstanceOf( ILoadBalancer::class, $method->invoke( $db ) );
}
}