aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/unit/includes/ItemsTest.php132
-rw-r--r--vendor/composer/installed.php4
2 files changed, 134 insertions, 2 deletions
diff --git a/tests/unit/includes/ItemsTest.php b/tests/unit/includes/ItemsTest.php
new file mode 100644
index 000000000..1c2fb6725
--- /dev/null
+++ b/tests/unit/includes/ItemsTest.php
@@ -0,0 +1,132 @@
+<?php
+/**
+ * tests function from include/items.php
+ *
+ * @package test.util
+ */
+
+use Zotlabs\Tests\Unit\UnitTestCase;
+
+class ItemsTest extends UnitTestCase {
+ /**
+ * Data provider for item_forwardable function.
+ *
+ * @return array
+ */
+ public static function itemForwardableDataProvider()
+ {
+ return [
+ // Test case: item is unpublished
+ [
+ [
+ 'item_unpublished' => 1,
+ 'item_delayed' => 0,
+ 'item_blocked' => 0,
+ 'item_hidden' => 0,
+ 'item_restrict' => 0,
+ 'verb' => 'Create',
+ 'postopts' => '',
+ 'author' => ['xchan_network' => '']
+ ],
+ false // Expected result
+ ],
+ // Test case: item is delayed
+ [
+ [
+ 'item_unpublished' => 0,
+ 'item_delayed' => 1,
+ 'item_blocked' => 0,
+ 'item_hidden' => 0,
+ 'item_restrict' => 0,
+ 'verb' => 'Create',
+ 'postopts' => '',
+ 'author' => ['xchan_network' => '']
+ ],
+ false
+ ],
+ // Test case: item is blocked
+ [
+ [
+ 'item_unpublished' => 0,
+ 'item_delayed' => 0,
+ 'item_blocked' => 1,
+ 'item_hidden' => 0,
+ 'item_restrict' => 0,
+ 'verb' => 'Create',
+ 'postopts' => '',
+ 'author' => ['xchan_network' => '']
+ ],
+ false
+ ],
+ // Test case: verb is 'Follow' (forbidden verb)
+ [
+ [
+ 'item_unpublished' => 0,
+ 'item_delayed' => 0,
+ 'item_blocked' => 0,
+ 'item_hidden' => 0,
+ 'item_restrict' => 0,
+ 'verb' => 'Follow',
+ 'postopts' => '',
+ 'author' => ['xchan_network' => '']
+ ],
+ false
+ ],
+ // Test case: postopts contains 'nodeliver'
+ [
+ [
+ 'item_unpublished' => 0,
+ 'item_delayed' => 0,
+ 'item_blocked' => 0,
+ 'item_hidden' => 0,
+ 'item_restrict' => 0,
+ 'verb' => 'Create',
+ 'postopts' => 'nodeliver',
+ 'author' => ['xchan_network' => '']
+ ],
+ false
+ ],
+ // Test case: actor's network is 'rss' (restricted network)
+ [
+ [
+ 'item_unpublished' => 0,
+ 'item_delayed' => 0,
+ 'item_blocked' => 0,
+ 'item_hidden' => 0,
+ 'item_restrict' => 0,
+ 'verb' => 'Create',
+ 'postopts' => '',
+ 'author' => ['xchan_network' => 'rss']
+ ],
+ false
+ ],
+ // Test case: no conditions met (should forward)
+ [
+ [
+ 'item_unpublished' => 0,
+ 'item_delayed' => 0,
+ 'item_blocked' => 0,
+ 'item_hidden' => 0,
+ 'item_restrict' => 0,
+ 'verb' => 'Create',
+ 'postopts' => '',
+ 'author' => ['xchan_network' => 'other']
+ ],
+ true
+ ]
+ ];
+ }
+
+ /**
+ * Test item_forwardable with various data.
+ *
+ * @dataProvider itemForwardableDataProvider
+ */
+ public function testItemForwardable($item, $expected)
+ {
+ $this->assertSame($expected, item_forwardable($item));
+ }
+
+}
+
+
diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php
index e43f8b8c7..f94b6427f 100644
--- a/vendor/composer/installed.php
+++ b/vendor/composer/installed.php
@@ -3,7 +3,7 @@
'name' => 'zotlabs/hubzilla',
'pretty_version' => 'dev-9.4RC',
'version' => 'dev-9.4RC',
- 'reference' => 'e88ae54bef268e455b6d6028a697e9dbd98a7853',
+ 'reference' => '93f72a53f518f4c6fd9ebd29536e0d44da366baf',
'type' => 'application',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -367,7 +367,7 @@
'zotlabs/hubzilla' => array(
'pretty_version' => 'dev-9.4RC',
'version' => 'dev-9.4RC',
- 'reference' => 'e88ae54bef268e455b6d6028a697e9dbd98a7853',
+ 'reference' => '93f72a53f518f4c6fd9ebd29536e0d44da366baf',
'type' => 'application',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),