diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2014-07-06 14:20:56 +0200 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2014-07-06 14:20:56 +0200 |
| commit | f40a91b0a300377d7c74e764bbf83b27a3dfae5f (patch) | |
| tree | 0b8baeba316a2c371c65a21c6311210a0f3f9dca /tests | |
| parent | 18795ac792f80849f509aaf658d860f078b03344 (diff) | |
| download | phorkie-f40a91b0a300377d7c74e764bbf83b27a3dfae5f.tar.gz phorkie-f40a91b0a300377d7c74e764bbf83b27a3dfae5f.zip | |
fix basedir detection for rewritten paths
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/phorkie/ToolsTest.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/phorkie/ToolsTest.php b/tests/phorkie/ToolsTest.php index 021797d..d8df8f4 100644 --- a/tests/phorkie/ToolsTest.php +++ b/tests/phorkie/ToolsTest.php @@ -3,6 +3,11 @@ namespace phorkie; class ToolsTest extends \PHPUnit_Framework_TestCase { + public function setUp() + { + $_GET[] = array(); + } + public function testDetectBaseUrlPhar() { $_SERVER['REQUEST_URI'] = '/phar/phorkie-0.4.0.phar/list.php'; @@ -34,6 +39,22 @@ class ToolsTest extends \PHPUnit_Framework_TestCase $this->assertEquals('/foo/', Tools::detectBaseUrl()); } + public function testDetectBaseUrlEdit() + { + $_GET['id'] = 82; + $_SERVER['REQUEST_URI'] = '/82/edit'; + $_SERVER['SCRIPT_NAME'] = '/edit.php'; + $this->assertEquals('/', Tools::detectBaseUrl()); + } + + public function testDetectBaseUrlEditSubdir() + { + $_GET['id'] = 82; + $_SERVER['REQUEST_URI'] = '/foo/82/edit'; + $_SERVER['SCRIPT_NAME'] = '/edit.php'; + $this->assertEquals('/foo/', Tools::detectBaseUrl()); + } + public function testFoldPathParentSingle() { $this->assertEquals( |
