Merge "Check for IDatabase (not DatabaseBase) in tests"

This commit is contained in:
jenkins-bot 2017-12-21 20:00:36 +00:00 committed by Gerrit Code Review
commit 4d3f4ae98f

View file

@ -1,5 +1,8 @@
<?php
use Wikimedia\Rdbms\IDatabase;
use Wikimedia\Rdbms\ILoadBalancer;
class MWEchoDbFactoryTest extends MediaWikiTestCase {
public function testNewFromDefault() {
@ -13,8 +16,8 @@ class MWEchoDbFactoryTest extends MediaWikiTestCase {
* @depends testNewFromDefault
*/
public function testGetEchoDb( MWEchoDbFactory $db ) {
$this->assertInstanceOf( 'DatabaseBase', $db->getEchoDb( DB_MASTER ) );
$this->assertInstanceOf( 'DatabaseBase', $db->getEchoDb( DB_REPLICA ) );
$this->assertInstanceOf( IDatabase::class, $db->getEchoDb( DB_MASTER ) );
$this->assertInstanceOf( IDatabase::class, $db->getEchoDb( DB_REPLICA ) );
}
/**
@ -24,7 +27,7 @@ class MWEchoDbFactoryTest extends MediaWikiTestCase {
$reflection = new ReflectionClass( 'MWEchoDbFactory' );
$method = $reflection->getMethod( 'getLB' );
$method->setAccessible( true );
$this->assertInstanceOf( 'LoadBalancer', $method->invoke( $db ) );
$this->assertInstanceOf( ILoadBalancer::class, $method->invoke( $db ) );
}
}