/** * Cleans up the environment after running a test. */ protected function tearDown() { if (!empty($this->config)) { $this->config->clear(); } $this->config = null; DbFactory::clearConnections(); parent::tearDown(); }
/** * Tests setting a single value, clearing and returning all items */ public function testBasics() { $config = Config::getInstance(); $this->assertInstanceOf('\\YapepBase\\Config', $config, 'Retrieved object is not a Config instance'); $result = $this->config->get('*'); $this->assertInternalType('array', $result, 'Result is not an array'); $this->assertTrue(empty($result), 'Result is not empty'); $this->config->set('test', 'value'); $result = $this->config->get('*'); $this->assertInternalType('array', $result, 'Result is not an array'); $this->assertFalse(empty($result), 'Result is empty after setting value'); $this->config->clear(); $result = $this->config->get('*'); $this->assertInternalType('array', $result, 'Result is not an array'); $this->assertTrue(empty($result), 'Result is not empty after clearing'); $this->config->set('test', 'value'); $result = $this->config->get('test'); $this->assertSame('value', $result, 'Result not the previously set value'); $this->config->delete('test'); $result = $this->config->get('test', false); $this->assertFalse($result, 'Result is not empty after deleting value'); }