Ejegg has submitted this change and it was merged.

Change subject: Fix TestingAccessWrapper::__call
......................................................................


Fix TestingAccessWrapper::__call

We were only passing the first parameter to the wrapped object's methods.

Change-Id: I27a69d1cc1b2d048e44514af8b4ac79d7ee1fb85
---
M tests/phpunit/data/helpers/WellProtectedClass.php
M tests/phpunit/includes/TestingAccessWrapper.php
M tests/phpunit/includes/TestingAccessWrapperTest.php
3 files changed, 9 insertions(+), 1 deletion(-)

Approvals:
  Ejegg: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/phpunit/data/helpers/WellProtectedClass.php 
b/tests/phpunit/data/helpers/WellProtectedClass.php
index 7114cc9..99c7f64 100644
--- a/tests/phpunit/data/helpers/WellProtectedClass.php
+++ b/tests/phpunit/data/helpers/WellProtectedClass.php
@@ -14,4 +14,8 @@
        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 d4ad363..84c0f9b 100644
--- a/tests/phpunit/includes/TestingAccessWrapper.php
+++ b/tests/phpunit/includes/TestingAccessWrapper.php
@@ -31,7 +31,7 @@
                $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 8da8e42..7e5b91a 100644
--- a/tests/phpunit/includes/TestingAccessWrapperTest.php
+++ b/tests/phpunit/includes/TestingAccessWrapperTest.php
@@ -27,4 +27,8 @@
                $this->assertSame( 2, $this->wrapped->property );
                $this->assertSame( 2, $this->raw->getProperty() );
        }
+
+       function testCallMethodTwoArgs() {
+               $this->assertSame( 'two', $this->wrapped->whatSecondArg( 'one', 
'two' ) );
+       }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/199842
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I27a69d1cc1b2d048e44514af8b4ac79d7ee1fb85
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Awight <awi...@wikimedia.org>
Gerrit-Reviewer: Ejegg <eeggles...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to