Fix improper parameters to ReflectionMethod::invoke
authorKunal Mehta <legoktm@member.fsf.org>
Fri, 18 May 2018 05:30:58 +0000 (22:30 -0700)
committerKunal Mehta <legoktm@member.fsf.org>
Fri, 18 May 2018 05:30:58 +0000 (22:30 -0700)
The first argument to the function is supposed to be an object, or null if
the method is static.

Otherwise on PHP 7.2 the tests fail with:
 ReflectionMethod::invoke() expects parameter 1 to be object, string given

Change-Id: I7002be5809f9dfbee0788907fe85139d05c0e1fc

tests/phpunit/includes/resourceloader/ResourceLoaderLessVarFileModuleTest.php

index a42e4be..bb51de0 100644 (file)
@@ -38,6 +38,6 @@ class ResourceLoaderLessVarFileModuleTest extends ResourceLoaderTestCase {
        public function testEscapeMessage( $msg, $expected ) {
                $method = new ReflectionMethod( ResourceLoaderLessVarFileModule::class, 'wrapAndEscapeMessage' );
                $method->setAccessible( true );
-               $this->assertEquals( $expected, $method->invoke( ResourceLoaderLessVarFileModule::class, $msg ) );
+               $this->assertEquals( $expected, $method->invoke( null, $msg ) );
        }
 }