From a888d8286acda9fb077a26d50925876277e3a235 Mon Sep 17 00:00:00 2001 From: Torben Dannhauer Date: Wed, 13 Aug 2025 22:05:27 +0200 Subject: [PATCH 1/3] Create HordeUrlParamRawModeTest.php --- test/Horde/Url/HordeUrlParamRawModeTest.php | 34 +++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test/Horde/Url/HordeUrlParamRawModeTest.php diff --git a/test/Horde/Url/HordeUrlParamRawModeTest.php b/test/Horde/Url/HordeUrlParamRawModeTest.php new file mode 100644 index 0000000..e74891e --- /dev/null +++ b/test/Horde/Url/HordeUrlParamRawModeTest.php @@ -0,0 +1,34 @@ +add('url', new Horde_Url('https://example.com/test?_t=123456&_h=Abcd123')); + $this->assertEquals( + 'test?url=https%3A%2F%2Fexample.com%2Ftest%3F_t%3D123456%26_h%3DAbcd123', + (string)$url + ); + + // Raw output should not HTML-escape the ampersands + $url->setRaw(true); + $this->assertEquals( + 'test?url=https%3A%2F%2Fexample.com%2Ftest%3F_t%3D123456%26_h%3DAbcd123', + (string)$url + ); + } +} + + From fe9b5bd7512ba31a7035c5ed47a8fdcc0ff0c5b3 Mon Sep 17 00:00:00 2001 From: Torben Dannhauer Date: Wed, 13 Aug 2025 22:07:32 +0200 Subject: [PATCH 2/3] Create NestedParamHordeUrlTest.php --- test/Horde/Url/NestedParamHordeUrlTest.php | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test/Horde/Url/NestedParamHordeUrlTest.php diff --git a/test/Horde/Url/NestedParamHordeUrlTest.php b/test/Horde/Url/NestedParamHordeUrlTest.php new file mode 100644 index 0000000..da8e300 --- /dev/null +++ b/test/Horde/Url/NestedParamHordeUrlTest.php @@ -0,0 +1,30 @@ +add('outer', [ + 'inner' => new Horde_Url('https://example.com/test?_t=1&_h=2') + ]); + // Current behavior: Only top-level values are normalized by PR #2. + // Nested arrays containing Horde_Url will still be expanded by http_build_query. + // This test documents current behavior and should be adapted once recursion is implemented. + $this->assertStringContainsString('outer%5Binner%5D%5Bparameters%5D', (string)$url); + $this->markTestIncomplete('Recursive normalization of nested Horde_Url parameters is not implemented yet.'); + } +} + + From d574b89628a855d5debe8d8b7ef1c806949e2c30 Mon Sep 17 00:00:00 2001 From: Torben Dannhauer Date: Wed, 13 Aug 2025 22:09:12 +0200 Subject: [PATCH 3/3] Create StringableParamTest.php --- test/Horde/Url/StringableParamTest.php | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/Horde/Url/StringableParamTest.php diff --git a/test/Horde/Url/StringableParamTest.php b/test/Horde/Url/StringableParamTest.php new file mode 100644 index 0000000..8d83887 --- /dev/null +++ b/test/Horde/Url/StringableParamTest.php @@ -0,0 +1,33 @@ +value = $value; } + public function __toString() { return (string)$this->value; } + }; + } + + public function testStringableObjectAsParamValue() + { + $this->markTestIncomplete('Generalized normalization for all stringable objects may be implemented later.'); + $url = new Horde_Url('test'); + $url->add('s', $this->getStringableObject('a&b')); + // Current implementation only normalizes Horde_Url instances; generic stringables are not cast explicitly. + // Keep test incomplete until generalized handling is agreed upon. + } +}