public function setUp() { $this->app = Application::instance(); $this->app['url'] = new \Cygnite\Common\UrlManager\Url(); $this->app['request'] = \Cygnite\Http\Requests\Request::createFromGlobals(); $this->app['router'] = new \Cygnite\Base\Router\Router($this->app['request']); $this->app['router']->setApplication($this->app); $this->app['url']->setApplication($this->app); $this->url = $this->app['url']; }
public function setUp() { $this->app = Application::instance(); $this->app['request'] = \Cygnite\Http\Requests\Request::createFromGlobals(); $this->app['router'] = new \Cygnite\Base\Router\Router($this->app['request']); $this->app['router']->setApplication($this->app); $this->app['request']->server->add('SCRIPT_NAME', '/index.php'); $this->app['request']->server->add('REQUEST_METHOD', 'GET'); $this->app['request']->server->add('SERVER_PROTOCOL', 'HTTP/1.1'); $this->router = $this->app['router']; }
public function testMakeClass() { $this->app = Application::instance(); $this->app['url'] = new \Cygnite\Common\UrlManager\Url(); $this->app['request'] = \Cygnite\Http\Requests\Request::createFromGlobals(); $this->app['router'] = new \Cygnite\Base\Router\Router($this->app['request']); $this->app['router']->setApplication($this->app); $this->app['url']->setApplication($this->app); $madeUrl = $this->container->make('\\Cygnite\\Common\\UrlManager\\Url'); $madeUrl->setApplication($this->app); $this->assertEquals($this->app['url'], $madeUrl); }
private function setUpAssetConfig() { $app = Application::instance(); $app['url'] = new \Cygnite\Common\UrlManager\Url(); $app['request'] = \Cygnite\Http\Requests\Request::createFromGlobals(); $app['router'] = new \Cygnite\Base\Router\Router($app['request']); $app['url']->setApplication($app); $app['request']->server->add('REQUEST_URI', '/hello/user'); $app['request']->server->add('HTTP_HOST', 'localhost'); $configuration = ['global.config' => ['encoding' => 'utf-8']]; Config::$config = $configuration; Url::setBase('cygnite/'); //$app['router']->getBaseUrl() }
public function setUp() { $this->app = Application::instance(); $this->app['url'] = new \Cygnite\Common\UrlManager\Url(); $this->app['request'] = \Cygnite\Http\Requests\Request::createFromGlobals(); $this->app['router'] = new \Cygnite\Base\Router\Router($this->app['request']); $this->app['router']->setApplication($this->app); $this->app['url']->setApplication($this->app); $this->app['request']->server->add('HTTP_HOST', 'localhost'); $this->app['request']->server->add('REQUEST_URI', '/'); /* $app = Application::instance(); $app['router'] = new Router;*/ Url::setBase('/cygnite/index.php/user'); }
*/ define('ENV', $config['environment']); if (ENV == 'development') { ini_set('display_errors', -1); error_reporting(E_ALL); } else { ini_set('display_error', 0); error_reporting(0); } // Register debugger into the application $app->singleton('debugger', function () { return new \Apps\Exceptions\Handler(); }); /* |-------------------------------------------------------------------------- | Run The Application |-------------------------------------------------------------------------- | | We will handle the incoming request using Kernel and send response | back to the browser. Http middlewares will get executed during the request | handling process. */ $kernel = $app->createKernel('\\Apps\\Kernel'); $response = $kernel->handle($request = \Cygnite\Http\Requests\Request::createFromGlobals()); $response->send(); /* | The response sent to the browser. Let us fire middleware's | shutdown method before shutting down the application | */ $kernel->shutdown($request, $response);
public function testSetHeaderReturnsExpectedLanguage() { $request = Request::createFromGlobals(); $request->header->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6'); $this->assertContains('zh, en-us; q=0.8, en; q=0.6', $request->header->get('accept-language')); }