aboutsummaryrefslogtreecommitdiffstats
path: root/tests/notification/submit_post_type_quote_test.php
diff options
context:
space:
mode:
authorMaat <maat-pub@mageia.biz>2020-05-08 18:29:30 +0200
committerMaat <maat-pub@mageia.biz>2020-05-08 21:36:04 +0200
commit36bc1870f21fac04736a1049c1d5b8e127d729f4 (patch)
tree9d102331eeaf1ef3cd23e656320d7c08e65757ed /tests/notification/submit_post_type_quote_test.php
parent8875d385d0579b451dac4d9bda465172b4f69ee0 (diff)
parent149375253685b3a38996f63015a74b7a0f53aa14 (diff)
downloadforums-36bc1870f21fac04736a1049c1d5b8e127d729f4.tar
forums-36bc1870f21fac04736a1049c1d5b8e127d729f4.tar.gz
forums-36bc1870f21fac04736a1049c1d5b8e127d729f4.tar.bz2
forums-36bc1870f21fac04736a1049c1d5b8e127d729f4.tar.xz
forums-36bc1870f21fac04736a1049c1d5b8e127d729f4.zip
Merge remote-tracking branch 'upstream/prep-release-3.1.11'
Diffstat (limited to 'tests/notification/submit_post_type_quote_test.php')
-rw-r--r--tests/notification/submit_post_type_quote_test.php118
1 files changed, 118 insertions, 0 deletions
diff --git a/tests/notification/submit_post_type_quote_test.php b/tests/notification/submit_post_type_quote_test.php
new file mode 100644
index 0000000000..61e3840773
--- /dev/null
+++ b/tests/notification/submit_post_type_quote_test.php
@@ -0,0 +1,118 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+require_once dirname(__FILE__) . '/submit_post_base.php';
+
+class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_submit_post_base
+{
+ protected $item_type = 'notification.type.quote';
+
+ public function setUp()
+ {
+ parent::setUp();
+
+ global $auth;
+
+ // Add additional permissions
+ $auth->expects($this->any())
+ ->method('acl_get_list')
+ ->with($this->anything(),
+ $this->stringContains('_'),
+ $this->greaterThan(0))
+ ->will($this->returnValueMap(array(
+ array(
+ array(3, 4, 5, 6, 7),
+ 'f_read',
+ 1,
+ array(
+ 1 => array(
+ 'f_read' => array(3, 5, 6, 7),
+ ),
+ ),
+ ),
+ )));
+ }
+
+ /**
+ * submit_post() Notifications test
+ *
+ * submit_post() $mode = 'reply'
+ * Notification item_type = 'quote'
+ */
+ public function submit_post_data()
+ {
+ return array(
+ /**
+ * Normal post
+ *
+ * User => State description
+ * 2 => Poster, should NOT receive a notification
+ * 3 => Quoted, should receive a notification
+ * 4 => Quoted, but unauthed to read, should NOT receive a notification
+ * 5 => Quoted, but already notified, should STILL receive a new notification
+ * 6 => Quoted, but option disabled, should NOT receive a notification
+ * 7 => Quoted, option set to default, should receive a notification
+ */
+ array(
+ array(
+ 'message' => implode(' ', array(
+ '[quote=&quot;poster&quot;:uid]poster should not be notified[/quote:uid]',
+ '[quote=&quot;test&quot;:uid]test should be notified[/quote:uid]',
+ '[quote=&quot;unauthorized&quot;:uid]unauthorized to read, should not receive a notification[/quote:uid]',
+ '[quote=&quot;notified&quot;:uid]already notified, should not receive a new notification[/quote:uid]',
+ '[quote=&quot;disabled&quot;:uid]option disabled, should not receive a notification[/quote:uid]',
+ '[quote=&quot;default&quot;:uid]option set to default, should receive a notification[/quote:uid]',
+ '[quote=&quot;doesn\'t exist&quot;:uid]user does not exist, should not receive a notification[/quote:uid]',
+ )),
+ 'bbcode_uid' => 'uid',
+ ),
+ array(
+ array('user_id' => 5, 'item_id' => 1, 'item_parent_id' => 1),
+ ),
+ array(
+ array('user_id' => 3, 'item_id' => 2, 'item_parent_id' => 1),
+ array('user_id' => 5, 'item_id' => 1, 'item_parent_id' => 1),
+ array('user_id' => 5, 'item_id' => 2, 'item_parent_id' => 1),
+ array('user_id' => 7, 'item_id' => 2, 'item_parent_id' => 1),
+ ),
+ ),
+
+ /**
+ * Unapproved post
+ *
+ * No new notifications
+ */
+ array(
+ array(
+ 'message' => implode(' ', array(
+ '[quote=&quot;poster&quot;:uid]poster should not be notified[/quote:uid]',
+ '[quote=&quot;test&quot;:uid]test should be notified[/quote:uid]',
+ '[quote=&quot;unauthorized&quot;:uid]unauthorized to read, should not receive a notification[/quote:uid]',
+ '[quote=&quot;notified&quot;:uid]already notified, should not receive a new notification[/quote:uid]',
+ '[quote=&quot;disabled&quot;:uid]option disabled, should not receive a notification[/quote:uid]',
+ '[quote=&quot;default&quot;:uid]option set to default, should receive a notification[/quote:uid]',
+ '[quote=&quot;doesn\'t exist&quot;:uid]user does not exist, should not receive a notification[/quote:uid]',
+ )),
+ 'bbcode_uid' => 'uid',
+ 'force_approved_state' => false,
+ ),
+ array(
+ array('user_id' => 5, 'item_id' => 1, 'item_parent_id' => 1),
+ ),
+ array(
+ array('user_id' => 5, 'item_id' => 1, 'item_parent_id' => 1),
+ ),
+ ),
+ );
+ }
+}