[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Test Configuration merge edge case
jenkins-bot has submitted this change and it was merged. 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(-) Approvals: Ejegg: Looks good to me, approved jenkins-bot: Verified 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: merged Gerrit-Change-Id: Ida4664b0806e2a38f8f863494c6e55e210c68959 Gerrit-PatchSet: 2 Gerrit-Project: wikimedia/fundraising/SmashPig Gerrit-Branch: master Gerrit-Owner: AwightGerrit-Reviewer: Cdentinger Gerrit-Reviewer: Ejegg Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Test Configuration merge edge case
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___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits