public function testShouldLoadTestConfigFile() { NeechyConfig::init(); $this->assertNull(NeechyConfig::get('unset-value')); $this->assertTrue(NeechyConfig::get('is-testing')); $this->assertEquals('NeechyTest', NeechyConfig::get('title')); }
<?php require_once '../core/neechy/config.php'; require_once '../core/neechy/database.php'; require_once '../core/neechy/response.php'; # Parse params $params = explode('/', $_SERVER["REQUEST_URI"]); $action = count($params) > 2 ? $params[2] : null; # Must init config for NeechyDatabase NeechyConfig::init(); # Response $json = array('params' => $params, 'action' => $action); # Router if ($action == 'database') { NeechyDatabase::reset(); $json['result'] = 'ok'; } else { $json['warning'] = 'Invalid action.'; } $response = new NeechyResponse(json_encode($json), 200); $response->send_headers(); $response->render();
<?php /** * index.php * * This is the main Neechy script. This file is called each time a request is * made from the browser. * */ require_once '../core/services/web.php'; $config = NeechyConfig::init(); $web_service = new NeechyWebService($config); $web_service->serve();
/** * Tests */ public function testInstantiates() { $config = NeechyConfig::init(); $service = new NeechyService($config); $this->assertInstanceOf('NeechyService', $service); }
public static function init_config() { NeechyConfig::init(); }
public function reload() { NeechyDatabase::disconnect_from_db(); NeechyConfig::init(); }