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 + ); + } +} + + 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.'); + } +} + + 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. + } +}