public function testMerge() { $this->object->addConstants(array('first' => 'to overwrite', 'second' => 'cannot be overwritten')); $this->object->define('First')->setClass('To_Overwrite'); $second = $this->object->define('Second'); $builder = new ContainerBuilder(); $builder->addConstants(array('first' => 'new value', 'third' => 'unseen')); $first = $builder->define('First')->setClass('Write_It_Over'); $third = $builder->define('Third'); $this->object->merge($builder); $this->assertThat($this->object->getConstants(), $this->equalTo(array('first' => 'new value', 'second' => 'cannot be overwritten', 'third' => 'unseen'))); $this->assertThat($this->object->getDefinitions(), $this->equalTo(array('First' => $first, 'Second' => $second, 'Third' => $third))); }
/** * Merge settings and created component adapters from other container * * @param DependencyInjectionContainer $container */ public function merge($container) { parent::merge($container); if ($container instanceof self) { $this->adapters = array_merge($this->adapters, $container->adapters); } }