jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/345950 )

Change subject: ObjectFactory: Complete code coverage for ObjectFactoryTest
......................................................................


ObjectFactory: Complete code coverage for ObjectFactoryTest

Cover missing case of expandClosures() where the array contains
both a closure and a non-closure.

Change-Id: I30ea8cf3fb909a499a95bf9bd24792f4dd6b5c64
---
M tests/phpunit/includes/libs/ObjectFactoryTest.php
1 file changed, 20 insertions(+), 12 deletions(-)

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



diff --git a/tests/phpunit/includes/libs/ObjectFactoryTest.php 
b/tests/phpunit/includes/libs/ObjectFactoryTest.php
index f8dda6f..3e0a61e 100644
--- a/tests/phpunit/includes/libs/ObjectFactoryTest.php
+++ b/tests/phpunit/includes/libs/ObjectFactoryTest.php
@@ -26,20 +26,24 @@
        public function testClosureExpansionDisabled() {
                $obj = ObjectFactory::getObjectFromSpec( [
                        'class' => 'ObjectFactoryTestFixture',
-                       'args' => [ function() {
-                               return 'unwrapped';
-                       }, ],
+                       'args' => [
+                               function() {
+                                       return 'wrapped';
+                               },
+                               'unwrapped',
+                       ],
                        'calls' => [
                                'setter' => [ function() {
-                                       return 'unwrapped';
+                                       return 'wrapped';
                                }, ],
                        ],
                        'closure_expansion' => false,
                ] );
                $this->assertInstanceOf( 'Closure', $obj->args[0] );
-               $this->assertSame( 'unwrapped', $obj->args[0]() );
+               $this->assertSame( 'wrapped', $obj->args[0]() );
+               $this->assertSame( 'unwrapped', $obj->args[1] );
                $this->assertInstanceOf( 'Closure', $obj->setterArgs[0] );
-               $this->assertSame( 'unwrapped', $obj->setterArgs[0]() );
+               $this->assertSame( 'wrapped', $obj->setterArgs[0]() );
        }
 
        /**
@@ -49,20 +53,24 @@
        public function testClosureExpansionEnabled() {
                $obj = ObjectFactory::getObjectFromSpec( [
                        'class' => 'ObjectFactoryTestFixture',
-                       'args' => [ function() {
-                               return 'unwrapped';
-                       }, ],
+                       'args' => [
+                               function() {
+                                       return 'wrapped';
+                               },
+                               'unwrapped',
+                       ],
                        'calls' => [
                                'setter' => [ function() {
-                                       return 'unwrapped';
+                                       return 'wrapped';
                                }, ],
                        ],
                        'closure_expansion' => true,
                ] );
                $this->assertInternalType( 'string', $obj->args[0] );
-               $this->assertSame( 'unwrapped', $obj->args[0] );
+               $this->assertSame( 'wrapped', $obj->args[0] );
+               $this->assertSame( 'unwrapped', $obj->args[1] );
                $this->assertInternalType( 'string', $obj->setterArgs[0] );
-               $this->assertSame( 'unwrapped', $obj->setterArgs[0] );
+               $this->assertSame( 'wrapped', $obj->setterArgs[0] );
 
                $obj = ObjectFactory::getObjectFromSpec( [
                        'class' => 'ObjectFactoryTestFixture',

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I30ea8cf3fb909a499a95bf9bd24792f4dd6b5c64
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: BryanDavis <bda...@wikimedia.org>
Gerrit-Reviewer: Legoktm <lego...@member.fsf.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