mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/11413] Fix test fixtures and tests
PHPBB3-11413
This commit is contained in:
parent
78c22248fa
commit
878df5f280
5 changed files with 46 additions and 28 deletions
|
@ -29,14 +29,14 @@
|
||||||
</row>
|
</row>
|
||||||
</table>
|
</table>
|
||||||
<table name="phpbb_notifications">
|
<table name="phpbb_notifications">
|
||||||
<column>item_type</column>
|
<column>notification_type_id</column>
|
||||||
<column>user_id</column>
|
<column>user_id</column>
|
||||||
<column>item_id</column>
|
<column>item_id</column>
|
||||||
<column>item_parent_id</column>
|
<column>item_parent_id</column>
|
||||||
<column>notification_read</column>
|
<column>notification_read</column>
|
||||||
<column>notification_data</column>
|
<column>notification_data</column>
|
||||||
<row>
|
<row>
|
||||||
<value>bookmark</value>
|
<value>1</value>
|
||||||
<value>5</value>
|
<value>5</value>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
|
@ -45,9 +45,11 @@
|
||||||
</row>
|
</row>
|
||||||
</table>
|
</table>
|
||||||
<table name="phpbb_notification_types">
|
<table name="phpbb_notification_types">
|
||||||
<column>notification_type</column>
|
<column>notification_type_id</column>
|
||||||
|
<column>notification_type_name</column>
|
||||||
<column>notification_type_enabled</column>
|
<column>notification_type_enabled</column>
|
||||||
<row>
|
<row>
|
||||||
|
<value>1</value>
|
||||||
<value>bookmark</value>
|
<value>bookmark</value>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
</row>
|
</row>
|
||||||
|
|
|
@ -21,14 +21,14 @@
|
||||||
</row>
|
</row>
|
||||||
</table>
|
</table>
|
||||||
<table name="phpbb_notifications">
|
<table name="phpbb_notifications">
|
||||||
<column>item_type</column>
|
<column>notification_type_id</column>
|
||||||
<column>user_id</column>
|
<column>user_id</column>
|
||||||
<column>item_id</column>
|
<column>item_id</column>
|
||||||
<column>item_parent_id</column>
|
<column>item_parent_id</column>
|
||||||
<column>notification_read</column>
|
<column>notification_read</column>
|
||||||
<column>notification_data</column>
|
<column>notification_data</column>
|
||||||
<row>
|
<row>
|
||||||
<value>post</value>
|
<value>1</value>
|
||||||
<value>5</value>
|
<value>5</value>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
<value></value>
|
<value></value>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<value>post</value>
|
<value>1</value>
|
||||||
<value>8</value>
|
<value>8</value>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
|
@ -45,9 +45,11 @@
|
||||||
</row>
|
</row>
|
||||||
</table>
|
</table>
|
||||||
<table name="phpbb_notification_types">
|
<table name="phpbb_notification_types">
|
||||||
<column>notification_type</column>
|
<column>notification_type_id</column>
|
||||||
|
<column>notification_type_name</column>
|
||||||
<column>notification_type_enabled</column>
|
<column>notification_type_enabled</column>
|
||||||
<row>
|
<row>
|
||||||
|
<value>1</value>
|
||||||
<value>post</value>
|
<value>post</value>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
</row>
|
</row>
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<dataset>
|
<dataset>
|
||||||
<table name="phpbb_notifications">
|
<table name="phpbb_notifications">
|
||||||
<column>item_type</column>
|
<column>notification_type_id</column>
|
||||||
<column>user_id</column>
|
<column>user_id</column>
|
||||||
<column>item_id</column>
|
<column>item_id</column>
|
||||||
<column>item_parent_id</column>
|
<column>item_parent_id</column>
|
||||||
<column>notification_read</column>
|
<column>notification_read</column>
|
||||||
<column>notification_data</column>
|
<column>notification_data</column>
|
||||||
<row>
|
<row>
|
||||||
<value>post_in_queue</value>
|
<value>1</value>
|
||||||
<value>6</value>
|
<value>6</value>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
|
@ -17,9 +17,11 @@
|
||||||
</row>
|
</row>
|
||||||
</table>
|
</table>
|
||||||
<table name="phpbb_notification_types">
|
<table name="phpbb_notification_types">
|
||||||
<column>notification_type</column>
|
<column>notification_type_id</column>
|
||||||
|
<column>notification_type_name</column>
|
||||||
<column>notification_type_enabled</column>
|
<column>notification_type_enabled</column>
|
||||||
<row>
|
<row>
|
||||||
|
<value>1</value>
|
||||||
<value>post_in_queue</value>
|
<value>post_in_queue</value>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
</row>
|
</row>
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<dataset>
|
<dataset>
|
||||||
<table name="phpbb_notifications">
|
<table name="phpbb_notifications">
|
||||||
<column>item_type</column>
|
<column>notification_type_id</column>
|
||||||
<column>user_id</column>
|
<column>user_id</column>
|
||||||
<column>item_id</column>
|
<column>item_id</column>
|
||||||
<column>item_parent_id</column>
|
<column>item_parent_id</column>
|
||||||
<column>notification_read</column>
|
<column>notification_read</column>
|
||||||
<column>notification_data</column>
|
<column>notification_data</column>
|
||||||
<row>
|
<row>
|
||||||
<value>quote</value>
|
<value>1</value>
|
||||||
<value>5</value>
|
<value>5</value>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
|
@ -17,9 +17,11 @@
|
||||||
</row>
|
</row>
|
||||||
</table>
|
</table>
|
||||||
<table name="phpbb_notification_types">
|
<table name="phpbb_notification_types">
|
||||||
<column>notification_type</column>
|
<column>notification_type_id</column>
|
||||||
|
<column>notification_type_name</column>
|
||||||
<column>notification_type_enabled</column>
|
<column>notification_type_enabled</column>
|
||||||
<row>
|
<row>
|
||||||
|
<value>1</value>
|
||||||
<value>quote</value>
|
<value>quote</value>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
</row>
|
</row>
|
||||||
|
|
|
@ -52,9 +52,6 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
|
||||||
$this->db = $this->new_dbal();
|
$this->db = $this->new_dbal();
|
||||||
$db = $this->db;
|
$db = $this->db;
|
||||||
|
|
||||||
// Cache
|
|
||||||
$cache = new phpbb_mock_cache();
|
|
||||||
|
|
||||||
// Auth
|
// Auth
|
||||||
$auth = $this->getMock('phpbb_auth');
|
$auth = $this->getMock('phpbb_auth');
|
||||||
$auth->expects($this->any())
|
$auth->expects($this->any())
|
||||||
|
@ -72,6 +69,14 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
|
||||||
set_config(null, null, null, $config);
|
set_config(null, null, null, $config);
|
||||||
set_config_count(null, null, null, $config);
|
set_config_count(null, null, null, $config);
|
||||||
|
|
||||||
|
$cache = new phpbb_cache_service(
|
||||||
|
new phpbb_cache_driver_null(),
|
||||||
|
$config,
|
||||||
|
$db,
|
||||||
|
$phpbb_root_path,
|
||||||
|
$phpEx
|
||||||
|
);
|
||||||
|
|
||||||
// Event dispatcher
|
// Event dispatcher
|
||||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||||
|
|
||||||
|
@ -94,23 +99,28 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
|
||||||
|
|
||||||
$user_loader = new phpbb_user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE);
|
$user_loader = new phpbb_user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE);
|
||||||
|
|
||||||
// Notification Manager
|
|
||||||
$phpbb_notifications = new phpbb_notification_manager(array(), array(),
|
|
||||||
$phpbb_container, $user_loader, $db, $user,
|
|
||||||
$phpbb_root_path, $phpEx,
|
|
||||||
NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE);
|
|
||||||
$phpbb_container->set('notification_manager', $phpbb_notifications);
|
|
||||||
|
|
||||||
// Notification Types
|
// Notification Types
|
||||||
$notification_types = array('quote', 'bookmark', 'post', 'post_in_queue');
|
$notification_types = array('quote', 'bookmark', 'post', 'post_in_queue', 'topic', 'approve_topic', 'approve_post');
|
||||||
|
$notification_types_array = array();
|
||||||
foreach ($notification_types as $type)
|
foreach ($notification_types as $type)
|
||||||
{
|
{
|
||||||
$class_name = 'phpbb_notification_type_' . $type;
|
$class_name = 'phpbb_notification_type_' . $type;
|
||||||
$phpbb_container->set('notification.type.' . $type, new $class_name(
|
$class = new $class_name(
|
||||||
$user_loader, $db, $cache, $user, $auth, $config,
|
$user_loader, $db, $cache, $user, $auth, $config,
|
||||||
$phpbb_root_path, $phpEx,
|
$phpbb_root_path, $phpEx,
|
||||||
NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE));
|
NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE);
|
||||||
|
|
||||||
|
$phpbb_container->set('notification.type.' . $type, $class);
|
||||||
|
|
||||||
|
$notification_types_array['notification.type.' . $type] = $class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notification Manager
|
||||||
|
$phpbb_notifications = new phpbb_notification_manager($notification_types_array, array(),
|
||||||
|
$phpbb_container, $user_loader, $db, $cache, $user,
|
||||||
|
$phpbb_root_path, $phpEx,
|
||||||
|
NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE);
|
||||||
|
$phpbb_container->set('notification_manager', $phpbb_notifications);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -119,7 +129,7 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
|
||||||
public function test_submit_post($additional_post_data, $expected_before, $expected_after)
|
public function test_submit_post($additional_post_data, $expected_before, $expected_after)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT user_id, item_id, item_parent_id
|
$sql = 'SELECT user_id, item_id, item_parent_id
|
||||||
FROM ' . NOTIFICATIONS_TABLE . ' n, ' . NOTIFICATIONS_TYPES_TABLE . " nt
|
FROM ' . NOTIFICATIONS_TABLE . ' n, ' . NOTIFICATION_TYPES_TABLE . " nt
|
||||||
WHERE nt.notification_type_name = '" . $this->item_type . "'
|
WHERE nt.notification_type_name = '" . $this->item_type . "'
|
||||||
AND n.notification_type_id = nt.notification_type_id
|
AND n.notification_type_id = nt.notification_type_id
|
||||||
ORDER BY user_id, item_id ASC";
|
ORDER BY user_id, item_id ASC";
|
||||||
|
@ -132,7 +142,7 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
|
||||||
submit_post('reply', '', 'poster-name', POST_NORMAL, $poll_data, $post_data, false, false);
|
submit_post('reply', '', 'poster-name', POST_NORMAL, $poll_data, $post_data, false, false);
|
||||||
|
|
||||||
$sql = 'SELECT user_id, item_id, item_parent_id
|
$sql = 'SELECT user_id, item_id, item_parent_id
|
||||||
FROM ' . NOTIFICATIONS_TABLE . ' n, ' . NOTIFICATIONS_TYPES_TABLE . " nt
|
FROM ' . NOTIFICATIONS_TABLE . ' n, ' . NOTIFICATION_TYPES_TABLE . " nt
|
||||||
WHERE nt.notification_type_name = '" . $this->item_type . "'
|
WHERE nt.notification_type_name = '" . $this->item_type . "'
|
||||||
AND n.notification_type_id = nt.notification_type_id
|
AND n.notification_type_id = nt.notification_type_id
|
||||||
ORDER BY user_id ASC, item_id ASC";
|
ORDER BY user_id ASC, item_id ASC";
|
||||||
|
|
Loading…
Add table
Reference in a new issue