X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=tests%2Fphpunit%2FMediaWikiTestCase.php;h=37f76ff4d15e991edef5145bf36f19d6343debdf;hp=db1df5c04f77f199d9ea5b764f257460e3d599ad;hb=a9c0d737184c594658c69eb691b0e505fcac969f;hpb=a9c0f0e93c9940f3a756f0ea1bb28237f266a20f diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index db1df5c04f..37f76ff4d1 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -255,6 +255,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { CACHE_ACCEL => $hashCache, CACHE_MEMCACHED => $hashCache, 'apc' => $hashCache, + 'apcu' => $hashCache, 'xcache' => $hashCache, 'wincache' => $hashCache, ] + $baseConfig->get( 'ObjectCaches' ); @@ -582,6 +583,10 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { /** * Make sure MediaWikiTestCase extending classes have called their * parent setUp method + * + * With strict coverage activated in PHP_CodeCoverage, this test would be + * marked as risky without the following annotation (T152923). + * @coversNothing */ final public function testMediaWikiTestCaseParentSetupCalled() { $this->assertArrayHasKey( 'setUp', $this->called, @@ -1087,11 +1092,11 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { * Clones all tables in the given database (whatever database that connection has * open), to versions with the test prefix. * - * @param Database $db Database to use + * @param IMaintainableDatabase $db Database to use * @param string $prefix Prefix to use for test tables * @return bool True if tables were cloned, false if only the prefix was changed */ - protected static function setupDatabaseWithTestPrefix( Database $db, $prefix ) { + protected static function setupDatabaseWithTestPrefix( IMaintainableDatabase $db, $prefix ) { $tablesCloned = self::listTables( $db ); $dbClone = new CloneDatabase( $db, $tablesCloned, $prefix ); $dbClone->useTemporaryTables( self::$useTemporaryTables ); @@ -1210,9 +1215,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { list( $proto, $cluster ) = explode( '://', $url, 2 ); // Avoid getMaster() because setupDatabaseWithTestPrefix() // requires Database instead of plain DBConnRef/IDatabase - $lb = $externalStoreDB->getLoadBalancer( $cluster ); - $dbw = $lb->getConnection( DB_MASTER ); - $dbws[] = $dbw; + $dbws[] = $externalStoreDB->getMaster( $cluster ); } } @@ -1326,11 +1329,11 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { /** * @since 1.18 * - * @param Database $db + * @param IMaintainableDatabase $db * * @return array */ - public static function listTables( Database $db ) { + public static function listTables( IMaintainableDatabase $db ) { $prefix = $db->tablePrefix(); $tables = $db->listTables( $prefix, __METHOD__ ); @@ -1378,6 +1381,8 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { if ( isset( PHPUnitMaintClass::$additionalOptions[$offset] ) ) { return PHPUnitMaintClass::$additionalOptions[$offset]; } + + return null; } /**