4 class ToolsTest extends \PHPUnit_Framework_TestCase
6 public function testDetectBaseUrlPhar()
8 $_SERVER['REQUEST_URI'] = '/phar/phorkie-0.4.0.phar/list.php';
9 $_SERVER['SCRIPT_NAME'] = '/phar/phorkie-0.4.0.phar';
11 '/phar/phorkie-0.4.0.phar/',
12 Tools::detectBaseUrl()
16 public function testDetectBaseUrlRoot()
18 $_SERVER['REQUEST_URI'] = '/new';
19 $_SERVER['SCRIPT_NAME'] = '/new.php';
20 $this->assertEquals('/', Tools::detectBaseUrl());
23 public function testDetectBaseUrlRootWithPhp()
25 $_SERVER['REQUEST_URI'] = '/new.php';
26 $_SERVER['SCRIPT_NAME'] = '/new.php';
27 $this->assertEquals('/', Tools::detectBaseUrl());
30 public function testDetectBaseUrlSubdir()
32 $_SERVER['REQUEST_URI'] = '/foo/new';
33 $_SERVER['SCRIPT_NAME'] = '/new.php';
34 $this->assertEquals('/foo/', Tools::detectBaseUrl());
37 public function testFoldPathParentSingle()
41 Tools::foldPath('/path/to/bar/../foo')
45 public function testFoldPathParentDouble()
49 Tools::foldPath('/path/to/foo/bar/../../foo')
53 public function testFoldPathCurrentSingle()
57 Tools::foldPath('/path/to/foo/./')
61 public function testFoldPathCurrentThrice()
65 Tools::foldPath('/path/././to/foo/./')