diff options
| author | Andrew Dolgov <fox@fakecake.org> | 2026-06-26 17:44:13 +0300 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2026-06-26 17:44:13 +0300 |
| commit | 96299844c2e630a8ea27d86d53aadf98216b9ab8 (patch) | |
| tree | 410d76eb9004c783545ee80129c69096b2040752 /tests | |
| parent | e3b4fbde9066ec58873240ff67c7fb7ce1dfbdd4 (diff) | |
| download | the-epube-96299844c2e630a8ea27d86d53aadf98216b9ab8.tar.gz the-epube-96299844c2e630a8ea27d86d53aadf98216b9ab8.tar.xz | |
drop clean()
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/RequestTest.php | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/RequestTest.php b/tests/RequestTest.php index fc7ff97..082e06b 100644 --- a/tests/RequestTest.php +++ b/tests/RequestTest.php @@ -266,11 +266,11 @@ final class RequestTest extends TestCase $this->assertEquals('default', $request->getString('missing', 'default')); } - public function test_get_string_sanitizes_input(): void + public function test_get_string_trims_whitespace(): void { - $_REQUEST = ['html' => '<script>alert(1)</script>']; + $_REQUEST = ['text' => ' hello world ']; $request = new Request(); - $this->assertEquals('alert(1)', $request->getString('html')); + $this->assertEquals('hello world', $request->getString('text')); } public function test_get_string_handles_numeric_value(): void @@ -633,10 +633,11 @@ final class RequestTest extends TestCase $this->assertFalse(Request::_to_bool(null)); } - public function test_to_bool_handles_sanitization(): void + public function test_to_bool_rejects_non_boolean_strings(): void { - // clean() strips tags; '<script>1</script>' → '1' → true - $this->assertTrue(Request::_to_bool('<script>1</script>')); + // Strings that aren't recognized boolean keywords evaluate to false, + // since we no longer attempt HTML stripping. + $this->assertFalse(Request::_to_bool('<script>1</script>')); } public function test_to_bool_case_insensitive(): void |
