diff options
| author | fox <fox@fakecake.org> | 2026-06-26 17:47:01 +0300 |
|---|---|---|
| committer | fox <fox@fakecake.org> | 2026-06-26 17:47:01 +0300 |
| commit | 04524943b6b6b1ed314df320630fa3eed1783b2c (patch) | |
| tree | 410d76eb9004c783545ee80129c69096b2040752 /tests/RequestTest.php | |
| parent | a17d0f6277cd169f237ce8bb5cfc705c5582ed66 (diff) | |
| parent | 96299844c2e630a8ea27d86d53aadf98216b9ab8 (diff) | |
| download | the-epube-04524943b6b6b1ed314df320630fa3eed1783b2c.tar.gz the-epube-04524943b6b6b1ed314df320630fa3eed1783b2c.tar.xz | |
Merge branch 'dev' into 'master'
drop clean() See merge request git/the-epube!69
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 |
