Awight has uploaded a new change for review.

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

Change subject: Test Configuration merge edge case
......................................................................

Test Configuration merge edge case

Change-Id: Ida4664b0806e2a38f8f863494c6e55e210c68959
---
M Tests/ConfigurationTest.php
1 file changed, 34 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/86/311886/1

diff --git a/Tests/ConfigurationTest.php b/Tests/ConfigurationTest.php
index 4cace76..1044a2e 100644
--- a/Tests/ConfigurationTest.php
+++ b/Tests/ConfigurationTest.php
@@ -18,4 +18,38 @@
                $this->assertEquals( 'FOO', $config->val( 
'logging/root-context' ),
                        'Config was overridden.' );
        }
+
+       /**
+        * Check that sparsely populated deep structures override one another
+        * additively, and we don't lose branches from half of the union.
+        * TODO: Provide more cases using a dataProvider.
+        */
+       public function testOverrideDeep() {
+               $config = $this->setConfig();
+
+               $config->override( array(
+                       'endpoints' => array(
+                               'listener' => array(
+                                       'class' => 'SmashPig\Ham',
+                                       'postback-url' => 'http://Salad',
+                               ),
+                       ),
+               ) );
+
+               $config->override( array(
+                       'endpoints' => array(
+                               'listener' => array(
+                                       'postback-url' => 'http://Rice',
+                               ),
+                       ),
+               ) );
+
+               $expected = array(
+                       'class' => 'SmashPig\Ham',
+                       'postback-url' => 'http://Rice',
+               );
+
+               $this->assertEquals( $expected, $config->val( 
'endpoints/listener' ),
+                       'Deep merge went as hoped' );
+       }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ida4664b0806e2a38f8f863494c6e55e210c68959
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
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