public function testMergeInstances() { $targetConfig = ['foo' => new \stdClass(), 'bar' => new \stdClass()]; $target = new Services(); foreach ($targetConfig as $key => $item) { $target->set($key, $item); } $sourceConfig = ['bar' => new \stdClass(), 'baz' => new \stdClass()]; $source = new Services(); foreach ($sourceConfig as $key => $item) { $source->set($key, $item); } $return = $target->merge($source); $this->assertSame($return, $target); $expected = ['foo' => $targetConfig['foo'], 'bar' => $sourceConfig['bar'], 'baz' => $sourceConfig['baz']]; $this->assertSame($expected, $target->getInstances()); }