From 630cecd740762cc6111468b46644fcae85a360b3 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Tue, 5 Mar 2024 20:52:16 +0100 Subject: Libzot: get_rpost_path was broken for URL's with no port. --- tests/unit/Lib/ZotlibTest.php | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/unit/Lib/ZotlibTest.php (limited to 'tests/unit/Lib/ZotlibTest.php') diff --git a/tests/unit/Lib/ZotlibTest.php b/tests/unit/Lib/ZotlibTest.php new file mode 100644 index 000000000..05522678f --- /dev/null +++ b/tests/unit/Lib/ZotlibTest.php @@ -0,0 +1,34 @@ + $xchan_url ]; + + $this->assertEquals($expected, \Zotlabs\Lib\Libzot::get_rpost_path($observer)); + } + + private function get_rpost_path_provider() : array { + return [ + 'xchan_url without port' => [ + 'https://example.com/rpost?f=', + 'https://example.com' + ], + 'xchan_url with port' => [ + 'https://example.com:666/rpost?f=', + 'https://example.com:666' + ], + 'xchan_url ignores path and args' => [ + 'https://example.com/rpost?f=', + 'https://example.com/path?arg1=balle' + ], + 'xchan_url with no scheme should default to https' => [ + 'https://example.com/rpost?f=', + 'example.com', + ], + ]; + } +} -- cgit v1.2.3