// checks that get returns reference
$ref = 'foobar';
$ph->set('ref', $ref);
$ref2 = null;
$ref2 &= $ph->get('ref');
// obtain the very same reference and modify it
$ref2 &= 'barfoo';
$t->is($ref2, $ref, '->get() returns a reference for the given key');
$ph = new sfParameterHolder();
$t->is('default_value', $ph->get('foo1', 'default_value'), '->get() takes the default value as its second argument');
// ->getNames()
$t->diag('->getNames()');
$ph = new sfParameterHolder();
$ph->set('foo', 'bar');
$ph->set('yourfoo', 'bar');
$t->is($ph->getNames(), array('foo', 'yourfoo'), '->getNames() returns all key names');
// ->getAll()
$t->diag('->getAll()');
$parameters = array('foo' => 'bar', 'myfoo' => 'bar');
$ph = new sfParameterHolder();
$ph->add($parameters);
$t->is($ph->getAll(), $parameters, '->getAll() returns all parameters');
// ->has()
$t->diag('->has()');
$ph = new sfParameterHolder();
$ph->set('foo', 'bar');
$t->is($ph->has('foo'), true, '->has() returns true if the key exists');
$t->is($ph->has('bar'), false, '->has() returns false if the key does not exist');
$ph->set('bar', null);
$t->is($ph->has('bar'), true, '->has() returns true if the key exist, even if the value is null');
// ->remove()
$t->is('bar', $ph->get('myfoo', null, 'symfony/mynamespace'), '->get() takes an optional namespace as its third argument');
$t->is(null, $ph->get('myfoo'), '->get() can have the same key for several namespaces');
$ph = new sfParameterHolder();
$ph->add(array('foo' => array('bar' => array('baz' => 'foo bar'), 'bars' => array('foo', 'bar'))));
$t->is($ph->get('foo[bar][baz]'), 'foo bar', '->get() can take a multi-array key');
$t->is($ph->get('foo[bars][1]'), 'bar', '->get() can take a multi-array key');
$t->is($ph->get('foo[bars][2]'), null, '->get() returns null if the key does not exist');
$t->is($ph->get('foo[bars][]'), array('foo', 'bar'), '->get() returns an array');
$t->is($ph->get('foo[bars][]'), $ph->get('foo[bars]'), '->get() returns an array even if you omit the []');
// ->getNames()
$t->diag('->getNames()');
$ph = new sfParameterHolder();
$ph->set('foo', 'bar');
$ph->set('yourfoo', 'bar');
$ph->set('myfoo', 'bar', 'symfony/mynamespace');
$t->is($ph->getNames(), array('foo', 'yourfoo'), '->getNames() returns all key names for the default namespace');
$t->is($ph->getNames('symfony/mynamespace'), array('myfoo'), '->getNames() takes a namepace as its first argument');
// ->getNamespaces()
$t->diag('->getNamespaces()');
$ph = new sfParameterHolder();
$ph->set('foo', 'bar');
$ph->set('yourfoo', 'bar');
$ph->set('myfoo', 'bar', 'symfony/mynamespace');
$t->is($ph->getNamespaces(), array($ph->getDefaultNamespace(), 'symfony/mynamespace'), '->getNamespaces() returns all non empty namespaces');
// ->getAll()
$t->diag('->getAll()');
$parameters = array('foo' => 'bar', 'myfoo' => 'bar');
$ph = new sfParameterHolder();
$ph->add($parameters);
$ph->set('myfoo', 'bar', 'symfony/mynamespace');
$t->is($ph->getAll(), $parameters, '->getAll() returns all parameters from the default namespace');