diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2013-03-26 12:58:14 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2013-03-26 12:58:14 +0100 |
commit | cdd45cb8ba4d420bfc44a9bb7a4c43662ec78156 (patch) | |
tree | fa129c5d9a6d8ed5fa19b2164e7f23bba50a0d68 /tests/notification/submit_post_base.php | |
parent | 053c75543de4c8e5d787a2e344b837f867842f8d (diff) | |
download | forums-cdd45cb8ba4d420bfc44a9bb7a4c43662ec78156.tar forums-cdd45cb8ba4d420bfc44a9bb7a4c43662ec78156.tar.gz forums-cdd45cb8ba4d420bfc44a9bb7a4c43662ec78156.tar.bz2 forums-cdd45cb8ba4d420bfc44a9bb7a4c43662ec78156.tar.xz forums-cdd45cb8ba4d420bfc44a9bb7a4c43662ec78156.zip |
[ticket/11405] Move test to submit_post_base.php and use data sets for testing
PHPBB3-11405
Diffstat (limited to 'tests/notification/submit_post_base.php')
-rw-r--r-- | tests/notification/submit_post_base.php | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php index 60d0e798cb..f458a4896a 100644 --- a/tests/notification/submit_post_base.php +++ b/tests/notification/submit_post_base.php @@ -16,6 +16,27 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case { protected $notifications, $db, $container, $user, $config, $auth, $cache; + protected $item_type = ''; + + protected $poll_data = array(); + protected $post_data = array( + 'forum_id' => 1, + 'topic_id' => 1, + 'topic_title' => 'topic_title', + 'icon_id' => 0, + 'enable_bbcode' => 0, + 'enable_smilies' => 0, + 'enable_urls' => 0, + 'enable_sig' => 0, + 'message' => '', + 'message_md5' => '', + 'attachment_data' => array(), + 'bbcode_bitfield' => '', + 'bbcode_uid' => '', + 'post_edit_locked' => false, + //'force_approved_state' => 1, + ); + public function getDataSet() { return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/submit_post_notification.xml'); @@ -81,7 +102,7 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case $phpbb_container->set('notification_manager', $phpbb_notifications); // Notification Types - $notification_types = array('quote', 'bookmark', 'post'); + $notification_types = array('quote', 'bookmark', 'post', 'post_in_queue'); foreach ($notification_types as $type) { $class_name = 'phpbb_notification_type_' . $type; @@ -91,4 +112,28 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE)); } } + + /** + * @dataProvider submit_post_data + */ + public function test_submit_post($additional_post_data, $expected_before, $expected_after) + { + $sql = 'SELECT user_id, item_id, item_parent_id + FROM ' . NOTIFICATIONS_TABLE . " + WHERE item_type = '" . $this->item_type . "' + ORDER BY user_id, item_id ASC"; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_before, $this->db->sql_fetchrowset($result)); + $this->db->sql_freeresult($result); + + submit_post('reply', '', 'poster-name', POST_NORMAL, $this->poll_data, array_merge($this->post_data, $additional_post_data), false, false); + + $sql = 'SELECT user_id, item_id, item_parent_id + FROM ' . NOTIFICATIONS_TABLE . " + WHERE item_type = '" . $this->item_type . "' + ORDER BY user_id ASC, item_id ASC"; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_after, $this->db->sql_fetchrowset($result)); + $this->db->sql_freeresult($result); + } } |