diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2013-03-26 13:33:32 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2013-03-26 20:17:26 +0100 |
commit | 8a94e08e3009fece3f9de2d28c8f873dc4471b52 (patch) | |
tree | 4cdae6c6bcd471cae138dea8f4ee3bc5995e5a51 /tests/notification/submit_post_type_post_in_queue_test.php | |
parent | 0f204595d9b69c29716e8cf0ccf5033e66f5294f (diff) | |
download | forums-8a94e08e3009fece3f9de2d28c8f873dc4471b52.tar forums-8a94e08e3009fece3f9de2d28c8f873dc4471b52.tar.gz forums-8a94e08e3009fece3f9de2d28c8f873dc4471b52.tar.bz2 forums-8a94e08e3009fece3f9de2d28c8f873dc4471b52.tar.xz forums-8a94e08e3009fece3f9de2d28c8f873dc4471b52.zip |
[ticket/11405] Add unit tests for post_in_queue
PHPBB3-11405
Diffstat (limited to 'tests/notification/submit_post_type_post_in_queue_test.php')
-rw-r--r-- | tests/notification/submit_post_type_post_in_queue_test.php | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/tests/notification/submit_post_type_post_in_queue_test.php b/tests/notification/submit_post_type_post_in_queue_test.php new file mode 100644 index 0000000000..375ee3fbef --- /dev/null +++ b/tests/notification/submit_post_type_post_in_queue_test.php @@ -0,0 +1,102 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +require_once dirname(__FILE__) . '/submit_post_base.php'; + +class phpbb_notification_submit_post_type_post_in_queue_test extends phpbb_notification_submit_post_base +{ + protected $item_type = 'post_in_queue'; + + 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( + false, + 'm_approve', + array(1, 0), + array( + 1 => array( + 'm_approve' => array(3, 4, 6, 7, 8), + ), + ), + ), + array( + array(3, 4, 6, 7, 8), + 'f_read', + 1, + array( + 1 => array( + 'f_read' => array(3, 6, 7, 8), + ), + ), + ), + ))); + } + + /** + * submit_post() Notifications test + * + * submit_post() $mode = 'reply' + * Notification item_type = 'post_in_queue' + */ + public function submit_post_data() + { + return array( + /** + * Normal post + * + * No new notifications + */ + array( + array(), + array( + array('user_id' => 6, 'item_id' => 1, 'item_parent_id' => 1), + ), + array( + array('user_id' => 6, 'item_id' => 1, 'item_parent_id' => 1), + ), + ), + + /** + * Unapproved post + * + * User => State description + * 2 => Poster, should NOT receive a notification + * 3 => Moderator, should receive a notification + * 4 => Moderator, but unauthed to read, should NOT receive a notification + * 5 => Moderator, but unauthed to approve, should NOT receive a notification + * 6 => Moderator, but already notified, should STILL receive a new notification + * 7 => Moderator, but option disabled, should NOT receive a notification + * 8 => Moderator, option set to default, should receive a notification + */ + array( + array('force_approved_state' => false), + array( + array('user_id' => 6, 'item_id' => 1, 'item_parent_id' => 1), + ), + array( + array('user_id' => 3, 'item_id' => 2, 'item_parent_id' => 1), + array('user_id' => 6, 'item_id' => 1, 'item_parent_id' => 1), + array('user_id' => 6, 'item_id' => 2, 'item_parent_id' => 1), + array('user_id' => 8, 'item_id' => 2, 'item_parent_id' => 1), + ), + ), + ); + } +} |