mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-16 16:28:53 +00:00
[ticket/11405] Add unit tests for post_in_queue
PHPBB3-11405
This commit is contained in:
parent
0f204595d9
commit
8a94e08e30
2 changed files with 262 additions and 0 deletions
160
tests/notification/fixtures/submit_post_post_in_queue.xml
Normal file
160
tests/notification/fixtures/submit_post_post_in_queue.xml
Normal file
|
@ -0,0 +1,160 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<dataset>
|
||||
<table name="phpbb_notifications">
|
||||
<column>item_type</column>
|
||||
<column>user_id</column>
|
||||
<column>item_id</column>
|
||||
<column>item_parent_id</column>
|
||||
<column>notification_read</column>
|
||||
<column>notification_data</column>
|
||||
<row>
|
||||
<value>post_in_queue</value>
|
||||
<value>6</value>
|
||||
<value>1</value>
|
||||
<value>1</value>
|
||||
<value>0</value>
|
||||
<value></value>
|
||||
</row>
|
||||
</table>
|
||||
<table name="phpbb_notification_types">
|
||||
<column>notification_type</column>
|
||||
<column>notification_type_enabled</column>
|
||||
<row>
|
||||
<value>post_in_queue</value>
|
||||
<value>1</value>
|
||||
</row>
|
||||
</table>
|
||||
<table name="phpbb_posts">
|
||||
<column>post_id</column>
|
||||
<column>topic_id</column>
|
||||
<column>forum_id</column>
|
||||
<column>post_text</column>
|
||||
<row>
|
||||
<value>1</value>
|
||||
<value>1</value>
|
||||
<value>1</value>
|
||||
<value></value>
|
||||
</row>
|
||||
</table>
|
||||
<table name="phpbb_topics">
|
||||
<column>topic_id</column>
|
||||
<column>forum_id</column>
|
||||
<row>
|
||||
<value>1</value>
|
||||
<value>1</value>
|
||||
</row>
|
||||
</table>
|
||||
<table name="phpbb_users">
|
||||
<column>user_id</column>
|
||||
<column>username_clean</column>
|
||||
<column>user_permissions</column>
|
||||
<column>user_sig</column>
|
||||
<column>user_occ</column>
|
||||
<column>user_interests</column>
|
||||
<row>
|
||||
<value>2</value>
|
||||
<value>poster</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
</row>
|
||||
<row>
|
||||
<value>3</value>
|
||||
<value>test</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
</row>
|
||||
<row>
|
||||
<value>4</value>
|
||||
<value>unauthorized-mod</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
</row>
|
||||
<row>
|
||||
<value>5</value>
|
||||
<value>unauthorized-read</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
</row>
|
||||
<row>
|
||||
<value>6</value>
|
||||
<value>notified</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
</row>
|
||||
<row>
|
||||
<value>7</value>
|
||||
<value>disabled</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
</row>
|
||||
<row>
|
||||
<value>8</value>
|
||||
<value>default</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
</row>
|
||||
</table>
|
||||
<table name="phpbb_user_notifications">
|
||||
<column>item_type</column>
|
||||
<column>item_id</column>
|
||||
<column>user_id</column>
|
||||
<column>method</column>
|
||||
<column>notify</column>
|
||||
<row>
|
||||
<value>needs_approval</value>
|
||||
<value>0</value>
|
||||
<value>2</value>
|
||||
<value></value>
|
||||
<value>1</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>needs_approval</value>
|
||||
<value>0</value>
|
||||
<value>3</value>
|
||||
<value></value>
|
||||
<value>1</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>needs_approval</value>
|
||||
<value>0</value>
|
||||
<value>4</value>
|
||||
<value></value>
|
||||
<value>1</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>needs_approval</value>
|
||||
<value>0</value>
|
||||
<value>5</value>
|
||||
<value></value>
|
||||
<value>1</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>needs_approval</value>
|
||||
<value>0</value>
|
||||
<value>6</value>
|
||||
<value></value>
|
||||
<value>1</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>needs_approval</value>
|
||||
<value>0</value>
|
||||
<value>7</value>
|
||||
<value></value>
|
||||
<value>0</value>
|
||||
</row>
|
||||
</table>
|
||||
</dataset>
|
102
tests/notification/submit_post_type_post_in_queue_test.php
Normal file
102
tests/notification/submit_post_type_post_in_queue_test.php
Normal file
|
@ -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),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue