示例#1
0
 public function testShouldLoadTestConfigFile()
 {
     NeechyConfig::init();
     $this->assertNull(NeechyConfig::get('unset-value'));
     $this->assertTrue(NeechyConfig::get('is-testing'));
     $this->assertEquals('NeechyTest', NeechyConfig::get('title'));
 }
示例#2
0
<?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();
示例#3
0
<?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);
 }
示例#5
0
 public static function init_config()
 {
     NeechyConfig::init();
 }
示例#6
0
 public function reload()
 {
     NeechyDatabase::disconnect_from_db();
     NeechyConfig::init();
 }