public function testFromArray() { $firstArray = ['foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz']; $config = new Configuration(); $config->fromArray($firstArray); $reflection = new ReflectionProperty($config, 'container'); $reflection->setAccessible(true); $this->assertSame($firstArray, $reflection->getValue($config)); $secondArray = ['bar' => 'bat', 'con' => 'com']; $config->fromArray($secondArray); $expected = array_merge($firstArray, $secondArray); $this->assertSame($expected, $reflection->getValue($config)); }
public function testMergeMergingTwoNestedArrays() { $arrayFirst = ['foo' => ['bar' => ['baz' => 100, 300]]]; $arraySecond = ['foo' => ['bar' => ['baz' => 200, 400]]]; $expected = ['foo' => ['bar' => ['baz' => 200, 300, 400]]]; $config = new Configuration(); $config->fromArray($arrayFirst); // $config->merge($arraySecond); $this->assertSame($expected, $config->toArray()); }