6 namespace Shaarli\Http
;
8 require_once 'application/http/HttpUtils.php';
11 * Unitary tests for page_url()
13 class PageUrlTest
extends \PHPUnit\Framework\TestCase
16 * If on the main page, remove "index.php" from the URL resource
18 public function testRemoveIndex()
21 'http://host.tld/?p1=v1&p2=v2',
25 'SERVER_NAME' => 'host.tld',
26 'SERVER_PORT' => '80',
27 'SCRIPT_NAME' => '/index.php',
28 'QUERY_STRING' => 'p1=v1&p2=v2'
34 'http://host.tld/admin/?action=edit_tag',
38 'SERVER_NAME' => 'host.tld',
39 'SERVER_PORT' => '80',
40 'SCRIPT_NAME' => '/admin/index.php',
41 'QUERY_STRING' => 'action=edit_tag'
48 * The resource is != "index.php"
50 public function testOtherResource()
53 'http://host.tld/page.php?p1=v1&p2=v2',
57 'SERVER_NAME' => 'host.tld',
58 'SERVER_PORT' => '80',
59 'SCRIPT_NAME' => '/page.php',
60 'QUERY_STRING' => 'p1=v1&p2=v2'
66 'http://host.tld/admin/page.php?action=edit_tag',
70 'SERVER_NAME' => 'host.tld',
71 'SERVER_PORT' => '80',
72 'SCRIPT_NAME' => '/admin/page.php',
73 'QUERY_STRING' => 'action=edit_tag'