more tests

This commit is contained in:
Shish
2024-02-09 12:43:53 +00:00
parent 2e536e980c
commit 43e8ff3e3e
9 changed files with 299 additions and 189 deletions

View File

@@ -162,35 +162,4 @@ class UtilTest extends TestCase
path_to_tags("/category:/tag/baz.jpg")
);
}
public function test_get_query(): void
{
// niceurls
$_SERVER["REQUEST_URI"] = "/test/tasty/cake";
$this->assertEquals("/tasty/cake", _get_query());
// no niceurls
$_SERVER["REQUEST_URI"] = "/test/index.php?q=/tasty/cake";
$this->assertEquals("/tasty/cake", _get_query());
// leave url encoding alone
$_SERVER["REQUEST_URI"] = "/test/index.php?q=/tasty/cake%20pie";
$this->assertEquals("/tasty/cake%20pie", _get_query());
// if just viewing index.php
$_SERVER["REQUEST_URI"] = "/test/index.php";
$this->assertEquals("/", _get_query());
// niceurl root
$_SERVER["REQUEST_URI"] = "/test/";
$this->assertEquals("/", _get_query());
// niceurls with encoded slashes
$_SERVER["REQUEST_URI"] = "/test/post/list/tasty%2Fcake/1";
$this->assertEquals("/post/list/tasty%2Fcake/1", _get_query());
// query string with encoded slashes
$_SERVER["REQUEST_URI"] = "/test/index.php?q=/post/list/tasty%2Fcake/1";
$this->assertEquals("/post/list/tasty%2Fcake/1", _get_query());
}
}