コード例 #1
0
ファイル: RequestTest.php プロジェクト: codecollab/http
 /**
  * @covers CodeCollab\Http\Request\Request::__construct
  * @covers CodeCollab\Http\Request\Request::processServerVariables
  * @covers CodeCollab\Http\Request\Request::isEncrypted
  */
 public function testIsEncryptedHttpsEnabled()
 {
     $request = new Request($this->createMock(Decryptor::class), $this->baseRequestData['server'] + ['HTTPS' => 'on'], $this->baseRequestData['get'], $this->baseRequestData['post'], $this->baseRequestData['files'], $this->baseRequestData['cookies'], $this->baseRequestData['input']);
     $this->assertTrue($request->isEncrypted());
 }
コード例 #2
0
ファイル: bootstrap.php プロジェクト: iroegbu/Demo
 */
if (php_sapi_name() === 'cli') {
    return;
}
/**
 * Setup decryptor
 */
$decryptor = new Decryptor(file_get_contents(__DIR__ . '/encryption.key'));
/**
 * Setup the request object
 */
$request = new Request($decryptor, $_SERVER, $_GET, $_POST, $_FILES, $_COOKIE, file_get_contents('php://input'));
/**
 * Setup the session
 */
$session = new Session('/', $request->server('SERVER_NAME'), $request->isEncrypted());
/**
 * Setup authentication object
 */
$user = new User($session);
/**
 * Setup the router
 */
$routeCache = $user->isLoggedIn() ? '/cache/routes-authenticated.php' : '/cache/routes.php';
$routeCollector = new RouteCollector(new RouteParser(), new RouteDataGenerator());
$router = new Router($routeCollector, function ($dispatchData) {
    return new RouteDispatcher($dispatchData);
}, __DIR__ . $routeCache, !$production);
/**
 * Load routes
 */