1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-19 07:08:09 +01:00

[ticket/11405] Add unit tests for bookmarking

PHPBB3-11405
This commit is contained in:
Joas Schilling 2013-03-26 12:59:35 +01:00
parent cdd45cb8ba
commit 7e2f80ec0a
2 changed files with 165 additions and 0 deletions

View File

@ -1,5 +1,33 @@
<?xml version="1.0" encoding="UTF-8" ?>
<dataset>
<table name="phpbb_bookmarks">
<column>topic_id</column>
<column>user_id</column>
<row>
<value>1</value>
<value>2</value>
</row>
<row>
<value>1</value>
<value>3</value>
</row>
<row>
<value>1</value>
<value>4</value>
</row>
<row>
<value>1</value>
<value>5</value>
</row>
<row>
<value>1</value>
<value>6</value>
</row>
<row>
<value>1</value>
<value>7</value>
</row>
</table>
<table name="phpbb_forums_watch">
<column>forum_id</column>
<column>user_id</column>
@ -43,6 +71,14 @@
<value>0</value>
<value></value>
</row>
<row>
<value>bookmark</value>
<value>5</value>
<value>1</value>
<value>1</value>
<value>0</value>
<value></value>
</row>
<row>
<value>post</value>
<value>8</value>
@ -63,6 +99,10 @@
<value>quote</value>
<value>1</value>
</row>
<row>
<value>bookmark</value>
<value>1</value>
</row>
</table>
<table name="phpbb_posts">
<column>post_id</column>
@ -190,6 +230,13 @@
<value></value>
<value>1</value>
</row>
<row>
<value>bookmark</value>
<value>0</value>
<value>2</value>
<value></value>
<value>1</value>
</row>
<row>
<value>post</value>
<value>0</value>
@ -204,6 +251,13 @@
<value></value>
<value>1</value>
</row>
<row>
<value>bookmark</value>
<value>0</value>
<value>3</value>
<value></value>
<value>1</value>
</row>
<row>
<value>post</value>
<value>0</value>
@ -218,6 +272,13 @@
<value></value>
<value>1</value>
</row>
<row>
<value>bookmark</value>
<value>0</value>
<value>4</value>
<value></value>
<value>1</value>
</row>
<row>
<value>post</value>
<value>0</value>
@ -232,6 +293,13 @@
<value></value>
<value>1</value>
</row>
<row>
<value>bookmark</value>
<value>0</value>
<value>5</value>
<value></value>
<value>1</value>
</row>
<row>
<value>post</value>
<value>0</value>
@ -246,6 +314,13 @@
<value></value>
<value>0</value>
</row>
<row>
<value>bookmark</value>
<value>0</value>
<value>6</value>
<value></value>
<value>0</value>
</row>
<row>
<value>post</value>
<value>0</value>

View File

@ -0,0 +1,90 @@
<?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_bookmark_test extends phpbb_notification_submit_post_base
{
protected $item_type = 'bookmark';
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 = 'bookmark'
*/
public function submit_post_data()
{
return array(
/**
* Normal post
*
* User => State description
* 2 => Poster, should NOT receive a notification
* 3 => Bookmarked, should receive a notification
* 4 => Bookmarked, but unauthed to read, should NOT receive a notification
* 5 => Bookmarked, but already notified, should NOT receive a new notification
* 6 => Bookmarked, but option disabled, should NOT receive a notification
* 7 => Bookmarked, option set to default, should receive a notification
*/
array(
array(),
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' => 7, 'item_id' => 2, 'item_parent_id' => 1),
),
),
/**
* Unapproved post
*
* No new notifications
*/
array(
array('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),
),
),
);
}
}