Permalink
Browse files

Add simple test for config merging behavior in ConfigListener

This is to ensure that one cannot swap out the ArrayUtils::merge() with
something like array_replace_recursive with the tests still passing, proving a
false sense that no behavior has been broken.
  • Loading branch information...
1 parent c810b7b commit a568a7d77e1ed7d34779a91b10cf6ebf26c4ef2e @EvanDotPro EvanDotPro committed Apr 13, 2012
@@ -342,6 +342,26 @@ public function testCanMergeConfigFromArrayOfStatic()
$this->assertSame('loaded', $configObject->xml);
}
+ public function testMergesWithMergeAndReplaceBehavior()
+ {
+ $configListener = new ConfigListener();
+
+ $moduleManager = $this->moduleManager;
+ $moduleManager->setModules(array('SomeModule'));
+
+ $configListener->addConfigStaticPaths(array(
+ __DIR__ . '/_files/good/merge1.php',
+ __DIR__ . '/_files/good/merge2.php',
+ ));
+
+ $moduleManager->events()->attachAggregate($configListener);
+ $moduleManager->loadModules();
+
+ $mergedConfig = $configListener->getMergedConfig(false);
+ $this->assertSame(array('foo', 'bar'), $mergedConfig['indexed']);
+ $this->assertSame('bar', $mergedConfig['keyed']);
+ }
+
public function testConfigListenerFunctionsAsAggregateListener()
{
$configListener = new ConfigListener;
@@ -0,0 +1,5 @@
+<?php
+return array(
+ 'indexed' => array('foo'),
+ 'keyed' => 'foo',
+);
@@ -0,0 +1,5 @@
+<?php
+return array(
+ 'indexed' => array('bar'),
+ 'keyed' => 'bar',
+);

0 comments on commit a568a7d

Please sign in to comment.