build: Update mediawiki/mediawiki-codesniffer to 35.0.0
Change-Id: Idb413be4b8cba8611afdc022af59810ce1a4531e
This commit is contained in:
parent
8a03ce6564
commit
62002cdcf1
29 changed files with 80 additions and 62 deletions
|
|
@ -5,6 +5,7 @@
|
|||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPrivate" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.WrongStyle" />
|
||||
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate" />
|
||||
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationProtected" />
|
||||
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPublic" />
|
||||
|
|
@ -13,6 +14,7 @@
|
|||
<exclude name="MediaWiki.Commenting.PropertyDocumentation.WrongStyle" />
|
||||
<exclude name="MediaWiki.ControlStructures.AssignmentInControlStructures.AssignmentInControlStructures" />
|
||||
<exclude name="MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName" />
|
||||
<exclude name="MediaWiki.PHPUnit.AssertCount.NotUsed" />
|
||||
<exclude name="MediaWiki.Usage.DbrQueryUsage.DbrQueryFound" />
|
||||
<exclude name="MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgContLang" />
|
||||
<exclude name="MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgTitle" />
|
||||
|
|
@ -22,11 +24,9 @@
|
|||
<exclude name="MediaWiki.Usage.ExtendClassUsage.FunctionVarUsage" />
|
||||
<exclude name="MediaWiki.Usage.ForbiddenFunctions.is_resource" />
|
||||
<exclude name="MediaWiki.Usage.ForbiddenFunctions.passthru" />
|
||||
<exclude name="MediaWiki.Usage.SuperGlobalsUsage.SuperGlobals" />
|
||||
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
|
||||
</rule>
|
||||
<!-- TODO Still to be done -->
|
||||
<rule ref="MediaWiki.Commenting.FunctionComment.WrongStyle">
|
||||
<exclude-pattern>includes/</exclude-pattern>
|
||||
<exclude name="PSR2.Classes.PropertyDeclaration.Multiple" />
|
||||
</rule>
|
||||
<!-- See T238572 -->
|
||||
<rule ref="MediaWiki.Commenting.FunctionComment.MissingParamTag">
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@
|
|||
"hamcrest/hamcrest-php": "^2.0",
|
||||
"johnkary/phpunit-speedtrap": "^3.1",
|
||||
"justinrainbow/json-schema": "~5.2",
|
||||
"mediawiki/mediawiki-codesniffer": "34.0.0",
|
||||
"mediawiki/mediawiki-codesniffer": "35.0.0",
|
||||
"mediawiki/mediawiki-phan-config": "0.10.6",
|
||||
"monolog/monolog": "~2.2.0",
|
||||
"nikic/php-parser": "4.10.2",
|
||||
|
|
|
|||
|
|
@ -128,7 +128,6 @@ class BadFileLookup {
|
|||
}
|
||||
|
||||
return isset( $this->badFiles[$name] ) && ( !$contextTitle ||
|
||||
!isset( $this->badFiles[$name][$contextTitle->getNamespace()]
|
||||
[$contextTitle->getDBkey()] ) );
|
||||
!isset( $this->badFiles[$name][$contextTitle->getNamespace()][$contextTitle->getDBkey()] ) );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@
|
|||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
// The point of this class is to be a wrapper around super globals
|
||||
// phpcs:disable MediaWiki.Usage.SuperGlobalsUsage.SuperGlobals
|
||||
|
||||
/**
|
||||
* Object to access the $_FILES array
|
||||
*
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
|
|||
/** @var DatabaseDomain */
|
||||
protected $currentDomain;
|
||||
|
||||
// phpcs:ignore MediaWiki.Commenting.PropertyDocumentation.ObjectTypeHintVar
|
||||
/** @var object|resource|null Database connection */
|
||||
protected $conn;
|
||||
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ class ProtectLogFormatter extends LogFormatter {
|
|||
$title = $this->entry->getTarget();
|
||||
$links = [];
|
||||
if ( $title->exists() ) {
|
||||
$links [] = $linkRenderer->makeLink( $title,
|
||||
$links[] = $linkRenderer->makeLink( $title,
|
||||
$this->msg( 'hist' )->text(),
|
||||
[],
|
||||
[
|
||||
|
|
|
|||
|
|
@ -455,7 +455,7 @@ class RefreshLinks extends Maintenance {
|
|||
do {
|
||||
$finalConds = $conds;
|
||||
$timestamp = $dbr->addQuotes( $timestamp );
|
||||
$finalConds [] =
|
||||
$finalConds[] =
|
||||
"(cl_timestamp > $timestamp OR (cl_timestamp = $timestamp AND cl_from > $lastId))";
|
||||
$res = $dbr->select( [ 'page', 'categorylinks' ],
|
||||
[ 'page_id', 'cl_timestamp' ],
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ namespace MediaWiki\HookContainer {
|
|||
] ] ]
|
||||
];
|
||||
$reset = $extensionRegistry->setAttributeForTest( 'Hooks', $handlers );
|
||||
$this->assertEquals( $numHandlersExecuted, 0 );
|
||||
$this->assertSame( 0, $numHandlersExecuted );
|
||||
$hookContainer->run( 'FooHook', [ &$numHandlersExecuted ] );
|
||||
$this->assertEquals( $numHandlersExecuted, 1 );
|
||||
$this->assertSame( 1, $numHandlersExecuted );
|
||||
ScopedCallback::consume( $reset );
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ namespace MediaWiki\HookContainer {
|
|||
];
|
||||
$reset3 = ExtensionRegistry::getInstance()->setAttributeForTest( 'Hooks', $handlerThree );
|
||||
$hookContainer->run( 'FooHook', [ &$numHandlersExecuted ] );
|
||||
$this->assertEquals( $numHandlersExecuted, 3 );
|
||||
$this->assertEquals( 3, $numHandlersExecuted );
|
||||
ScopedCallback::consume( $reset );
|
||||
ScopedCallback::consume( $reset2 );
|
||||
ScopedCallback::consume( $reset3 );
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ class MultiHttpClientTest extends MediaWikiIntegrationTestCase {
|
|||
] );
|
||||
|
||||
$this->assertEquals( 200, $rcode );
|
||||
$this->assertEquals( count( $headers ), count( $rhdrs ) );
|
||||
$this->assertSame( count( $headers ), count( $rhdrs ) );
|
||||
foreach ( $headers as $name => $values ) {
|
||||
$value = implode( ', ', $values );
|
||||
$this->assertArrayHasKey( $name, $rhdrs );
|
||||
|
|
|
|||
|
|
@ -1254,7 +1254,7 @@ class OutputPageTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
private function doCategoryLinkAsserts( OutputPage $op, $expectedNormal, $expectedHidden ) {
|
||||
$catLinks = $op->getCategoryLinks();
|
||||
$this->assertSame( (bool)$expectedNormal + (bool)$expectedHidden, count( $catLinks ) );
|
||||
$this->assertCount( (bool)$expectedNormal + (bool)$expectedHidden, $catLinks );
|
||||
if ( $expectedNormal ) {
|
||||
$this->assertSame( count( $expectedNormal ), count( $catLinks['normal'] ) );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,8 +134,8 @@ class McrRevisionStoreDbTest extends RevisionStoreDbTestBase {
|
|||
$queryInfo = $store->getQueryInfo();
|
||||
|
||||
// with the new schema enabled, query info should not join the main slot info
|
||||
$this->assertFalse( array_key_exists( 'a_slot_data', $queryInfo['tables'] ) );
|
||||
$this->assertFalse( array_key_exists( 'a_slot_data', $queryInfo['joins'] ) );
|
||||
$this->assertArrayNotHasKey( 'a_slot_data', $queryInfo['tables'] );
|
||||
$this->assertArrayNotHasKey( 'a_slot_data', $queryInfo['joins'] );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ class StatusTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
$warnings = $status->getWarningsArray();
|
||||
|
||||
$this->assertEquals( count( $messages ), count( $warnings ) );
|
||||
$this->assertSame( count( $messages ), count( $warnings ) );
|
||||
foreach ( $messages as $key => $message ) {
|
||||
$expectedArray = array_merge( [ $message->getKey() ], $message->getParams() );
|
||||
$this->assertEquals( $warnings[$key], $expectedArray );
|
||||
|
|
@ -188,7 +188,7 @@ class StatusTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
$errors = $status->getErrorsArray();
|
||||
|
||||
$this->assertEquals( count( $messages ), count( $errors ) );
|
||||
$this->assertSame( count( $messages ), count( $errors ) );
|
||||
foreach ( $messages as $key => $message ) {
|
||||
$expectedArray = array_merge( [ $message->getKey() ], $message->getParams() );
|
||||
$this->assertEquals( $errors[$key], $expectedArray );
|
||||
|
|
@ -210,7 +210,7 @@ class StatusTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
$errors = $status->getErrorsArray();
|
||||
|
||||
$this->assertEquals( count( $messages ), count( $errors ) );
|
||||
$this->assertSame( count( $messages ), count( $errors ) );
|
||||
foreach ( $messages as $key => $message ) {
|
||||
$expectedArray = array_merge( [ $message->getKey() ], $message->getParams() );
|
||||
$this->assertEquals( $errors[$key], $expectedArray );
|
||||
|
|
|
|||
|
|
@ -1776,8 +1776,8 @@ class TitleTest extends MediaWikiIntegrationTestCase {
|
|||
[ 'edit' => [ 'sysop' ] ],
|
||||
$result[1]
|
||||
);
|
||||
$this->assertTrue(
|
||||
array_key_exists( $anotherPage->getTitle()->getArticleID(), $result[0] )
|
||||
$this->assertArrayHasKey(
|
||||
$anotherPage->getTitle()->getArticleID(), $result[0]
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -338,7 +338,7 @@ class ContentHandlerTest extends MediaWikiIntegrationTestCase {
|
|||
wfMessage( 'autosumm-newblank' )->inContentLanguage()->text() );
|
||||
// now check, what we become with another bitmask
|
||||
$autoSummary = $content->getAutosummary( null, $newContent, 92 );
|
||||
$this->assertEquals( $autoSummary, '' );
|
||||
$this->assertSame( '', $autoSummary );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -354,7 +354,7 @@ class ContentHandlerTest extends MediaWikiIntegrationTestCase {
|
|||
$newContent = ContentHandler::makeContent( '', null, CONTENT_MODEL_WIKITEXT, null );
|
||||
// Get the tag for this edit
|
||||
$tag = $wikitextContentHandler->getChangeTag( $oldContent, $newContent, EDIT_UPDATE );
|
||||
$this->assertSame( $tag, 'mw-contentmodelchange' );
|
||||
$this->assertSame( 'mw-contentmodelchange', $tag );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -716,7 +716,7 @@ class LoadBalancerTest extends MediaWikiIntegrationTestCase {
|
|||
$mainIndexPicked,
|
||||
$lbWrapper->getExistingReaderIndex( $lb::GROUP_GENERIC )
|
||||
);
|
||||
$this->assertTrue( in_array( $mainIndexPicked, [ 1, 2 ] ) );
|
||||
$this->assertContains( $mainIndexPicked, [ 1, 2 ] );
|
||||
for ( $i = 0; $i < 300; ++$i ) {
|
||||
$rLog = $lb->getConnectionRef( DB_REPLICA, [] );
|
||||
$this->assertEquals(
|
||||
|
|
@ -739,7 +739,7 @@ class LoadBalancerTest extends MediaWikiIntegrationTestCase {
|
|||
$logIndexPicked = $rLog->getLBInfo( 'serverIndex' );
|
||||
|
||||
$this->assertEquals( $logIndexPicked, $lbWrapper->getExistingReaderIndex( 'logging' ) );
|
||||
$this->assertTrue( in_array( $logIndexPicked, [ 4, 5 ] ) );
|
||||
$this->assertContains( $logIndexPicked, [ 4, 5 ] );
|
||||
|
||||
for ( $i = 0; $i < 300; ++$i ) {
|
||||
$rLog = $lb->getConnectionRef( DB_REPLICA, [ 'logging', 'watchlist' ] );
|
||||
|
|
|
|||
|
|
@ -1309,7 +1309,7 @@ class FileBackendIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
array_keys( $contents ),
|
||||
"Contents in right order ($backendName)."
|
||||
);
|
||||
$this->assertEquals(
|
||||
$this->assertSame(
|
||||
count( $source ),
|
||||
count( $contents ),
|
||||
"Contents array size correct ($backendName)."
|
||||
|
|
@ -1383,7 +1383,7 @@ class FileBackendIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
array_keys( $tmpFiles ),
|
||||
"Local copies in right order ($backendName)."
|
||||
);
|
||||
$this->assertEquals(
|
||||
$this->assertSame(
|
||||
count( $source ),
|
||||
count( $tmpFiles ),
|
||||
"Local copies array size correct ($backendName)."
|
||||
|
|
@ -1468,7 +1468,7 @@ class FileBackendIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
array_keys( $tmpFiles ),
|
||||
"Local refs in right order ($backendName)."
|
||||
);
|
||||
$this->assertEquals(
|
||||
$this->assertSame(
|
||||
count( $source ),
|
||||
count( $tmpFiles ),
|
||||
"Local refs array size correct ($backendName)."
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ abstract class GenericArrayObjectTest extends PHPUnit\Framework\TestCase {
|
|||
$copy = unserialize( $serialization );
|
||||
|
||||
$this->assertEquals( $serialization, serialize( $copy ) );
|
||||
$this->assertEquals( count( $list ), count( $copy ) );
|
||||
$this->assertSame( count( $list ), count( $copy ) );
|
||||
|
||||
$list = $list->getArrayCopy();
|
||||
$copy = $copy->getArrayCopy();
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ class CoreParserFunctionsTest extends MediaWikiLangTestCase {
|
|||
$user->saveSettings();
|
||||
|
||||
$msg = ( new RawMessage( '{{GENDER:*Female|m|f|o}}' ) )->parse();
|
||||
$this->assertEquals( $msg, 'f', 'Works unescaped' );
|
||||
$this->assertEquals( 'f', $msg, 'Works unescaped' );
|
||||
$escapedName = wfEscapeWikiText( '*Female' );
|
||||
$msg2 = ( new RawMessage( '{{GENDER:' . $escapedName . '|m|f|o}}' ) )
|
||||
->parse();
|
||||
$this->assertEquals( $msg2, 'f', 'Works escaped' );
|
||||
$this->assertEquals( 'f', $msg2, 'Works escaped' );
|
||||
}
|
||||
|
||||
public function provideTalkpagename() {
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class SiteTest extends MediaWikiIntegrationTestCase {
|
|||
*/
|
||||
public function testAddNavigationId( Site $site ) {
|
||||
$site->addNavigationId( 'foobar' );
|
||||
$this->assertTrue( in_array( 'foobar', $site->getNavigationIds(), true ) );
|
||||
$this->assertContains( 'foobar', $site->getNavigationIds() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -67,7 +67,7 @@ class SiteTest extends MediaWikiIntegrationTestCase {
|
|||
*/
|
||||
public function testAddInterwikiId( Site $site ) {
|
||||
$site->addInterwikiId( 'foobar' );
|
||||
$this->assertTrue( in_array( 'foobar', $site->getInterwikiIds(), true ) );
|
||||
$this->assertContains( 'foobar', $site->getInterwikiIds() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1607,8 +1607,8 @@ class UserTest extends MediaWikiIntegrationTestCase {
|
|||
* @covers User::idFromName
|
||||
*/
|
||||
public function testExistingIdFromName() {
|
||||
$this->assertTrue(
|
||||
array_key_exists( $this->user->getName(), User::$idCacheByName ),
|
||||
$this->assertArrayHasKey(
|
||||
$this->user->getName(), User::$idCacheByName,
|
||||
'Test user should already be in the id cache.'
|
||||
);
|
||||
$this->assertSame(
|
||||
|
|
@ -1625,13 +1625,13 @@ class UserTest extends MediaWikiIntegrationTestCase {
|
|||
* @covers User::idFromName
|
||||
*/
|
||||
public function testNonExistingIdFromName() {
|
||||
$this->assertFalse(
|
||||
array_key_exists( 'NotExisitngUser', User::$idCacheByName ),
|
||||
$this->assertArrayNotHasKey(
|
||||
'NotExisitngUser', User::$idCacheByName,
|
||||
'Non exisitng user should not be in the id cache.'
|
||||
);
|
||||
$this->assertNull( User::idFromName( 'NotExisitngUser' ) );
|
||||
$this->assertTrue(
|
||||
array_key_exists( 'NotExisitngUser', User::$idCacheByName ),
|
||||
$this->assertArrayHasKey(
|
||||
'NotExisitngUser', User::$idCacheByName,
|
||||
'Username will be cached when requested once.'
|
||||
);
|
||||
$this->assertNull( User::idFromName( 'NotExistingUser' ) );
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ class DatabaseBlockStoreTest extends MediaWikiIntegrationTestCase {
|
|||
$this->assertIsArray( $result );
|
||||
$this->assertArrayHasKey( 'id', $result );
|
||||
$this->assertArrayHasKey( 'autoIds', $result );
|
||||
$this->assertSame( 0, count( $result['autoIds'] ) );
|
||||
$this->assertCount( 0, $result['autoIds'] );
|
||||
|
||||
$retrievedBlock = DatabaseBlock::newFromId( $result['id'] );
|
||||
$this->assertTrue( $block->equals( $retrievedBlock ) );
|
||||
|
|
|
|||
|
|
@ -195,8 +195,8 @@ class LanguageConverterTest extends MediaWikiLangTestCase {
|
|||
$this->setIniSetting( 'pcre.backtrack_limit', 200 );
|
||||
$result = $this->lc->autoConvert( $testString, 'tg-latn' );
|
||||
// The в in the id attribute should not get converted to a v
|
||||
$this->assertFalse(
|
||||
strpos( $result, 'v' ),
|
||||
$this->assertStringNotContainsString(
|
||||
$result, 'v',
|
||||
"в converted to v despite being in attribue"
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ class BaseDumpTest extends MediaWikiIntegrationTestCase {
|
|||
// Putting together the content of the prefetch files
|
||||
$content = $header;
|
||||
foreach ( $requested_pages as $i ) {
|
||||
$this->assertTrue( array_key_exists( $i, $available_pages ),
|
||||
$this->assertArrayHasKey( $i, $available_pages,
|
||||
"Check for availability of requested page " . $i );
|
||||
$content .= $available_pages[$i];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ class RestStructureTest extends MediaWikiIntegrationTestCase {
|
|||
foreach ( $method as $m ) {
|
||||
$key = "{$m} {$spec['path']}";
|
||||
|
||||
$this->assertFalse( array_key_exists( $key, $routes ), "{$key} already exists in routes" );
|
||||
$this->assertArrayNotHasKey( $key, $routes, "{$key} already exists in routes" );
|
||||
|
||||
$routes[$key] = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ namespace MediaWiki\HookContainer {
|
|||
// handlers registered in 2 different ways
|
||||
$this->assertCount( 2, $hookContainer->getLegacyHandlers( 'MWTestHook' ) );
|
||||
$hookContainer->run( 'MWTestHook' );
|
||||
$this->assertEquals( $numCalls, 2 );
|
||||
$this->assertEquals( 2, $numCalls );
|
||||
|
||||
// Remove one of the handlers that increments $called
|
||||
ScopedCallback::consume( $reset );
|
||||
|
|
@ -226,7 +226,7 @@ namespace MediaWiki\HookContainer {
|
|||
|
||||
$numCalls = 0;
|
||||
$hookContainer->run( 'MWTestHook' );
|
||||
$this->assertEquals( $numCalls, 1 );
|
||||
$this->assertSame( 1, $numCalls );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class JsonBodyValidatorTest extends \MediaWikiUnitTestCase {
|
|||
public function provideValidateBody() {
|
||||
yield 'empty object' => [
|
||||
[],
|
||||
$request = new RequestData( [
|
||||
new RequestData( [
|
||||
'bodyContents' => json_encode( (object)[] ),
|
||||
] ),
|
||||
[]
|
||||
|
|
@ -24,7 +24,7 @@ class JsonBodyValidatorTest extends \MediaWikiUnitTestCase {
|
|||
|
||||
yield 'extra data' => [
|
||||
[],
|
||||
$request = new RequestData( [
|
||||
new RequestData( [
|
||||
'bodyContents' => json_encode( (object)[
|
||||
'kittens' => 'cute',
|
||||
'number' => 5,
|
||||
|
|
@ -43,7 +43,7 @@ class JsonBodyValidatorTest extends \MediaWikiUnitTestCase {
|
|||
ParamValidator::PARAM_REQUIRED => false,
|
||||
]
|
||||
],
|
||||
$request = new RequestData( [
|
||||
new RequestData( [
|
||||
'bodyContents' => json_encode( (object)[
|
||||
'kittens' => 'cute',
|
||||
] ),
|
||||
|
|
@ -62,7 +62,7 @@ class JsonBodyValidatorTest extends \MediaWikiUnitTestCase {
|
|||
ParamValidator::PARAM_DEFAULT => 10,
|
||||
]
|
||||
],
|
||||
$request = new RequestData( [
|
||||
new RequestData( [
|
||||
'bodyContents' => json_encode( (object)[] ),
|
||||
] ),
|
||||
[
|
||||
|
|
@ -83,7 +83,7 @@ class JsonBodyValidatorTest extends \MediaWikiUnitTestCase {
|
|||
public function provideValidateBody_failure() {
|
||||
yield 'empty body' => [
|
||||
[],
|
||||
$request = new RequestData( [
|
||||
new RequestData( [
|
||||
'bodyContents' => '',
|
||||
] ),
|
||||
new LocalizedHttpException( new MessageValue( 'rest-json-body-parse-error' ), 400 ),
|
||||
|
|
@ -91,7 +91,7 @@ class JsonBodyValidatorTest extends \MediaWikiUnitTestCase {
|
|||
|
||||
yield 'bad syntax' => [
|
||||
[],
|
||||
$request = new RequestData( [
|
||||
new RequestData( [
|
||||
'bodyContents' => '.....',
|
||||
] ),
|
||||
new LocalizedHttpException( new MessageValue( 'rest-json-body-parse-error' ), 400 ),
|
||||
|
|
@ -99,7 +99,7 @@ class JsonBodyValidatorTest extends \MediaWikiUnitTestCase {
|
|||
|
||||
yield 'not an object' => [
|
||||
[],
|
||||
$request = new RequestData( [
|
||||
new RequestData( [
|
||||
'bodyContents' => json_encode( 'evil' ),
|
||||
] ),
|
||||
new LocalizedHttpException( new MessageValue( 'rest-bad-json-body' ), 400 ),
|
||||
|
|
@ -112,7 +112,7 @@ class JsonBodyValidatorTest extends \MediaWikiUnitTestCase {
|
|||
ParamValidator::PARAM_REQUIRED => true,
|
||||
]
|
||||
],
|
||||
$request = new RequestData( [
|
||||
new RequestData( [
|
||||
'bodyContents' => json_encode( (object)[
|
||||
'kittens' => 'cute',
|
||||
] ),
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ class XhprofDataTest extends PHPUnit\Framework\TestCase {
|
|||
$this->assertSame( $last, $func );
|
||||
$last = $call;
|
||||
}
|
||||
$this->assertSame( $last, 'bar@1' );
|
||||
$this->assertSame( 'bar@1', $last );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -97,17 +97,32 @@ class XhprofTest extends PHPUnit\Framework\TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
/** Test function #1 for XhprofTest::testCallAny */
|
||||
/**
|
||||
* Test function #1 for XhprofTest::testCallAny
|
||||
* @param int $a
|
||||
* @param int $b
|
||||
* @return int
|
||||
*/
|
||||
function wfTestCallAny_func1( $a, $b ) {
|
||||
return $a * $b;
|
||||
}
|
||||
|
||||
/** Test function #2 for XhprofTest::testCallAny */
|
||||
/**
|
||||
* Test function #2 for XhprofTest::testCallAny
|
||||
* @param int $a
|
||||
* @param int $b
|
||||
* @return int
|
||||
*/
|
||||
function wfTestCallAny_func2( $a, $b ) {
|
||||
return $a + $b;
|
||||
}
|
||||
|
||||
/** Test function #3 for XhprofTest::testCallAny */
|
||||
/**
|
||||
* Test function #3 for XhprofTest::testCallAny
|
||||
* @param int $a
|
||||
* @param int $b
|
||||
* @return int
|
||||
*/
|
||||
function wfTestCallAny_func3( $a, $b ) {
|
||||
return $a - $b;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -905,9 +905,9 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
|
|||
$preemptiveRefresh = ( $expiring || $popular );
|
||||
$v = $cache->getMultiWithSetCallback( $keyedIds, 30, $genFunc );
|
||||
$this->assertSame( 0, $wasSet, "No values generated" );
|
||||
$this->assertSame(
|
||||
$this->assertCount(
|
||||
$preemptiveRefresh ? count( $idsByKey ) : 0,
|
||||
count( $deferredCbs ),
|
||||
$deferredCbs,
|
||||
"Deferred callbacks queued"
|
||||
);
|
||||
foreach ( $idsByKey as $key => $id ) {
|
||||
|
|
@ -1153,9 +1153,9 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
|
|||
$preemptiveRefresh = ( $expiring || $popular );
|
||||
$v = $cache->getMultiWithUnionSetCallback( $keyedIds, 30, $genFunc );
|
||||
$this->assertSame( count( $idsByKey ), $wasSet, "Deferred callbacks did not run yet" );
|
||||
$this->assertSame(
|
||||
$this->assertCount(
|
||||
$preemptiveRefresh ? count( $idsByKey ) : 0,
|
||||
count( $deferredCbs ),
|
||||
$deferredCbs,
|
||||
"Deferred callbacks queued"
|
||||
);
|
||||
foreach ( $idsByKey as $key => $id ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue