diff options
author | Mario <mario@mariovavti.com> | 2024-05-02 14:45:26 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2024-05-02 14:45:26 +0000 |
commit | 2fb9c0ec0d77a3754a7c1f35e5c3e0742bfed3b1 (patch) | |
tree | ebd28fd984a0ac7e2e4eea039e4b35d59583ce5a /tests/unit/Lib/ZotlibTest.php | |
parent | 98c3e2f93f18554364e26e9cf25473d36641a173 (diff) | |
parent | fb4568001d5669055f8a5c010b04fd460bb43a43 (diff) | |
download | volse-hubzilla-2fb9c0ec0d77a3754a7c1f35e5c3e0742bfed3b1.tar.gz volse-hubzilla-2fb9c0ec0d77a3754a7c1f35e5c3e0742bfed3b1.tar.bz2 volse-hubzilla-2fb9c0ec0d77a3754a7c1f35e5c3e0742bfed3b1.zip |
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
Diffstat (limited to 'tests/unit/Lib/ZotlibTest.php')
-rw-r--r-- | tests/unit/Lib/ZotlibTest.php | 34 |
1 files changed, 34 insertions, 0 deletions
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 @@ +<?php +class LibzotTest extends \Zotlabs\Tests\Unit\UnitTestCase { + /** + * Test the `get_rpost_path` function. + * + * @dataProvider get_rpost_path_provider + */ + public function test_get_rpost_path(string $expected, string $xchan_url) : void { + $observer = [ 'xchan_url' => $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', + ], + ]; + } +} |