Awight has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/199842

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(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/42/199842/1

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: newchange
Gerrit-Change-Id: I27a69d1cc1b2d048e44514af8b4ac79d7ee1fb85
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Awight <awi...@wikimedia.org>

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

Reply via email to