]>
git.immae.eu Git - github/shaarli/Shaarli.git/blob - tests/http/HttpUtils/IndexUrlTest.php
6 namespace Shaarli\Http
;
10 require_once 'application/http/HttpUtils.php';
13 * Unitary tests for index_url()
15 class IndexUrlTest
extends TestCase
18 * If on the main page, remove "index.php" from the URL resource
20 public function testRemoveIndex()
27 'SERVER_NAME' => 'host.tld',
28 'SERVER_PORT' => '80',
29 'SCRIPT_NAME' => '/index.php'
35 'http://host.tld/admin/',
39 'SERVER_NAME' => 'host.tld',
40 'SERVER_PORT' => '80',
41 'SCRIPT_NAME' => '/admin/index.php'
48 * The resource is != "index.php"
50 public function testOtherResource()
53 'http://host.tld/page.php',
57 'SERVER_NAME' => 'host.tld',
58 'SERVER_PORT' => '80',
59 'SCRIPT_NAME' => '/page.php'
65 'http://host.tld/admin/page.php',
69 'SERVER_NAME' => 'host.tld',
70 'SERVER_PORT' => '80',
71 'SCRIPT_NAME' => '/admin/page.php'
78 * The route is stored in REQUEST_URI
80 public function testPageUrlWithRoute()
83 'http://host.tld/picture-wall',
87 'SERVER_NAME' => 'host.tld',
88 'SERVER_PORT' => '80',
89 'SCRIPT_NAME' => '/index.php',
90 'REQUEST_URI' => '/picture-wall',
96 'http://host.tld/admin/picture-wall',
100 'SERVER_NAME' => 'host.tld',
101 'SERVER_PORT' => '80',
102 'SCRIPT_NAME' => '/admin/index.php',
103 'REQUEST_URI' => '/admin/picture-wall',
110 * The route is stored in REQUEST_URI and subfolder
112 public function testPageUrlWithRouteUnderSubfolder()
115 'http://host.tld/subfolder/picture-wall',
119 'SERVER_NAME' => 'host.tld',
120 'SERVER_PORT' => '80',
121 'SCRIPT_NAME' => '/subfolder/index.php',
122 'REQUEST_URI' => '/subfolder/picture-wall',
128 'http://host.tld/subfolder/admin/picture-wall',
132 'SERVER_NAME' => 'host.tld',
133 'SERVER_PORT' => '80',
134 'SCRIPT_NAME' => '/subfolder/admin/index.php',
135 'REQUEST_URI' => '/subfolder/admin/picture-wall',