public function setUp() { $this->app = Pagon::create(array('site_url' => 'http://apple.com/test', 'asset_url' => 'http://cdn.apple.com')); $_SERVER = array('HTTP_HOST' => 'localhost', 'HTTP_CONNECTION' => 'keep-alive', 'HTTP_CACHE_CONTROL' => 'max-age=0', 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36', 'HTTP_ACCEPT_ENCODING' => 'gzip,deflate,sdch', 'HTTP_ACCEPT_LANGUAGE' => 'zh-CN,zh;q=0.8', 'PATH' => '/usr/bin:/bin:/usr/sbin:/sbin', 'SERVER_SIGNATURE' => '', 'SERVER_SOFTWARE' => 'Apache/2.2.24 (Unix) DAV/2 PHP/5.3.25 mod_ssl/2.2.24 OpenSSL/0.9.8y', 'SERVER_NAME' => 'localhost', 'SERVER_ADDR' => '::1', 'SERVER_PORT' => '80', 'REMOTE_ADDR' => '::1', 'DOCUMENT_ROOT' => '/Users/hfcorriez/Code', 'SERVER_ADMIN' => '*****@*****.**', 'SCRIPT_FILENAME' => '/Users/hfcorriez/Code/index.php', 'REMOTE_PORT' => '52872', 'GATEWAY_INTERFACE' => 'CGI/1.1', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'REQUEST_METHOD' => 'GET', 'QUERY_STRING' => '', 'REQUEST_URI' => '/', 'SCRIPT_NAME' => '/index.php', 'PHP_SELF' => '/index.php', 'REQUEST_TIME' => 1375528769); $this->app->input = new Input(array('app' => $this->app)); ob_start(); $this->app->run(); ob_end_clean(); }
<?php /** * Bootstrap application and init something */ define('APP_DIR', __DIR__); define('ROOT_DIR', dirname(APP_DIR)); require dirname(__DIR__) . '/vendor/autoload.php'; use Pagon\Pagon; // Create application $app = Pagon::create(__DIR__ . '/config/default.php'); // Get current mode $mode = $app->mode(); // Mount current dir as root dir $app->mount(APP_DIR); // Mount public dir as static dir $app->mount('public', ROOT_DIR . '/public'); // Load mode config depends on ENV if (is_file($conf_file = __DIR__ . '/config/' . $mode . '.php')) { $app->append(include $conf_file); } /** * When you want to load ORM to read and write database * * @example * * $app->loadOrm(); * Model::factory('User')->find_one(1); * */ $app->inject('loadOrm', function () use($app) {
public function setUp() { $this->app = Pagon::create(array('my' => 'test', 'en' => false, 'mt' => array('m' => 'a', 't' => array('t' => 'b')), 'buffer' => false)); }