Replace mocks of DatabaseMysql by DatabaseMysqli
authorSeb35 <seb35@seb35.fr>
Sat, 31 Dec 2016 11:52:16 +0000 (12:52 +0100)
committerSeb35 <seb35@seb35.fr>
Sat, 31 Dec 2016 11:52:16 +0000 (12:52 +0100)
The class DatabaseMysql corresponds to the PHP extension 'mysql' which is
deprecated since PHP 5.5, and the class DatabaseMysqli corresponds to the
PHP extension 'mysqli' which is the current MySQL driver. Given the class
DatabaseMysql is likely to be removed in the future, this change is a
first step towards this.

Bug: T120333
Change-Id: I7b8363838449cae09b360221d8f50ace3a008f11

tests/phpunit/includes/db/DatabaseMysqlBaseTest.php
tests/phpunit/includes/db/LBFactoryTest.php
tests/phpunit/includes/filerepo/FileBackendDBRepoWrapperTest.php
tests/phpunit/includes/filerepo/MigrateFileRepoLayoutTest.php
tests/phpunit/includes/utils/BatchRowUpdateTest.php

index dbb126f..81b75de 100644 (file)
@@ -170,7 +170,7 @@ class DatabaseMysqlBaseTest extends MediaWikiTestCase {
        }
 
        function getMockForViews() {
-               $db = $this->getMockBuilder( 'DatabaseMysql' )
+               $db = $this->getMockBuilder( 'DatabaseMysqli' )
                        ->disableOriginalConstructor()
                        ->setMethods( [ 'fetchRow', 'query' ] )
                        ->getMock();
@@ -314,7 +314,7 @@ class DatabaseMysqlBaseTest extends MediaWikiTestCase {
         * @dataProvider provideLagAmounts
         */
        function testPtHeartbeat( $lag ) {
-               $db = $this->getMockBuilder( 'DatabaseMysql' )
+               $db = $this->getMockBuilder( 'DatabaseMysqli' )
                        ->disableOriginalConstructor()
                        ->setMethods( [
                                'getLagDetectionMethod', 'getHeartbeatData', 'getMasterServerInfo' ] )
index d8773f8..573b395 100644 (file)
@@ -29,7 +29,7 @@ class LBFactoryTest extends MediaWikiTestCase {
         * @dataProvider getLBFactoryClassProvider
         */
        public function testGetLBFactoryClass( $expected, $deprecated ) {
-               $mockDB = $this->getMockBuilder( 'DatabaseMysql' )
+               $mockDB = $this->getMockBuilder( 'DatabaseMysqli' )
                        ->disableOriginalConstructor()
                        ->getMock();
 
@@ -178,7 +178,7 @@ class LBFactoryTest extends MediaWikiTestCase {
                $mPos = new MySQLMasterPos( 'db1034-bin.000976', '843431247' );
 
                $now = microtime( true );
-               $mockDB = $this->getMockBuilder( 'DatabaseMysql' )
+               $mockDB = $this->getMockBuilder( 'DatabaseMysqli' )
                        ->disableOriginalConstructor()
                        ->getMock();
                $mockDB->method( 'writesOrCallbacksPending' )->willReturn( true );
index 8366541..410d2df 100644 (file)
@@ -112,7 +112,7 @@ class FileBackendDBRepoWrapperTest extends MediaWikiTestCase {
        }
 
        protected function getMocks() {
-               $dbMock = $this->getMockBuilder( 'DatabaseMysql' )
+               $dbMock = $this->getMockBuilder( 'DatabaseMysqli' )
                        ->disableOriginalConstructor()
                        ->getMock();
 
index 92a54fa..d3f9374 100644 (file)
@@ -25,7 +25,7 @@ class MigrateFileRepoLayoutTest extends MediaWikiTestCase {
                        ]
                ] );
 
-               $dbMock = $this->getMockBuilder( 'DatabaseMysql' )
+               $dbMock = $this->getMockBuilder( 'DatabaseMysqli' )
                        ->disableOriginalConstructor()
                        ->getMock();
 
index cb1b3d2..6506d58 100644 (file)
@@ -237,7 +237,7 @@ class BatchRowUpdateTest extends MediaWikiTestCase {
        protected function mockDb() {
                // @TODO: mock from Database
                // FIXME: the constructor normally sets mAtomicLevels and mSrvCache
-               $databaseMysql = $this->getMockBuilder( 'DatabaseMysql' )
+               $databaseMysql = $this->getMockBuilder( 'DatabaseMysqli' )
                        ->disableOriginalConstructor()
                        ->getMock();
                $databaseMysql->expects( $this->any() )