$configuration->set('bar', 'barValue'); $t->comment('nbConfigTest - Test remove'); $configuration = new nbConfiguration(); $configuration->set('bar', 'barValue'); $configuration->remove('bar'); $t->is($configuration->getAll(), array(), '->remove() removes a sigle configuration key'); $t->comment('nbConfigTest - Test reset'); $configuration = new nbConfiguration(); $configuration->set('foo', 'fooValue'); $configuration->set('bar', 'barValue'); $t->is(count($configuration->getAll()), 2, '->reset() remove all keys'); $configuration->reset(); $t->is($configuration->getAll(), array(), '->reset() remove all keys'); $t->comment('nbConfigTest - Test has'); $configuration = new nbConfiguration(); $t->is($configuration->has('key'), false, '$configuration->has() returns false if key is not present'); $configuration->set('key', 'value'); $t->is($configuration->has('key'), true, '$configuration->has() returns true if key is present'); $key2 = array('foo' => 'fooValue'); $configuration->set('key2', $key2); $t->is($configuration->has('key2_foo'), true, '$configuration->has() returns true if "key path" is present'); $t->comment('nbConfigTest - Test get'); $configuration = new nbConfiguration(); $configuration->set('key2', $key2); $t->is($configuration->get('fake-key'), null, '$configuration->get() returns null if key in not present'); $t->is($configuration->get('fake-key', 'value'), 'value', '$configuration->get() returns default value if key in not present'); $t->is($configuration->get('key2'), $key2, '$configuration->get() returns an array if key has subkeys'); $t->is($configuration->get('key2_foo'), $key2['foo'], '$configuration->get() parse a "key path" and returns leaf value'); $t->comment('nbConfigTest - Test set'); $configuration = new nbConfiguration(); $configuration->set('bar', 'barValue');