From b857284f710c48ea5fbdbe69981471383faaecf2 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Thu, 20 Jul 2017 17:14:52 -0700 Subject: [PATCH] rdbms: Move DatabaseMysqlBaseTest to libs tests * Remove MediaWikiTestCase dependency. * Add missing @covers tags. * Add missing visibility/static declarations. Change-Id: I2d81a9265016174e7b4ff810f140f7d031ce9f14 --- .../rdbms/database}/DatabaseMysqlBaseTest.php | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) rename tests/phpunit/includes/{db => libs/rdbms/database}/DatabaseMysqlBaseTest.php (92%) diff --git a/tests/phpunit/includes/db/DatabaseMysqlBaseTest.php b/tests/phpunit/includes/libs/rdbms/database/DatabaseMysqlBaseTest.php similarity index 92% rename from tests/phpunit/includes/db/DatabaseMysqlBaseTest.php rename to tests/phpunit/includes/libs/rdbms/database/DatabaseMysqlBaseTest.php index 3dc810c811..0d817fa50e 100644 --- a/tests/phpunit/includes/db/DatabaseMysqlBaseTest.php +++ b/tests/phpunit/includes/libs/rdbms/database/DatabaseMysqlBaseTest.php @@ -1,6 +1,6 @@ getMockBuilder( 'DatabaseMysqli' ) ->disableOriginalConstructor() ->setMethods( [ 'fetchRow', 'query' ] ) @@ -187,10 +187,11 @@ class DatabaseMysqlBaseTest extends MediaWikiTestCase { return $db; } + /** * @covers DatabaseMysqlBase::listViews */ - function testListviews() { + public function testListviews() { $db = $this->getMockForViews(); $this->assertEquals( [ 'view1', 'view2', 'myview' ], @@ -209,8 +210,9 @@ class DatabaseMysqlBaseTest extends MediaWikiTestCase { /** * @dataProvider provideComparePositions + * @covers MySQLMasterPos */ - function testHasReached( MySQLMasterPos $lowerPos, MySQLMasterPos $higherPos, $match ) { + public function testHasReached( MySQLMasterPos $lowerPos, MySQLMasterPos $higherPos, $match ) { if ( $match ) { $this->assertTrue( $lowerPos->channelsMatch( $higherPos ) ); @@ -226,7 +228,7 @@ class DatabaseMysqlBaseTest extends MediaWikiTestCase { } } - function provideComparePositions() { + public static function provideComparePositions() { return [ // Binlog style [ @@ -281,13 +283,14 @@ class DatabaseMysqlBaseTest extends MediaWikiTestCase { /** * @dataProvider provideChannelPositions + * @covers MySQLMasterPos */ - function testChannelsMatch( MySQLMasterPos $pos1, MySQLMasterPos $pos2, $matches ) { + public function testChannelsMatch( MySQLMasterPos $pos1, MySQLMasterPos $pos2, $matches ) { $this->assertEquals( $matches, $pos1->channelsMatch( $pos2 ) ); $this->assertEquals( $matches, $pos2->channelsMatch( $pos1 ) ); } - function provideChannelPositions() { + public static function provideChannelPositions() { return [ [ new MySQLMasterPos( 'db1034-bin.000876', '44' ), @@ -314,8 +317,10 @@ class DatabaseMysqlBaseTest extends MediaWikiTestCase { /** * @dataProvider provideLagAmounts + * @covers DatabaseMysqlBase::getLag + * @covers DatabaseMysqlBase::getLagFromPtHeartbeat */ - function testPtHeartbeat( $lag ) { + public function testPtHeartbeat( $lag ) { $db = $this->getMockBuilder( 'DatabaseMysqli' ) ->disableOriginalConstructor() ->setMethods( [ @@ -351,7 +356,7 @@ class DatabaseMysqlBaseTest extends MediaWikiTestCase { $this->assertLessThan( $lag + .010, $lagEst, "Correct heatbeat lag" ); } - function provideLagAmounts() { + public static function provideLagAmounts() { return [ [ 0 ], [ 0.3 ], -- 2.20.1