Replace all call_user_func(_array) in all tests
There is native support for all of this now in PHP, thanks to changes and additions that have been made in later versions. There should be no need any more to ever use call_user_func() or call_user_func_array(). Reviewing this should be fairly easy: Because this patch touches exclusivly tests, but no production code, there is no such thing as "insufficent test coverage". As long as CI goes green, this should be fine. Change-Id: Ib9690103687734bb5a85d3dab0e5642a07087bbc
This commit is contained in:
parent
f8a8ec1e73
commit
6aa6d10e86
32 changed files with 52 additions and 68 deletions
|
|
@ -13,7 +13,7 @@ class MultiTestRecorder extends TestRecorder {
|
|||
|
||||
private function proxy( $funcName, $args ) {
|
||||
foreach ( $this->recorders as $recorder ) {
|
||||
call_user_func_array( [ $recorder, $funcName ], $args );
|
||||
$recorder->$funcName( ...$args );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -864,7 +864,7 @@ class ParserTestRunner {
|
|||
if ( $t->equals( $title ) ) {
|
||||
return $revRecord;
|
||||
} else {
|
||||
return call_user_func( $oldCallback, $t, $parser );
|
||||
return $oldCallback( $t, $parser );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -154,10 +154,7 @@ trait MediaWikiTestCaseTrait {
|
|||
$actual = array_values( $actual );
|
||||
}
|
||||
|
||||
call_user_func_array(
|
||||
[ $this, 'assertEquals' ],
|
||||
array_merge( [ $expected, $actual ], array_slice( func_get_args(), 4 ) )
|
||||
);
|
||||
$this->assertEquals( $expected, $actual, ...array_slice( func_get_args(), 4 ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ class MessageTest extends MediaWikiLangTestCase {
|
|||
public function testConstructorParams( $expected, $args ) {
|
||||
$msg = new Message( 'imasomething' );
|
||||
|
||||
$returned = call_user_func_array( [ $msg, 'params' ], $args );
|
||||
$returned = $msg->params( ...$args );
|
||||
|
||||
$this->assertSame( $msg, $returned );
|
||||
$this->assertSame( $expected, $msg->getParams() );
|
||||
|
|
|
|||
|
|
@ -153,10 +153,7 @@ class DerivedPageDataUpdaterTest extends MediaWikiTestCase {
|
|||
|
||||
$options2 = $updater->getCanonicalParserOptions();
|
||||
|
||||
$currentRev = call_user_func(
|
||||
$options2->getCurrentRevisionRecordCallback(),
|
||||
$page->getTitle()
|
||||
);
|
||||
$currentRev = $options2->getCurrentRevisionRecordCallback()( $page->getTitle() );
|
||||
$this->assertSame( $rev->getId(), $currentRev->getId() );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class NameTableStoreTest extends MediaWikiTestCase {
|
|||
$mock->expects( is_int( $count ) ? $this->exactly( $count ) : $this->any() )
|
||||
->method( $method )
|
||||
->willReturnCallback( function ( ...$args ) use ( $method ) {
|
||||
return call_user_func_array( [ $this->db, $method ], $args );
|
||||
return $this->db->$method( ...$args );
|
||||
} );
|
||||
}
|
||||
return $mock;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@ class TestLogger extends \Psr\Log\AbstractLogger {
|
|||
private $collect = false;
|
||||
private $collectContext = false;
|
||||
private $buffer = [];
|
||||
private $filter = null;
|
||||
/** @var callable|null */
|
||||
private $filter;
|
||||
|
||||
/**
|
||||
* @param bool $collect Whether to collect logs. @see setCollect()
|
||||
|
|
@ -91,7 +92,7 @@ class TestLogger extends \Psr\Log\AbstractLogger {
|
|||
$message = trim( $message );
|
||||
|
||||
if ( $this->filter ) {
|
||||
$message = call_user_func( $this->filter, $message, $level, $context );
|
||||
$message = ( $this->filter )( $message, $level, $context );
|
||||
if ( $message === null ) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class ApiBaseTest extends ApiTestCase {
|
|||
public function testStubMethods( $expected, $method, $args = [] ) {
|
||||
// Some of these are protected
|
||||
$mock = TestingAccessWrapper::newFromObject( new MockApi() );
|
||||
$result = call_user_func_array( [ $mock, $method ], $args );
|
||||
$result = $mock->$method( ...$args );
|
||||
$this->assertSame( $expected, $result );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ class ApiParseTest extends ApiTestCase {
|
|||
$html = preg_replace( $expectedEnd, '', $html );
|
||||
}
|
||||
|
||||
call_user_func( $callback, $expected, $html );
|
||||
$callback( $expected, $html );
|
||||
|
||||
if ( $warnings === null ) {
|
||||
$this->assertCount( 1, $res[0] );
|
||||
|
|
|
|||
|
|
@ -49,10 +49,8 @@ class ApiQueryUserContribsTest extends ApiTestCase {
|
|||
$params['ucuser'] = implode( '|', $params['ucuser'] );
|
||||
}
|
||||
|
||||
$sort = 'rsort';
|
||||
if ( $reverse ) {
|
||||
$params['ucdir'] = 'newer';
|
||||
$sort = 'sort';
|
||||
}
|
||||
|
||||
$params += [
|
||||
|
|
@ -75,7 +73,7 @@ class ApiQueryUserContribsTest extends ApiTestCase {
|
|||
$this->assertSame( $revs, $count, 'Expected number of revisions' );
|
||||
foreach ( $ids as $user => $revids ) {
|
||||
$sorted = $revids;
|
||||
call_user_func_array( $sort, [ &$sorted ] );
|
||||
$reverse ? sort( $sorted ) : rsort( $sorted );
|
||||
$this->assertSame( $sorted, $revids, "IDs for $user are sorted" );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ class AuthenticationRequestTest extends \MediaWikiTestCase {
|
|||
$ret = $mock->loadFromSubmission( $data );
|
||||
if ( is_array( $expectState ) ) {
|
||||
$this->assertTrue( $ret );
|
||||
$expect = call_user_func( [ get_class( $mock ), '__set_state' ], $expectState );
|
||||
$expect = $mock::__set_state( $expectState );
|
||||
$this->assertEquals( $expect, $mock );
|
||||
} else {
|
||||
$this->assertFalse( $ret );
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ abstract class AuthenticationRequestTestCase extends \MediaWikiTestCase {
|
|||
$ret = $instance->loadFromSubmission( $data );
|
||||
if ( is_array( $expectState ) ) {
|
||||
$this->assertTrue( $ret );
|
||||
$expect = call_user_func( [ get_class( $instance ), '__set_state' ], $expectState );
|
||||
$expect = $instance::__set_state( $expectState );
|
||||
$this->assertEquals( $expect, $instance );
|
||||
} else {
|
||||
$this->assertFalse( $ret );
|
||||
|
|
|
|||
|
|
@ -443,7 +443,7 @@ class LocalPasswordPrimaryAuthenticationProviderTest extends \MediaWikiTestCase
|
|||
$testUser = $this->getMutableTestUser();
|
||||
$user = $testUser->getUser()->getName();
|
||||
if ( is_callable( $usernameTransform ) ) {
|
||||
$user = call_user_func( $usernameTransform, $user );
|
||||
$user = $usernameTransform( $user );
|
||||
}
|
||||
$cuser = ucfirst( $user );
|
||||
$oldpass = $testUser->getPassword();
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class ResetPasswordSecondaryAuthenticationProviderTest extends \MediaWikiTestCas
|
|||
$mock->expects( $this->once() )->method( 'tryReset' )
|
||||
->with( $this->identicalTo( $user ), $this->identicalTo( $reqs ) )
|
||||
->will( $this->returnValue( $obj ) );
|
||||
$this->assertSame( $obj, call_user_func_array( [ $mock, $method ], $args ) );
|
||||
$this->assertSame( $obj, $mock->$method( ...$args ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,10 +32,8 @@ class ChangeTagsTest extends MediaWikiTestCase {
|
|||
ChangeTags::updateTags( [ 'foo', 'bar' ], [], $rcId );
|
||||
// HACK resolve deferred group concats (see comment in provideModifyDisplayQuery)
|
||||
if ( isset( $modifiedQuery['fields']['ts_tags'] ) ) {
|
||||
$modifiedQuery['fields']['ts_tags'] = call_user_func_array(
|
||||
[ wfGetDB( DB_REPLICA ), 'buildGroupConcatField' ],
|
||||
$modifiedQuery['fields']['ts_tags']
|
||||
);
|
||||
$modifiedQuery['fields']['ts_tags'] = wfGetDB( DB_REPLICA )
|
||||
->buildGroupConcatField( ...$modifiedQuery['fields']['ts_tags'] );
|
||||
}
|
||||
if ( isset( $modifiedQuery['exception'] ) ) {
|
||||
$this->expectException( $modifiedQuery['exception'] );
|
||||
|
|
|
|||
|
|
@ -85,8 +85,8 @@ class TextContentTest extends MediaWikiLangTestCase {
|
|||
|
||||
if ( $expectedFields ) {
|
||||
foreach ( $expectedFields as $field => $exp ) {
|
||||
$f = 'get' . ucfirst( $field );
|
||||
$v = call_user_func( [ $po, $f ] );
|
||||
$getter = 'get' . ucfirst( $field );
|
||||
$v = $po->$getter();
|
||||
|
||||
if ( is_array( $exp ) ) {
|
||||
$this->assertArrayEquals( $exp, $v );
|
||||
|
|
|
|||
|
|
@ -261,6 +261,7 @@ class LBFactoryTest extends MediaWikiTestCase {
|
|||
$m2Pos = new MySQLMasterPos( 'db1064-bin.002400/794074907', $now );
|
||||
|
||||
// Master DB 1
|
||||
/** @var IDatabase|\PHPUnit\Framework\MockObject\MockObject $mockDB1 */
|
||||
$mockDB1 = $this->getMockBuilder( IDatabase::class )
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
|
@ -279,8 +280,8 @@ class LBFactoryTest extends MediaWikiTestCase {
|
|||
$lb1->method( 'hasOrMadeRecentMasterChanges' )->will( $this->returnCallback(
|
||||
function () use ( $mockDB1 ) {
|
||||
$p = 0;
|
||||
$p |= call_user_func( [ $mockDB1, 'writesOrCallbacksPending' ] );
|
||||
$p |= call_user_func( [ $mockDB1, 'lastDoneWrites' ] );
|
||||
$p |= $mockDB1->writesOrCallbacksPending();
|
||||
$p |= $mockDB1->lastDoneWrites();
|
||||
|
||||
return (bool)$p;
|
||||
}
|
||||
|
|
@ -289,6 +290,7 @@ class LBFactoryTest extends MediaWikiTestCase {
|
|||
$lb1->method( 'getReplicaResumePos' )->willReturn( $m1Pos );
|
||||
$lb1->method( 'getServerName' )->with( 0 )->willReturn( 'master1' );
|
||||
// Master DB 2
|
||||
/** @var IDatabase|\PHPUnit\Framework\MockObject\MockObject $mockDB2 */
|
||||
$mockDB2 = $this->getMockBuilder( IDatabase::class )
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
|
@ -307,8 +309,8 @@ class LBFactoryTest extends MediaWikiTestCase {
|
|||
$lb2->method( 'hasOrMadeRecentMasterChanges' )->will( $this->returnCallback(
|
||||
function () use ( $mockDB2 ) {
|
||||
$p = 0;
|
||||
$p |= call_user_func( [ $mockDB2, 'writesOrCallbacksPending' ] );
|
||||
$p |= call_user_func( [ $mockDB2, 'lastDoneWrites' ] );
|
||||
$p |= $mockDB2->writesOrCallbacksPending();
|
||||
$p |= $mockDB2->lastDoneWrites();
|
||||
|
||||
return (bool)$p;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ class CSSMinTest extends MediaWikiTestCase {
|
|||
* @covers CSSMin::remapOne
|
||||
*/
|
||||
public function testRemap( $message, $params, $expectedOutput ) {
|
||||
$remapped = call_user_func_array( 'CSSMin::remap', $params );
|
||||
$remapped = CSSMin::remap( ...$params );
|
||||
|
||||
$messageAdd = " Case: $message";
|
||||
$this->assertEquals(
|
||||
|
|
@ -338,7 +338,7 @@ class CSSMinTest extends MediaWikiTestCase {
|
|||
* @covers CSSMin
|
||||
*/
|
||||
public function testRemapEmptyUrl( $params, $expected ) {
|
||||
$remapped = call_user_func_array( 'CSSMin::remap', $params );
|
||||
$remapped = CSSMin::remap( ...$params );
|
||||
$this->assertEquals( $expected, $remapped, 'Ignore empty url' );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ abstract class GenericArrayObjectTest extends PHPUnit\Framework\TestCase {
|
|||
$validValid = $element instanceof $elementClass;
|
||||
|
||||
try {
|
||||
call_user_func( $function, $list, $element );
|
||||
$function( $list, $element );
|
||||
$valid = true;
|
||||
} catch ( InvalidArgumentException $exception ) {
|
||||
$valid = false;
|
||||
|
|
|
|||
|
|
@ -2289,7 +2289,7 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
|
|||
|
||||
// Implicit transaction does not get silently rolled back
|
||||
$this->database->begin( __METHOD__, Database::TRANSACTION_INTERNAL );
|
||||
call_user_func( $doError );
|
||||
$doError();
|
||||
try {
|
||||
$this->database->delete( 'x', [ 'field' => 1 ], __METHOD__ );
|
||||
$this->fail( 'Expected exception not thrown' );
|
||||
|
|
@ -2314,7 +2314,7 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
|
|||
// Likewise if there were prior writes
|
||||
$this->database->begin( __METHOD__, Database::TRANSACTION_INTERNAL );
|
||||
$this->database->delete( 'x', [ 'field' => 1 ], __METHOD__ );
|
||||
call_user_func( $doError );
|
||||
$doError();
|
||||
try {
|
||||
$this->database->delete( 'x', [ 'field' => 1 ], __METHOD__ );
|
||||
$this->fail( 'Expected exception not thrown' );
|
||||
|
|
@ -2352,7 +2352,7 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
|
|||
// Rollback doesn't raise a warning
|
||||
$warning = [];
|
||||
$this->database->startAtomic( __METHOD__ );
|
||||
call_user_func( $doError );
|
||||
$doError();
|
||||
$this->database->rollback( __METHOD__ );
|
||||
$this->database->delete( 'x', [ 'field' => 1 ], __METHOD__ );
|
||||
$this->assertSame( [], $warning );
|
||||
|
|
@ -2363,7 +2363,7 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
|
|||
$warning = [];
|
||||
$this->database->begin( __METHOD__ );
|
||||
$this->database->startAtomic( __METHOD__, Database::ATOMIC_CANCELABLE );
|
||||
call_user_func( $doError );
|
||||
$doError();
|
||||
$this->database->cancelAtomic( __METHOD__ );
|
||||
$this->database->delete( 'x', [ 'field' => 1 ], __METHOD__ );
|
||||
$this->database->commit( __METHOD__ );
|
||||
|
|
@ -2374,7 +2374,7 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
|
|||
// Commit does raise a warning
|
||||
$warning = [];
|
||||
$this->database->begin( __METHOD__ );
|
||||
call_user_func( $doError );
|
||||
$doError();
|
||||
$this->database->commit( __METHOD__ );
|
||||
$this->assertSame( [ $expectWarning ], $warning );
|
||||
$this->assertLastSql( 'BEGIN; DELETE FROM error WHERE 1; COMMIT' );
|
||||
|
|
@ -2382,7 +2382,7 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
|
|||
// Deprecation only gets raised once
|
||||
$warning = [];
|
||||
$this->database->begin( __METHOD__ );
|
||||
call_user_func( $doError );
|
||||
$doError();
|
||||
$this->database->delete( 'x', [ 'field' => 1 ], __METHOD__ );
|
||||
$this->database->commit( __METHOD__ );
|
||||
$this->assertSame( [ $expectWarning ], $warning );
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class GlobalIdGeneratorTest extends PHPUnit\Framework\TestCase {
|
|||
public function testTimestampedUID( $method, $digitlen, $bits, $tbits, $hostbits ) {
|
||||
$gen = $this->getGlobalIdGenerator();
|
||||
|
||||
$id = call_user_func( [ $gen, $method ] );
|
||||
$id = $gen->$method();
|
||||
$this->assertTrue( ctype_digit( $id ), "UID made of digit characters" );
|
||||
$this->assertLessThanOrEqual( $digitlen, strlen( $id ),
|
||||
"UID has the right number of digits" );
|
||||
|
|
@ -28,7 +28,7 @@ class GlobalIdGeneratorTest extends PHPUnit\Framework\TestCase {
|
|||
|
||||
$ids = [];
|
||||
for ( $i = 0; $i < 300; $i++ ) {
|
||||
$ids[] = call_user_func( [ $gen, $method ] );
|
||||
$ids[] = $gen->$method();
|
||||
}
|
||||
|
||||
$lastId = array_shift( $ids );
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ class SanitizerTest extends MediaWikiTestCase {
|
|||
'wgFragmentMode' => $config,
|
||||
'wgExternalInterwikiFragmentMode' => $iwFlavor,
|
||||
] );
|
||||
$escaped = call_user_func( $func, $id, $mode );
|
||||
$escaped = $func( $id, $mode );
|
||||
self::assertEquals( $expected, $escaped );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,6 +79,6 @@ class PoolCounterTest extends MediaWikiTestCase {
|
|||
// in which case we could not test the constructor.
|
||||
abstract class PoolCounterAbstractMock extends PoolCounter {
|
||||
public function __construct( ...$args ) {
|
||||
call_user_func_array( 'parent::__construct', $args );
|
||||
parent::__construct( ...$args );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -326,7 +326,7 @@ class PHPSessionHandlerTest extends MediaWikiTestCase {
|
|||
|
||||
$this->expectException( BadMethodCallException::class );
|
||||
$this->expectExceptionMessage( "Attempt to use PHP session management" );
|
||||
call_user_func_array( [ $handler, $method ], $args );
|
||||
$handler->$method( ...$args );
|
||||
}
|
||||
|
||||
public static function provideDisabled() {
|
||||
|
|
@ -350,7 +350,7 @@ class PHPSessionHandlerTest extends MediaWikiTestCase {
|
|||
|
||||
$this->expectException( UnexpectedValueException::class );
|
||||
$this->expectExceptionMessageMatches( "/: Wrong instance called!$/" );
|
||||
call_user_func_array( [ $handler, $method ], $args );
|
||||
$handler->$method( ...$args );
|
||||
}
|
||||
|
||||
public static function provideWrongInstance() {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class ShellTest extends MediaWikiTestCase {
|
|||
if ( wfIsWindows() ) {
|
||||
$this->markTestSkipped( 'This test requires a POSIX environment.' );
|
||||
}
|
||||
$this->assertSame( $expected, call_user_func_array( [ Shell::class, 'escape' ], $args ) );
|
||||
$this->assertSame( $expected, Shell::escape( ...$args ) );
|
||||
}
|
||||
|
||||
public function provideEscape() {
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ class SkinTemplateTest extends MediaWikiTestCase {
|
|||
|
||||
$modules = $skin->getDefaultModules();
|
||||
|
||||
$actualStylesModule = call_user_func_array( 'array_merge', $modules['styles'] );
|
||||
$actualStylesModule = array_merge( ...array_values( $modules['styles'] ) );
|
||||
$this->assertArraySubmapSame(
|
||||
$expectedModuleStyles,
|
||||
$actualStylesModule,
|
||||
|
|
|
|||
|
|
@ -73,10 +73,7 @@ class SpecialPageTest extends MediaWikiTestCase {
|
|||
$this->expectExceptionMessage( $expected );
|
||||
|
||||
// $specialPage->requireLogin( [ $reason [, $title ] ] )
|
||||
call_user_func_array(
|
||||
[ $specialPage, 'requireLogin' ],
|
||||
array_filter( [ $reason, $title ] )
|
||||
);
|
||||
$specialPage->requireLogin( ...array_filter( [ $reason, $title ] ) );
|
||||
}
|
||||
|
||||
public function requireLoginAnonProvider() {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ class SpecialUploadTest extends MediaWikiTestCase {
|
|||
* @dataProvider provideGetInitialPageText
|
||||
*/
|
||||
public function testGetInitialPageText( $expected, $inputParams ) {
|
||||
$result = call_user_func_array( [ 'SpecialUpload', 'getInitialPageText' ], $inputParams );
|
||||
$result = SpecialUpload::getInitialPageText( ...$inputParams );
|
||||
$this->assertEquals( $expected, $result );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ class BatchRowUpdateTest extends MediaWikiTestCase {
|
|||
$retvals[] = $this->returnValue( new ArrayIterator( $rows ) );
|
||||
}
|
||||
|
||||
return call_user_func_array( [ $this, 'onConsecutiveCalls' ], $retvals );
|
||||
return $this->onConsecutiveCalls( ...$retvals );
|
||||
}
|
||||
|
||||
protected function genSelectResult( $batchSize, $numRows, $rowGenerator ) {
|
||||
|
|
@ -226,7 +226,7 @@ class BatchRowUpdateTest extends MediaWikiTestCase {
|
|||
for ( $i = 0; $i < $numRows; $i += $batchSize ) {
|
||||
$rows = [];
|
||||
for ( $j = 0; $j < $batchSize && $i + $j < $numRows; $j++ ) {
|
||||
$rows [] = (object)call_user_func( $rowGenerator );
|
||||
$rows[] = (object)$rowGenerator();
|
||||
}
|
||||
$res[] = $rows;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ class AuthenticationResponseTest extends \MediaWikiUnitTestCase {
|
|||
foreach ( $expect as $field => $value ) {
|
||||
$res->$field = $value;
|
||||
}
|
||||
$ret = call_user_func_array( "MediaWiki\\Auth\\AuthenticationResponse::$constructor", $args );
|
||||
$ret = AuthenticationResponse::$constructor( ...$args );
|
||||
$this->assertEquals( $res, $ret );
|
||||
} else {
|
||||
try {
|
||||
call_user_func_array( "MediaWiki\\Auth\\AuthenticationResponse::$constructor", $args );
|
||||
AuthenticationResponse::$constructor( ...$args );
|
||||
$this->fail( 'Expected exception not thrown' );
|
||||
} catch ( \Exception $ex ) {
|
||||
$this->assertEquals( $expect, $ex );
|
||||
|
|
|
|||
|
|
@ -134,9 +134,7 @@ class ArrayUtilsTest extends PHPUnit\Framework\TestCase {
|
|||
* @dataProvider provideArrayDiffAssocRecursive
|
||||
*/
|
||||
public function testArrayDiffAssocRecursive( $expected, ...$args ) {
|
||||
$this->assertEquals( call_user_func_array(
|
||||
'ArrayUtils::arrayDiffAssocRecursive', $args
|
||||
), $expected );
|
||||
$this->assertEquals( $expected, ArrayUtils::arrayDiffAssocRecursive( ...$args ) );
|
||||
}
|
||||
|
||||
public function provideArrayDiffAssocRecursive() {
|
||||
|
|
|
|||
|
|
@ -51,18 +51,14 @@ class SessionUnitTest extends MediaWikiUnitTestCase {
|
|||
foreach ( $args as $arg ) {
|
||||
$expectArgs[] = $this->identicalTo( $arg );
|
||||
}
|
||||
$tmp = call_user_func_array( [ $tmp, 'with' ], $expectArgs );
|
||||
$tmp = $tmp->with( ...$expectArgs );
|
||||
|
||||
$retval = new \stdClass;
|
||||
$tmp->will( $this->returnValue( $retval ) );
|
||||
|
||||
$session = TestUtils::getDummySession( $mock, 42 );
|
||||
|
||||
if ( $ret ) {
|
||||
$this->assertSame( $retval, call_user_func_array( [ $session, $m ], $args ) );
|
||||
} else {
|
||||
$this->assertNull( call_user_func_array( [ $session, $m ], $args ) );
|
||||
}
|
||||
$this->assertSame( $ret ? $retval : null, $session->$m( ...$args ) );
|
||||
|
||||
// Trigger Session destructor
|
||||
$session = null;
|
||||
|
|
|
|||
Loading…
Reference in a new issue