/**
  * Merges a BuilderConfiguration with the current one.
  *
  * @param BuilderConfiguration $configuration
  *
  * @return BuilderConfiguration The current instance
  */
 public function merge(BuilderConfiguration $configuration = null)
 {
     if (null === $configuration) {
         return;
     }
     $this->addDefinitions($configuration->getDefinitions());
     $this->addAliases($configuration->getAliases());
     $this->addParameters($configuration->getParameters());
     foreach ($configuration->getResources() as $resource) {
         $this->addResource($resource);
     }
     return $this;
 }
{
  $t->pass('->getParameter() throws an \InvalidArgumentException if the key does not exist');
}

// ->hasParameter()
$t->diag('->hasParameter()');
$configuration = new BuilderConfiguration(array(), array('foo' => 'bar'));
$t->ok($configuration->hasParameter('foo'), '->hasParameter() returns true if a parameter is defined');
$t->ok($configuration->hasParameter('Foo'), '->hasParameter() converts the key to lowercase');
$t->ok(!$configuration->hasParameter('bar'), '->hasParameter() returns false if a parameter is not defined');

// ->addParameters()
$t->diag('->addParameters()');
$configuration = new BuilderConfiguration(array(), array('foo' => 'bar'));
$configuration->addParameters(array('bar' => 'foo'));
$t->is($configuration->getParameters(), array('foo' => 'bar', 'bar' => 'foo'), '->addParameters() adds parameters to the existing ones');
$configuration->addParameters(array('Bar' => 'fooz'));
$t->is($configuration->getParameters(), array('foo' => 'bar', 'bar' => 'fooz'), '->addParameters() converts keys to lowercase');

// ->setAlias() ->getAlias() ->hasAlias() ->getAliases() ->addAliases()
$t->diag('->setAlias() ->getAlias() ->hasAlias()');
$configuration = new BuilderConfiguration();
$configuration->setAlias('bar', 'foo');
$t->is($configuration->getAlias('bar'), 'foo', '->setAlias() defines a new alias');
$t->ok($configuration->hasAlias('bar'), '->hasAlias() returns true if the alias is defined');
$t->ok(!$configuration->hasAlias('baba'), '->hasAlias() returns false if the alias is not defined');

try
{
  $configuration->getAlias('baba');
  $t->fail('->getAlias() throws an \InvalidArgumentException if the alias does not exist');
 public function testAddParameters()
 {
     $configuration = new BuilderConfiguration(array(), array('foo' => 'bar'));
     $configuration->addParameters(array('bar' => 'foo'));
     $this->assertEquals(array('foo' => 'bar', 'bar' => 'foo'), $configuration->getParameters(), '->addParameters() adds parameters to the existing ones');
     $configuration->addParameters(array('Bar' => 'fooz'));
     $this->assertEquals(array('foo' => 'bar', 'bar' => 'fooz'), $configuration->getParameters(), '->addParameters() converts keys to lowercase');
 }