Merge "Fix TestingAccessWrapper::__call"
authorEjegg <eeggleston@wikimedia.org>
Fri, 27 Mar 2015 15:58:26 +0000 (15:58 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 27 Mar 2015 15:58:26 +0000 (15:58 +0000)
tests/phpunit/data/helpers/WellProtectedClass.php
tests/phpunit/includes/TestingAccessWrapper.php
tests/phpunit/includes/TestingAccessWrapperTest.php

index 7114cc9..99c7f64 100644 (file)
@@ -14,4 +14,8 @@ class WellProtectedClass {
        public function getProperty() {
                return $this->property;
        }
+
+       protected function whatSecondArg( $a, $b = false ) {
+               return $b;
+       }
 }
index d4ad363..84c0f9b 100644 (file)
@@ -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 ) {
index 8da8e42..7e5b91a 100644 (file)
@@ -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' ) );
+       }
 }