diff options
Diffstat (limited to 'tests/RequestTest.php')
| -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 |
