Exemplo n.º 1
0
 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'];
 }
Exemplo n.º 2
0
 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'];
 }
Exemplo n.º 3
0
 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);
 }
Exemplo n.º 4
0
 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()
 }
Exemplo n.º 5
0
 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');
 }
Exemplo n.º 6
0
*/
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);
Exemplo n.º 7
0
 public function testSettingContentTypeForUnsupportedMethods()
 {
     $put = Request::create('/url', 'PUT');
     $this->assertEquals('application/x-www-form-urlencoded', $put->server->get('CONTENT_TYPE'));
     $patch = Request::create('/url', 'PATCH');
     $this->assertEquals('application/x-www-form-urlencoded', $patch->server->get('CONTENT_TYPE'));
     $delete = Request::create('/url', 'DELETE');
     $this->assertEquals('application/x-www-form-urlencoded', $delete->server->get('CONTENT_TYPE'));
 }