Permalink
Browse files

Update tests.

  • Loading branch information...
1 parent d241a06 commit 5b4121f643c9071af5d7099eee403d8edbba8f2c @bar bar committed Jan 21, 2014
Showing with 46 additions and 2 deletions.
  1. +46 −2 lib/Cake/Test/Case/Network/CakeRequestTest.php
@@ -1484,10 +1484,18 @@ public function testBaseUrlNoRewriteWebrootIndex() {
public function testGetParamsWithDot() {
$_GET = array();
$_GET['/posts/index/add_add'] = '';
+ $_SERVER['PHP_SELF'] = '/app/webroot/index.php';
+ $_SERVER['REQUEST_URI'] = '/posts/index/add.add';
+ $request = new CakeRequest();
+ $this->assertEquals('', $request->base);
+ $this->assertEquals(array(), $request->query);
+
+ $_GET = array();
+ $_GET['/cake_dev/posts/index/add_add'] = '';
$_SERVER['PHP_SELF'] = '/cake_dev/app/webroot/index.php';
$_SERVER['REQUEST_URI'] = '/cake_dev/posts/index/add.add';
-
$request = new CakeRequest();
+ $this->assertEquals('/cake_dev', $request->base);
$this->assertEquals(array(), $request->query);
}
@@ -1499,10 +1507,18 @@ public function testGetParamsWithDot() {
public function testGetParamWithUrlencodedElement() {
$_GET = array();
$_GET['/posts/add/∂∂'] = '';
+ $_SERVER['PHP_SELF'] = '/app/webroot/index.php';
+ $_SERVER['REQUEST_URI'] = '/posts/add/%E2%88%82%E2%88%82';
+ $request = new CakeRequest();
+ $this->assertEquals('', $request->base);
+ $this->assertEquals(array(), $request->query);
+
+ $_GET = array();
+ $_GET['/cake_dev/posts/add/∂∂'] = '';
$_SERVER['PHP_SELF'] = '/cake_dev/app/webroot/index.php';
$_SERVER['REQUEST_URI'] = '/cake_dev/posts/add/%E2%88%82%E2%88%82';
-
$request = new CakeRequest();
+ $this->assertEquals('/cake_dev', $request->base);
$this->assertEquals(array(), $request->query);
}
@@ -1877,6 +1893,34 @@ public static function environmentGenerator() {
'urlParams' => array()
),
),
+ array(
+ 'Nginx - w/rewrite, document root set above top level cake dir, request root, no PATH_INFO, base parameter set',
+ array(
+ 'App' => array(
+ 'base' => false,
+ 'baseUrl' => false,
+ 'dir' => 'app',
+ 'webroot' => 'webroot'
+ ),
+ 'GET' => array('/site/posts/add' => ''),
+ 'SERVER' => array(
+ 'SERVER_NAME' => 'localhost',
+ 'DOCUMENT_ROOT' => '/Library/WebServer/Documents',
+ 'SCRIPT_FILENAME' => '/Library/WebServer/Documents/site/app/webroot/index.php',
+ 'SCRIPT_NAME' => '/site/app/webroot/index.php',
+ 'QUERY_STRING' => '/site/posts/add&',
+ 'PHP_SELF' => '/site/app/webroot/index.php',
+ 'PATH_INFO' => null,
+ 'REQUEST_URI' => '/site/posts/add',
+ ),
+ ),
+ array(
+ 'url' => 'posts/add',
+ 'base' => '/site',
+ 'webroot' => '/site/',
+ 'urlParams' => array()
+ ),
+ ),
);
}

0 comments on commit 5b4121f

Please sign in to comment.