<?php /* * This file is part of the symfony package. * (c) 2004-2006 Fabien Potencier <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ require_once __DIR__ . '/../../bootstrap/unit.php'; $t = new lime_test(50); // ->clear() $t->diag('->clear()'); $ph = new sfNamespacedParameterHolder(); $ph->clear(); $t->is($ph->getAll(), null, '->clear() clears all parameters'); $ph->set('foo', 'bar'); $ph->clear(); $t->is($ph->getAll(), null, '->clear() clears all parameters'); // ->get() $t->diag('->get()'); $ph = new sfNamespacedParameterHolder(); $ph->set('foo', 'bar'); $t->is($ph->get('foo'), 'bar', '->get() returns the parameter value for the given key'); $t->is($ph->get('bar'), null, '->get() returns null if the key does not exist'); $ph = new sfNamespacedParameterHolder(); $t->is('default_value', $ph->get('foo1', 'default_value'), '->get() takes the default value as its second argument'); $ph = new sfNamespacedParameterHolder(); $ph->set('myfoo', 'bar', 'symfony/mynamespace'); $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');