aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/Lib/ZotlibTest.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-07-06 11:05:22 +0000
committerMario <mario@mariovavti.com>2024-07-06 11:05:22 +0000
commit45275910e606a02b12393714ea3b0409da440d61 (patch)
tree10b2d173d58cb930f8df28fe75af73dd4974c08c /tests/unit/Lib/ZotlibTest.php
parent0c1d0f7498661fb34dcca6f3c6566e757af310a7 (diff)
parentc04e781926a78e514cdf211fa24930a331149072 (diff)
downloadvolse-hubzilla-45275910e606a02b12393714ea3b0409da440d61.tar.gz
volse-hubzilla-45275910e606a02b12393714ea3b0409da440d61.tar.bz2
volse-hubzilla-45275910e606a02b12393714ea3b0409da440d61.zip
Merge branch '9.2RC'master
Diffstat (limited to 'tests/unit/Lib/ZotlibTest.php')
-rw-r--r--tests/unit/Lib/ZotlibTest.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/unit/Lib/ZotlibTest.php b/tests/unit/Lib/ZotlibTest.php
new file mode 100644
index 000000000..0ab89dc2f
--- /dev/null
+++ b/tests/unit/Lib/ZotlibTest.php
@@ -0,0 +1,38 @@
+<?php
+namespace Zotlabs\Tests\Unit\Lib;
+
+use Zotlabs\Tests\Unit\UnitTestCase;
+
+class ZotlibTest extends 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));
+ }
+
+ public static 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',
+ ],
+ ];
+ }
+}