From: jenkins-bot Date: Fri, 21 Jun 2019 06:06:56 +0000 (+0000) Subject: Merge "Update ObjectFactory and ConvertibleTimestamp" X-Git-Tag: 1.34.0-rc.0~1315 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=97db167a0ae539d7bb9c9d4ca51b2aaaf78f1853;hp=d7e88d9e69196db9a718a016cfdbc236de4dfe09 Merge "Update ObjectFactory and ConvertibleTimestamp" --- diff --git a/RELEASE-NOTES-1.34 b/RELEASE-NOTES-1.34 index f3526d411e..21e909c061 100644 --- a/RELEASE-NOTES-1.34 +++ b/RELEASE-NOTES-1.34 @@ -156,9 +156,10 @@ because of Phabricator reports. * User::makeGroupLinkWiki(), deprecated in 1.29, has been removed. Use UserGroupMembership::getLink() instead. * SavepointPostgres, deprecated in 1.31, has been removed. -* Output::sectionEditLinksEnabled(), ParserOutput::getEditSectionTokens, - ::getTOCEnabled, ::setEditSectionTokens, ::setTOCEnabled, deprecated in 1.31, - have been removed. +* OutputPage::enableSectionEditLinks(), OutputPage::sectionEditLinksEnabled(), + ParserOptions::getEditSection(), ParserOptions::setEditSection(), and + ParserOutput::getEditSectionTokens, ::getTOCEnabled, ::setEditSectionTokens, + and ::setTOCEnabled, deprecated in 1.31, have been removed. * EditPage::safeUnicodeInput() and ::safeUnicodeOutput(), deprecated in 1.30, have been removed. * Four methods in OutputPage, deprecated in 1.32, have been removed. You should @@ -220,6 +221,12 @@ because of Phabricator reports. removed. * The $wgUseKeyHeader configuration option and the OutputPage::getKeyHeader() method, deprecated in 1.32, have been removed. +* WebInstallerOutput::addWikiText(), deprecated in 1.32, has been removed. +* Parser::fetchFile(), deprecated in 1.32, has been removed. Use the method + Parser::fetchFileAndTitle() instead. +* The global function wfBCP47, deprecated in 1.31, has been removed. +* wfCountDown() function, deprecated in 1.31, has been removed. Use + \Maintenance::countDown() method instead. * … === Deprecations in 1.34 === diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index c5a2f77782..2075432b2d 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -4142,8 +4142,7 @@ $wgInvalidRedirectTargets = [ 'Filepath', 'Mypage', 'Mytalk', 'Redirect' ]; * temporary storage. Preprocessor_DOM generally uses less memory; * the speed of the two is roughly the same. * - * If this parameter is not given, it uses Preprocessor_DOM if the - * DOM module is available, otherwise it uses Preprocessor_Hash. + * If this parameter is not given, it uses Preprocessor_Hash. * * The Preprocessor_DOM class is deprecated, and will be removed in a future * release. diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 759732f8a2..c3829be981 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2762,30 +2762,6 @@ function wfWaitForSlaves( return $lbFactory->waitForReplication( $opts ); } -/** - * Count down from $seconds to zero on the terminal, with a one-second pause - * between showing each number. For use in command-line scripts. - * - * @deprecated since 1.31, use Maintenance::countDown() - * - * @codeCoverageIgnore - * @param int $seconds - */ -function wfCountDown( $seconds ) { - wfDeprecated( __FUNCTION__, '1.31' ); - for ( $i = $seconds; $i >= 0; $i-- ) { - if ( $i != $seconds ) { - echo str_repeat( "\x08", strlen( $i + 1 ) ); - } - echo $i; - flush(); - if ( $i ) { - sleep( 1 ); - } - } - echo "\n"; -} - /** * Replace all invalid characters with '-'. * Additional characters can be defined in $wgIllegalFileChars (see T22489). @@ -2885,21 +2861,6 @@ function wfShorthandToInteger( $string = '', $default = -1 ) { return $val; } -/** - * Get the normalised IETF language tag - * See unit test for examples. - * See mediawiki.language.bcp47 for the JavaScript implementation. - * - * @deprecated since 1.31, use LanguageCode::bcp47() directly. - * - * @param string $code The language code. - * @return string The language code which complying with BCP 47 standards. - */ -function wfBCP47( $code ) { - wfDeprecated( __METHOD__, '1.31' ); - return LanguageCode::bcp47( $code ); -} - /** * Get a specific cache object. * diff --git a/includes/OutputPage.php b/includes/OutputPage.php index fba75ecf50..6c49696a2b 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -4017,16 +4017,6 @@ class OutputPage extends ContextSource { return $this->mEnableTOC; } - /** - * Enables/disables section edit links, doesn't override __NOEDITSECTION__ - * @param bool $flag - * @since 1.23 - * @deprecated since 1.31, use $poOptions to addParserOutput() instead. - */ - public function enableSectionEditLinks( $flag = true ) { - wfDeprecated( __METHOD__, '1.31' ); - } - /** * Helper function to setup the PHP implementation of OOUI to use in this request. * diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php index 64c6f45971..6b24b6347a 100644 --- a/includes/api/ApiPageSet.php +++ b/includes/api/ApiPageSet.php @@ -20,7 +20,7 @@ * @file */ use MediaWiki\MediaWikiServices; -use Wikimedia\Rdbms\ResultWrapper; +use Wikimedia\Rdbms\IResultWrapper; use Wikimedia\Rdbms\IDatabase; /** @@ -735,7 +735,7 @@ class ApiPageSet extends ApiBase { * $this->getPageTableFields(). * * @param IDatabase $db - * @param ResultWrapper $queryResult + * @param IResultWrapper $queryResult */ public function populateFromQueryResult( $db, $queryResult ) { $this->initFromQueryResult( $queryResult ); @@ -854,7 +854,7 @@ class ApiPageSet extends ApiBase { /** * Iterate through the result of the query on 'page' table, * and for each row create and store title object and save any extra fields requested. - * @param ResultWrapper $res DB Query result + * @param IResultWrapper $res DB Query result * @param array $remaining Array of either pageID or ns/title elements (optional). * If given, any missing items will go to $mMissingPageIDs and $mMissingTitles * @param bool $processTitles Must be provided together with $remaining. diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php index 59ec4f61ca..ec432d8f11 100644 --- a/includes/api/ApiQueryBase.php +++ b/includes/api/ApiQueryBase.php @@ -21,7 +21,7 @@ */ use Wikimedia\Rdbms\IDatabase; -use Wikimedia\Rdbms\ResultWrapper; +use Wikimedia\Rdbms\IResultWrapper; /** * This is a base class for all Query modules. @@ -368,7 +368,7 @@ abstract class ApiQueryBase extends ApiBase { * @param array|null &$hookData If set, the ApiQueryBaseBeforeQuery and * ApiQueryBaseAfterQuery hooks will be called, and the * ApiQueryBaseProcessRow hook will be expected. - * @return ResultWrapper + * @return IResultWrapper */ protected function select( $method, $extraQuery = [], array &$hookData = null ) { $tables = array_merge( diff --git a/includes/block/BlockManager.php b/includes/block/BlockManager.php index 41ff893d57..abd2db24af 100644 --- a/includes/block/BlockManager.php +++ b/includes/block/BlockManager.php @@ -223,25 +223,32 @@ class BlockManager { } /** - * Given a list of blocks, return a list blocks where each block either has a - * unique ID or has ID null. + * Given a list of blocks, return a list of unique blocks. + * + * This usually means that each block has a unique ID. For a block with ID null, + * if it's an autoblock, it will be filtered out if the parent block is present; + * if not, it is assumed to be a unique system block, and kept. * * @param AbstractBlock[] $blocks * @return AbstractBlock[] */ private function getUniqueBlocks( $blocks ) { - $blockIds = []; - $uniqueBlocks = []; + $systemBlocks = []; + $databaseBlocks = []; + foreach ( $blocks as $block ) { - $id = $block->getId(); - if ( $id === null ) { - $uniqueBlocks[] = $block; - } elseif ( !isset( $blockIds[$id] ) ) { - $uniqueBlocks[] = $block; - $blockIds[$block->getId()] = true; + if ( $block instanceof SystemBlock ) { + $systemBlocks[] = $block; + } elseif ( $block->getType() === DatabaseBlock::TYPE_AUTO ) { + if ( !isset( $databaseBlocks[$block->getParentBlockId()] ) ) { + $databaseBlocks[$block->getParentBlockId()] = $block; + } + } else { + $databaseBlocks[$block->getId()] = $block; } } - return $uniqueBlocks; + + return array_merge( $systemBlocks, $databaseBlocks ); } /** diff --git a/includes/block/DatabaseBlock.php b/includes/block/DatabaseBlock.php index ba08d5461e..0f193240a0 100644 --- a/includes/block/DatabaseBlock.php +++ b/includes/block/DatabaseBlock.php @@ -1045,6 +1045,14 @@ class DatabaseBlock extends AbstractBlock { return $this; } + /** + * @since 1.34 + * @return int|null If this is an autoblock, ID of the parent block; otherwise null + */ + public function getParentBlockId() { + return $this->mParentBlockId; + } + /** * Get/set a flag determining whether the master is used for reads * diff --git a/includes/config/ServiceOptions.php b/includes/config/ServiceOptions.php index 0f3743f794..6ae059ebff 100644 --- a/includes/config/ServiceOptions.php +++ b/includes/config/ServiceOptions.php @@ -23,6 +23,7 @@ use Wikimedia\Assert\Assert; * @since 1.34 */ class ServiceOptions { + private $keys = []; private $options = []; /** @@ -33,6 +34,7 @@ class ServiceOptions { * @throws InvalidArgumentException if one of $keys is not found in any of $sources */ public function __construct( array $keys, ...$sources ) { + $this->keys = $keys; foreach ( $keys as $key ) { foreach ( $sources as $source ) { if ( $source instanceof Config ) { @@ -58,20 +60,21 @@ class ServiceOptions { * @param string[] $expectedKeys */ public function assertRequiredOptions( array $expectedKeys ) { - $actualKeys = array_keys( $this->options ); - $extraKeys = array_diff( $actualKeys, $expectedKeys ); - $missingKeys = array_diff( $expectedKeys, $actualKeys ); - Assert::precondition( !$extraKeys && !$missingKeys, - ( - $extraKeys - ? 'Unsupported options passed: ' . implode( ', ', $extraKeys ) . '!' - : '' - ) . ( $extraKeys && $missingKeys ? ' ' : '' ) . ( - $missingKeys - ? 'Required options missing: ' . implode( ', ', $missingKeys ) . '!' - : '' - ) - ); + if ( $this->keys !== $expectedKeys ) { + $extraKeys = array_diff( $this->keys, $expectedKeys ); + $missingKeys = array_diff( $expectedKeys, $this->keys ); + Assert::precondition( !$extraKeys && !$missingKeys, + ( + $extraKeys + ? 'Unsupported options passed: ' . implode( ', ', $extraKeys ) . '!' + : '' + ) . ( $extraKeys && $missingKeys ? ' ' : '' ) . ( + $missingKeys + ? 'Required options missing: ' . implode( ', ', $missingKeys ) . '!' + : '' + ) + ); + } } /** diff --git a/includes/installer/WebInstallerOutput.php b/includes/installer/WebInstallerOutput.php index 65e7457d3f..cbb9b573df 100644 --- a/includes/installer/WebInstallerOutput.php +++ b/includes/installer/WebInstallerOutput.php @@ -90,15 +90,6 @@ class WebInstallerOutput { $this->flush(); } - /** - * @param string $text - * @deprecated since 1.32; use addWikiTextAsInterface instead - */ - public function addWikiText( $text ) { - wfDeprecated( __METHOD__, '1.32' ); - $this->addWikiTextAsInterface( $text ); - } - /** * @param string $text * @since 1.32 diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index c61de38a86..59f2db452f 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -3836,19 +3836,6 @@ class Parser { 'deps' => $deps ]; } - /** - * Fetch a file and its title and register a reference to it. - * If 'broken' is a key in $options then the file will appear as a broken thumbnail. - * @param Title $title - * @param array $options Array of options to RepoGroup::findFile - * @return File|bool - * @deprecated since 1.32, use fetchFileAndTitle instead - */ - public function fetchFile( $title, $options = [] ) { - wfDeprecated( __METHOD__, '1.32' ); - return $this->fetchFileAndTitle( $title, $options )[0]; - } - /** * Fetch a file and its title and register a reference to it. * If 'broken' is a key in $options then the file will appear as a broken thumbnail. diff --git a/includes/parser/ParserOptions.php b/includes/parser/ParserOptions.php index 66b1612245..afd6b2d4c8 100644 --- a/includes/parser/ParserOptions.php +++ b/includes/parser/ParserOptions.php @@ -913,27 +913,6 @@ class ParserOptions { return wfSetVar( $this->mTimestamp, $x ); } - /** - * Create "edit section" links? - * @deprecated since 1.31, use ParserOutput::getText() options instead. - * @return bool - */ - public function getEditSection() { - wfDeprecated( __METHOD__, '1.31' ); - return true; - } - - /** - * Create "edit section" links? - * @deprecated since 1.31, use ParserOutput::getText() options instead. - * @param bool|null $x New value (null is no change) - * @return bool Old value - */ - public function setEditSection( $x ) { - wfDeprecated( __METHOD__, '1.31' ); - return true; - } - /** * Set the redirect target. * diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 4c32ec6633..425cf2ba37 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -169,7 +169,7 @@ "history": "Page history", "history_short": "History", "history_small": "history", - "updatedmarker": "updated since my last visit", + "updatedmarker": "updated since your last visit", "printableversion": "Printable version", "permalink": "Permanent link", "print": "Print", diff --git a/maintenance/convertUserOptions.php b/maintenance/convertUserOptions.php index c1a096fd23..2cb3770569 100644 --- a/maintenance/convertUserOptions.php +++ b/maintenance/convertUserOptions.php @@ -23,7 +23,7 @@ require_once __DIR__ . '/Maintenance.php'; -use Wikimedia\Rdbms\ResultWrapper; +use Wikimedia\Rdbms\IResultWrapper; use Wikimedia\Rdbms\IDatabase; /** @@ -76,7 +76,7 @@ class ConvertUserOptions extends Maintenance { } /** - * @param ResultWrapper $res + * @param IResultWrapper $res * @param IDatabase $dbw * @return null|int */ diff --git a/maintenance/namespaceDupes.php b/maintenance/namespaceDupes.php index 3c73306eb6..333b8b95de 100644 --- a/maintenance/namespaceDupes.php +++ b/maintenance/namespaceDupes.php @@ -28,7 +28,7 @@ require_once __DIR__ . '/Maintenance.php'; use MediaWiki\Linker\LinkTarget; use MediaWiki\MediaWikiServices; -use Wikimedia\Rdbms\ResultWrapper; +use Wikimedia\Rdbms\IResultWrapper; use Wikimedia\Rdbms\IMaintainableDatabase; /** @@ -429,7 +429,7 @@ class NamespaceDupes extends Maintenance { * @param string $name Prefix that is being made a namespace * @param array $options Associative array of validated command-line options * - * @return ResultWrapper + * @return IResultWrapper */ private function getTargetList( $ns, $name, $options ) { if ( diff --git a/maintenance/populateContentTables.php b/maintenance/populateContentTables.php index a264545e7f..f3e373a5f1 100644 --- a/maintenance/populateContentTables.php +++ b/maintenance/populateContentTables.php @@ -25,7 +25,7 @@ use MediaWiki\Storage\NameTableStore; use MediaWiki\Storage\SqlBlobStore; use Wikimedia\Assert\Assert; use Wikimedia\Rdbms\IDatabase; -use Wikimedia\Rdbms\ResultWrapper; +use Wikimedia\Rdbms\IResultWrapper; require_once __DIR__ . '/Maintenance.php'; @@ -239,12 +239,12 @@ class PopulateContentTables extends Maintenance { } /** - * @param ResultWrapper $rows + * @param IResultWrapper $rows * @param int $startId * @param string $table * @return int|null */ - private function populateContentTablesForRowBatch( ResultWrapper $rows, $startId, $table ) { + private function populateContentTablesForRowBatch( IResultWrapper $rows, $startId, $table ) { $this->beginTransaction( $this->dbw, __METHOD__ ); if ( $this->contentRowMap === null ) { diff --git a/maintenance/purgeChangedPages.php b/maintenance/purgeChangedPages.php index 8f47b1605f..8ecd810ff2 100644 --- a/maintenance/purgeChangedPages.php +++ b/maintenance/purgeChangedPages.php @@ -23,7 +23,7 @@ require_once __DIR__ . '/Maintenance.php'; -use Wikimedia\Rdbms\ResultWrapper; +use Wikimedia\Rdbms\IResultWrapper; /** * Maintenance script that sends purge requests for pages edited in a date @@ -163,12 +163,12 @@ class PurgeChangedPages extends Maintenance { * * @todo move this elsewhere * - * @param ResultWrapper $res Query result sorted by $column (ascending) + * @param IResultWrapper $res Query result sorted by $column (ascending) * @param string $column * @param int $limit * @return array (array of rows, string column value) */ - protected function pageableSortedRows( ResultWrapper $res, $column, $limit ) { + protected function pageableSortedRows( IResultWrapper $res, $column, $limit ) { $rows = iterator_to_array( $res, false ); // Nothing to do diff --git a/maintenance/sql.php b/maintenance/sql.php index 6a4cf0426b..3b0607f5fc 100644 --- a/maintenance/sql.php +++ b/maintenance/sql.php @@ -25,7 +25,7 @@ require_once __DIR__ . '/Maintenance.php'; use MediaWiki\MediaWikiServices; -use Wikimedia\Rdbms\ResultWrapper; +use Wikimedia\Rdbms\IResultWrapper; use Wikimedia\Rdbms\IDatabase; use Wikimedia\Rdbms\DBQueryError; @@ -186,7 +186,7 @@ class MwSql extends Maintenance { /** * Print the results, callback for $db->sourceStream() - * @param ResultWrapper|bool $res + * @param IResultWrapper|bool $res * @param IDatabase $db * @return int|null Number of rows selected or updated, or null if the query was unsuccessful. */ diff --git a/maintenance/userDupes.inc b/maintenance/userDupes.inc index 257c6beb4d..f759c13bac 100644 --- a/maintenance/userDupes.inc +++ b/maintenance/userDupes.inc @@ -24,6 +24,8 @@ * @ingroup Maintenance */ +use Wikimedia\Rdbms\IMaintainableDatabase; + /** * Look for duplicate user table entries and optionally prune them. * @@ -33,13 +35,21 @@ * @ingroup Maintenance */ class UserDupes { + /** + * @var IMaintainableDatabase + */ private $db; private $reassigned; private $trimmed; private $failed; private $outputCallback; - function __construct( &$database, $outputCallback ) { + /** + * UserDupes constructor. + * @param IMaintainableDatabase &$database + * @param callback $outputCallback + */ + public function __construct( &$database, $outputCallback ) { $this->db = $database; $this->outputCallback = $outputCallback; } @@ -57,7 +67,7 @@ class UserDupes { * user_name index applied. * @return bool */ - function hasUniqueIndex() { + public function hasUniqueIndex() { $info = $this->db->indexInfo( 'user', 'user_name', __METHOD__ ); if ( !$info ) { $this->out( "WARNING: doesn't seem to have user_name index at all!\n" ); @@ -82,7 +92,7 @@ class UserDupes { * * @return bool */ - function clearDupes() { + public function clearDupes() { return $this->checkDupes( true ); } @@ -100,7 +110,7 @@ class UserDupes { * from the database; false to just check. * @return bool */ - function checkDupes( $doDelete = false ) { + private function checkDupes( $doDelete = false ) { if ( $this->hasUniqueIndex() ) { echo wfWikiID() . " already has a unique index on its user table.\n"; @@ -163,9 +173,8 @@ class UserDupes { /** * We don't want anybody to mess with our stuff... - * @private */ - function lock() { + private function lock() { $set = [ 'user', 'revision' ]; $names = array_map( [ $this, 'lockTable' ], $set ); $tables = implode( ',', $names ); @@ -173,23 +182,22 @@ class UserDupes { $this->db->query( "LOCK TABLES $tables", __METHOD__ ); } - function lockTable( $table ) { + private function lockTable( $table ) { return $this->db->tableName( $table ) . ' WRITE'; } /** * @private */ - function unlock() { + private function unlock() { $this->db->query( "UNLOCK TABLES", __METHOD__ ); } /** * Grab usernames for which multiple records are present in the database. * @return array - * @private */ - function getDupes() { + private function getDupes() { $user = $this->db->tableName( 'user' ); $result = $this->db->query( "SELECT user_name,COUNT(*) AS n @@ -211,9 +219,8 @@ class UserDupes { * for edits. If the dupes have no edits, we can safely remove them. * @param string $name * @param bool $doDelete - * @private */ - function examine( $name, $doDelete ) { + private function examine( $name, $doDelete ) { $result = $this->db->select( 'user', [ 'user_id' ], [ 'user_name' => $name ], @@ -260,9 +267,8 @@ class UserDupes { * where it might show up... * @param int $userid * @return int - * @private */ - function editCount( $userid ) { + private function editCount( $userid ) { return intval( $this->db->selectField( 'revision', 'COUNT(*)', @@ -273,9 +279,8 @@ class UserDupes { /** * @param int $from * @param int $to - * @private */ - function reassignEdits( $from, $to ) { + private function reassignEdits( $from, $to ) { $this->out( 'reassigning... ' ); $this->db->update( 'revision', [ 'rev_user' => $to ], @@ -287,9 +292,8 @@ class UserDupes { /** * Remove a user account line. * @param int $userid - * @private */ - function trimAccount( $userid ) { + private function trimAccount( $userid ) { $this->out( "deleting..." ); $this->db->delete( 'user', [ 'user_id' => $userid ], __METHOD__ ); $this->out( " ok" ); diff --git a/resources/src/startup/startup.js b/resources/src/startup/startup.js index c251a86aa2..da048ffdff 100644 --- a/resources/src/startup/startup.js +++ b/resources/src/startup/startup.js @@ -74,7 +74,7 @@ function isCompatible( ua ) { // // Please extend the regex instead of adding new ones! // And add a test case to startup.test.js - !ua.match( /MSIE 10|webOS\/1\.[0-4]|SymbianOS|Series60|NetFront|Opera Mini|S40OviBrowser|MeeGo|Android.+Glass|^Mozilla\/5\.0 .+ Gecko\/$|googleweblight|PLAYSTATION|PlayStation/ ) + !ua.match( /MSIE 10|webOS\/1\.[0-4]|SymbianOS|NetFront|Opera Mini|S40OviBrowser|MeeGo|Android.+Glass|^Mozilla\/5\.0 .+ Gecko\/$|googleweblight|PLAYSTATION|PlayStation/ ) ); } diff --git a/tests/phpunit/includes/block/BlockManagerTest.php b/tests/phpunit/includes/block/BlockManagerTest.php index 39a5534027..40fe4c881d 100644 --- a/tests/phpunit/includes/block/BlockManagerTest.php +++ b/tests/phpunit/includes/block/BlockManagerTest.php @@ -2,6 +2,7 @@ use MediaWiki\Block\BlockManager; use MediaWiki\Block\DatabaseBlock; +use MediaWiki\Block\SystemBlock; /** * @group Blocking @@ -288,4 +289,38 @@ class BlockManagerTest extends MediaWikiTestCase { ], ]; } + + /** + * @covers ::getUniqueBlocks + */ + public function testGetUniqueBlocks() { + $blockId = 100; + + $class = new ReflectionClass( BlockManager::class ); + $method = $class->getMethod( 'getUniqueBlocks' ); + $method->setAccessible( true ); + + $blockManager = $this->getBlockManager( [] ); + + $block = $this->getMockBuilder( DatabaseBlock::class ) + ->setMethods( [ 'getId' ] ) + ->getMock(); + $block->expects( $this->any() ) + ->method( 'getId' ) + ->willReturn( $blockId ); + + $autoblock = $this->getMockBuilder( DatabaseBlock::class ) + ->setMethods( [ 'getParentBlockId', 'getType' ] ) + ->getMock(); + $autoblock->expects( $this->any() ) + ->method( 'getParentBlockId' ) + ->willReturn( $blockId ); + $autoblock->expects( $this->any() ) + ->method( 'getType' ) + ->willReturn( DatabaseBlock::TYPE_AUTO ); + + $blocks = [ $block, $block, $autoblock, new SystemBlock() ]; + + $this->assertSame( 2, count( $method->invoke( $blockManager, $blocks ) ) ); + } } diff --git a/tests/phpunit/structure/ResourcesTest.php b/tests/phpunit/structure/ResourcesTest.php index 4c34208e0d..78e57632f4 100644 --- a/tests/phpunit/structure/ResourcesTest.php +++ b/tests/phpunit/structure/ResourcesTest.php @@ -9,11 +9,9 @@ use Wikimedia\TestingAccessWrapper; * @author Antoine Musso * @author Niklas Laxström * @author Santhosh Thottingal - * @author Timo Tijhof * @copyright © 2012, Antoine Musso * @copyright © 2012, Niklas Laxström * @copyright © 2012, Santhosh Thottingal - * @copyright © 2012, Timo Tijhof */ class ResourcesTest extends MediaWikiTestCase { diff --git a/tests/qunit/data/load.mock.php b/tests/qunit/data/load.mock.php index 9f57190ea4..1525f0440f 100644 --- a/tests/qunit/data/load.mock.php +++ b/tests/qunit/data/load.mock.php @@ -18,9 +18,7 @@ * http://www.gnu.org/copyleft/gpl.html * * @file - * @package MediaWiki * @author Lupo - * @since 1.20 */ // This file doesn't run as part of MediaWiki diff --git a/tests/qunit/data/styleTest.css.php b/tests/qunit/data/styleTest.css.php index db96fd5325..5d229a3ab2 100644 --- a/tests/qunit/data/styleTest.css.php +++ b/tests/qunit/data/styleTest.css.php @@ -18,9 +18,6 @@ * http://www.gnu.org/copyleft/gpl.html * * @file - * @package MediaWiki - * @author Timo Tijhof - * @since 1.20 */ // This file doesn't run as part of MediaWiki