<?php require_once dirname(__FILE__) . '/../../../bootstrap/unit.php'; $t = new lime_test(25); // Configuration has already been set by bootstrap nbConfig::reset(); $t->comment('nbConfigTest - Test get all'); $t->is(nbConfig::getAll(), array(), '->getAll() returns all configuration keys'); nbConfig::set('foo', 'fooValue'); $t->is(nbConfig::getAll(), array('foo' => 'fooValue'), '->getAll() returns all configuration keys'); nbConfig::set('bar', 'barValue'); $t->comment('nbConfigTest - Test remove'); nbConfig::remove('bar'); $t->is(nbConfig::getAll(), array('foo' => 'fooValue'), '->remove() removes a sigle configuration key'); nbConfig::reset(); $t->comment('nbConfigTest - Test reset'); nbConfig::set('foo', 'fooValue'); nbConfig::set('bar', 'barValue'); $t->is(count(nbConfig::getAll()), 2, '->reset() remove all keys'); nbConfig::reset(); $t->is(nbConfig::getAll(), array(), '->reset() remove all keys'); $t->comment('nbConfigTest - Test has'); $t->is(nbConfig::has('key'), false, 'nbConfig::has() returns false if key is not present'); nbConfig::set('key', 'value'); $t->is(nbConfig::has('key'), true, 'nbConfig::has() returns true if key is present'); $key2 = array('foo' => 'fooValue'); nbConfig::set('key2', $key2); $t->is(nbConfig::has('key2_foo'), true, 'nbConfig::has() returns true if "key path" is present'); $t->comment('nbConfigTest - Test get'); $t->is(nbConfig::get('fake-key'), null, 'nbConfig::get() returns null if key in not present'); $t->is(nbConfig::get('fake-key', 'value'), 'value', 'nbConfig::get() returns default value if key in not present');