From: Adam Roses Wight Date: Thu, 26 Mar 2015 08:57:33 +0000 (-0700) Subject: Fix TestingAccessWrapper::__call X-Git-Tag: 1.31.0-rc.0~11972^2 X-Git-Url: http://git.cyclocoop.org/data/Luca_Pacioli_%28Gemaelde%29.jpeg?a=commitdiff_plain;h=c46ee213f03868fa86a5399d2d82c76b1a897039;p=lhc%2Fweb%2Fwiklou.git Fix TestingAccessWrapper::__call We were only passing the first parameter to the wrapped object's methods. Change-Id: I27a69d1cc1b2d048e44514af8b4ac79d7ee1fb85 --- diff --git a/tests/phpunit/data/helpers/WellProtectedClass.php b/tests/phpunit/data/helpers/WellProtectedClass.php index 7114cc9524..99c7f642f2 100644 --- a/tests/phpunit/data/helpers/WellProtectedClass.php +++ b/tests/phpunit/data/helpers/WellProtectedClass.php @@ -14,4 +14,8 @@ class WellProtectedClass { public function getProperty() { return $this->property; } + + protected function whatSecondArg( $a, $b = false ) { + return $b; + } } diff --git a/tests/phpunit/includes/TestingAccessWrapper.php b/tests/phpunit/includes/TestingAccessWrapper.php index d4ad363f69..84c0f9b5be 100644 --- a/tests/phpunit/includes/TestingAccessWrapper.php +++ b/tests/phpunit/includes/TestingAccessWrapper.php @@ -31,7 +31,7 @@ class TestingAccessWrapper { $classReflection = new ReflectionClass( $this->object ); $methodReflection = $classReflection->getMethod( $method ); $methodReflection->setAccessible( true ); - return $methodReflection->invoke( $this->object, $args ); + return $methodReflection->invokeArgs( $this->object, $args ); } public function __set( $name, $value ) { diff --git a/tests/phpunit/includes/TestingAccessWrapperTest.php b/tests/phpunit/includes/TestingAccessWrapperTest.php index 8da8e420d6..7e5b91a119 100644 --- a/tests/phpunit/includes/TestingAccessWrapperTest.php +++ b/tests/phpunit/includes/TestingAccessWrapperTest.php @@ -27,4 +27,8 @@ class TestingAccessWrapperTest extends MediaWikiTestCase { $this->assertSame( 2, $this->wrapped->property ); $this->assertSame( 2, $this->raw->getProperty() ); } + + function testCallMethodTwoArgs() { + $this->assertSame( 'two', $this->wrapped->whatSecondArg( 'one', 'two' ) ); + } }