aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--phpBB/install/schemas/schema_data.sql8
-rw-r--r--tests/functional/notification_test.php16
-rw-r--r--tests/notification/base.php35
-rw-r--r--tests/notification/fixtures/submit_post_notification.type.bookmark.xml (renamed from tests/notification/fixtures/submit_post_bookmark.xml)12
-rw-r--r--tests/notification/fixtures/submit_post_notification.type.post.xml (renamed from tests/notification/fixtures/submit_post_post.xml)16
-rw-r--r--tests/notification/fixtures/submit_post_notification.type.post_in_queue.xml (renamed from tests/notification/fixtures/submit_post_post_in_queue.xml)16
-rw-r--r--tests/notification/fixtures/submit_post_notification.type.quote.xml (renamed from tests/notification/fixtures/submit_post_quote.xml)12
-rw-r--r--tests/notification/fixtures/submit_post_notification.type.topic.xml (renamed from tests/notification/fixtures/submit_post_topic.xml)10
-rw-r--r--tests/notification/group_request_test.php4
-rw-r--r--tests/notification/manager_helper.php3
-rw-r--r--tests/notification/notification_test.php50
-rw-r--r--tests/notification/submit_post_type_bookmark_test.php2
-rw-r--r--tests/notification/submit_post_type_post_in_queue_test.php2
-rw-r--r--tests/notification/submit_post_type_post_test.php2
-rw-r--r--tests/notification/submit_post_type_quote_test.php2
-rw-r--r--tests/notification/submit_post_type_topic_test.php2
16 files changed, 97 insertions, 95 deletions
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index 37e1c8de50..90b1ac8f92 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -813,9 +813,9 @@ INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_len
INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_googleplus', 'profilefields.type.googleplus', 'phpbb_googleplus', '20', '3', '255', '', '', '[\w]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 13, 1, 'VIEW_GOOGLEPLUS_PROFILE', 'http://plus.google.com/%s');
# User Notification Options (for first user)
-INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('post', 0, 2, '');
-INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('post', 0, 2, 'email');
-INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('topic', 0, 2, '');
-INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('topic', 0, 2, 'email');
+INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.post', 0, 2, '');
+INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.post', 0, 2, 'notification.method.email');
+INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.topic', 0, 2, '');
+INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.topic', 0, 2, 'notification.method.email');
# POSTGRES COMMIT #
diff --git a/tests/functional/notification_test.php b/tests/functional/notification_test.php
index e4a960f862..667d268b1e 100644
--- a/tests/functional/notification_test.php
+++ b/tests/functional/notification_test.php
@@ -21,20 +21,20 @@ class phpbb_functional_notification_test extends phpbb_functional_test_case
return array(
// Rows inserted by phpBB/install/schemas/schema_data.sql
// Also see PHPBB3-11460
- array('post_notification', true),
- array('topic_notification', true),
- array('post_email', true),
- array('topic_email', true),
+ array('notification.type.post_notification', true),
+ array('notification.type.topic_notification', true),
+ array('notification.type.post_notification.method.email', true),
+ array('notification.type.topic_notification.method.email', true),
// Default behaviour for in-board notifications:
// If user did not opt-out, in-board notifications are on.
- array('bookmark_notification', true),
- array('quote_notification', true),
+ array('notification.type.bookmark_notification', true),
+ array('notification.type.quote_notification', true),
// Default behaviour for email notifications:
// If user did not opt-in, email notifications are off.
- array('bookmark_email', false),
- array('quote_email', false),
+ array('notification.type.bookmark_notification.method.email', false),
+ array('notification.type.quote_notification.method.email', false),
);
}
diff --git a/tests/notification/base.php b/tests/notification/base.php
index bfa9d2a1a4..c97b7c24e2 100644
--- a/tests/notification/base.php
+++ b/tests/notification/base.php
@@ -21,21 +21,21 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
{
return array(
'test',
- 'approve_post',
- 'approve_topic',
- 'bookmark',
- 'disapprove_post',
- 'disapprove_topic',
- 'pm',
- 'post',
- 'post_in_queue',
- 'quote',
- 'report_pm',
- 'report_pm_closed',
- 'report_post',
- 'report_post_closed',
- 'topic',
- 'topic_in_queue',
+ 'notification.type.approve_post',
+ 'notification.type.approve_topic',
+ 'notification.type.bookmark',
+ 'notification.type.disapprove_post',
+ 'notification.type.disapprove_topic',
+ 'notification.type.pm',
+ 'notification.type.post',
+ 'notification.type.post_in_queue',
+ 'notification.type.quote',
+ 'notification.type.report_pm',
+ 'notification.type.report_pm_closed',
+ 'notification.type.report_post',
+ 'notification.type.report_post_closed',
+ 'notification.type.topic',
+ 'notification.type.topic_in_queue',
);
}
@@ -92,10 +92,11 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
$types = array();
foreach ($this->get_notification_types() as $type)
{
- $class = $this->build_type('phpbb\notification\type\\' . $type);
+ $type_parts = explode('.', $type);
+ $class = $this->build_type('phpbb\notification\type\\' . array_pop($type_parts));
$types[$type] = $class;
- $this->container->set('notification.type.' . $type, $class);
+ $this->container->set($type, $class);
}
$this->notifications->set_var('notification_types', $types);
diff --git a/tests/notification/fixtures/submit_post_bookmark.xml b/tests/notification/fixtures/submit_post_notification.type.bookmark.xml
index 525d0484e0..a1413e2cf8 100644
--- a/tests/notification/fixtures/submit_post_bookmark.xml
+++ b/tests/notification/fixtures/submit_post_notification.type.bookmark.xml
@@ -50,7 +50,7 @@
<column>notification_type_enabled</column>
<row>
<value>1</value>
- <value>bookmark</value>
+ <value>notification.type.bookmark</value>
<value>1</value>
</row>
</table>
@@ -123,35 +123,35 @@
<column>method</column>
<column>notify</column>
<row>
- <value>bookmark</value>
+ <value>notification.type.bookmark</value>
<value>0</value>
<value>2</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>bookmark</value>
+ <value>notification.type.bookmark</value>
<value>0</value>
<value>3</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>bookmark</value>
+ <value>notification.type.bookmark</value>
<value>0</value>
<value>4</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>bookmark</value>
+ <value>notification.type.bookmark</value>
<value>0</value>
<value>5</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>bookmark</value>
+ <value>notification.type.bookmark</value>
<value>0</value>
<value>6</value>
<value></value>
diff --git a/tests/notification/fixtures/submit_post_post.xml b/tests/notification/fixtures/submit_post_notification.type.post.xml
index a38ca77ea0..ed75787c70 100644
--- a/tests/notification/fixtures/submit_post_post.xml
+++ b/tests/notification/fixtures/submit_post_notification.type.post.xml
@@ -50,7 +50,7 @@
<column>notification_type_enabled</column>
<row>
<value>1</value>
- <value>post</value>
+ <value>notification.type.post</value>
<value>1</value>
</row>
</table>
@@ -153,49 +153,49 @@
<column>method</column>
<column>notify</column>
<row>
- <value>post</value>
+ <value>notification.type.post</value>
<value>0</value>
<value>2</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>post</value>
+ <value>notification.type.post</value>
<value>0</value>
<value>3</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>post</value>
+ <value>notification.type.post</value>
<value>0</value>
<value>4</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>post</value>
+ <value>notification.type.post</value>
<value>0</value>
<value>5</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>post</value>
+ <value>notification.type.post</value>
<value>0</value>
<value>6</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>post</value>
+ <value>notification.type.post</value>
<value>0</value>
<value>7</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>post</value>
+ <value>notification.type.post</value>
<value>0</value>
<value>8</value>
<value></value>
diff --git a/tests/notification/fixtures/submit_post_post_in_queue.xml b/tests/notification/fixtures/submit_post_notification.type.post_in_queue.xml
index 28cb69be36..2dea8e34dd 100644
--- a/tests/notification/fixtures/submit_post_post_in_queue.xml
+++ b/tests/notification/fixtures/submit_post_notification.type.post_in_queue.xml
@@ -22,7 +22,7 @@
<column>notification_type_enabled</column>
<row>
<value>1</value>
- <value>post_in_queue</value>
+ <value>notification.type.post_in_queue</value>
<value>1</value>
</row>
</table>
@@ -107,49 +107,49 @@
<column>method</column>
<column>notify</column>
<row>
- <value>needs_approval</value>
+ <value>notification.type.needs_approval</value>
<value>0</value>
<value>2</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>needs_approval</value>
+ <value>notification.type.needs_approval</value>
<value>0</value>
<value>3</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>needs_approval</value>
+ <value>notification.type.needs_approval</value>
<value>0</value>
<value>4</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>needs_approval</value>
+ <value>notification.type.needs_approval</value>
<value>0</value>
<value>5</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>needs_approval</value>
+ <value>notification.type.needs_approval</value>
<value>0</value>
<value>6</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>needs_approval</value>
+ <value>notification.type.needs_approval</value>
<value>0</value>
<value>7</value>
<value></value>
<value>0</value>
</row>
<row>
- <value>needs_approval</value>
+ <value>notification.type.needs_approval</value>
<value>0</value>
<value>9</value>
<value></value>
diff --git a/tests/notification/fixtures/submit_post_quote.xml b/tests/notification/fixtures/submit_post_notification.type.quote.xml
index 2b11992e54..dd5bc620cd 100644
--- a/tests/notification/fixtures/submit_post_quote.xml
+++ b/tests/notification/fixtures/submit_post_notification.type.quote.xml
@@ -22,7 +22,7 @@
<column>notification_type_enabled</column>
<row>
<value>1</value>
- <value>quote</value>
+ <value>notification.type.quote</value>
<value>1</value>
</row>
</table>
@@ -95,35 +95,35 @@
<column>method</column>
<column>notify</column>
<row>
- <value>quote</value>
+ <value>notification.type.quote</value>
<value>0</value>
<value>2</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>quote</value>
+ <value>notification.type.quote</value>
<value>0</value>
<value>3</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>quote</value>
+ <value>notification.type.quote</value>
<value>0</value>
<value>4</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>quote</value>
+ <value>notification.type.quote</value>
<value>0</value>
<value>5</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>quote</value>
+ <value>notification.type.quote</value>
<value>0</value>
<value>6</value>
<value></value>
diff --git a/tests/notification/fixtures/submit_post_topic.xml b/tests/notification/fixtures/submit_post_notification.type.topic.xml
index 5e179d9b99..1ba8d05699 100644
--- a/tests/notification/fixtures/submit_post_topic.xml
+++ b/tests/notification/fixtures/submit_post_notification.type.topic.xml
@@ -42,7 +42,7 @@
<column>notification_type_enabled</column>
<row>
<value>1</value>
- <value>topic</value>
+ <value>notification.type.topic</value>
<value>1</value>
</row>
</table>
@@ -103,28 +103,28 @@
<column>method</column>
<column>notify</column>
<row>
- <value>topic</value>
+ <value>notification.type.topic</value>
<value>0</value>
<value>2</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>topic</value>
+ <value>notification.type.topic</value>
<value>0</value>
<value>6</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>topic</value>
+ <value>notification.type.topic</value>
<value>0</value>
<value>7</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>topic</value>
+ <value>notification.type.topic</value>
<value>0</value>
<value>8</value>
<value></value>
diff --git a/tests/notification/group_request_test.php b/tests/notification/group_request_test.php
index 14ed4ff62c..afbc586601 100644
--- a/tests/notification/group_request_test.php
+++ b/tests/notification/group_request_test.php
@@ -25,8 +25,8 @@ class phpbb_notification_group_request_test extends phpbb_tests_notification_bas
return array_merge(
parent::get_notification_types(),
array(
- 'group_request',
- 'group_request_approved',
+ 'notification.type.group_request',
+ 'notification.type.group_request_approved',
)
);
}
diff --git a/tests/notification/manager_helper.php b/tests/notification/manager_helper.php
index 24030f5775..75b7275d3a 100644
--- a/tests/notification/manager_helper.php
+++ b/tests/notification/manager_helper.php
@@ -43,7 +43,8 @@ class phpbb_notification_manager_helper extends \phpbb\notification\manager
*/
public function get_item_type_class($item_type, $data = array())
{
- $item_type = 'phpbb\notification\type\\' . $item_type;
+ $item_parts = explode('.', $item_type);
+ $item_type = 'phpbb\notification\type\\' . array_pop($item_parts);
$item = new $item_type($this->user_loader, $this->db, $this->cache->get_driver(), $this->user, $this->auth, $this->config, $this->phpbb_root_path, $this->php_ext, $this->notification_types_table, $this->notifications_table, $this->user_notifications_table);
diff --git a/tests/notification/notification_test.php b/tests/notification/notification_test.php
index 27ea8ddb44..79fa5338c4 100644
--- a/tests/notification/notification_test.php
+++ b/tests/notification/notification_test.php
@@ -25,22 +25,22 @@ class phpbb_notification_test extends phpbb_tests_notification_base
public function test_get_notification_type_id()
{
// They should be inserted the first time
- $post_type_id = $this->notifications->get_notification_type_id('post');
- $quote_type_id = $this->notifications->get_notification_type_id('quote');
+ $post_type_id = $this->notifications->get_notification_type_id('notification.type.post');
+ $quote_type_id = $this->notifications->get_notification_type_id('notification.type.quote');
$test_type_id = $this->notifications->get_notification_type_id('test');
$this->assertEquals(array(
'test' => $test_type_id,
- 'quote' => $quote_type_id,
- 'post' => $post_type_id,
+ 'notification.type.quote' => $quote_type_id,
+ 'notification.type.post' => $post_type_id,
),
$this->notifications->get_notification_type_ids(array(
'test',
- 'quote',
- 'post',
+ 'notification.type.quote',
+ 'notification.type.post',
)
));
- $this->assertEquals($quote_type_id, $this->notifications->get_notification_type_id('quote'));
+ $this->assertEquals($quote_type_id, $this->notifications->get_notification_type_id('notification.type.quote'));
try
{
@@ -58,12 +58,12 @@ class phpbb_notification_test extends phpbb_tests_notification_base
$this->assertArrayHasKey('NOTIFICATION_GROUP_MISCELLANEOUS', $subscription_types);
$this->assertArrayHasKey('NOTIFICATION_GROUP_POSTING', $subscription_types);
- $this->assertArrayHasKey('bookmark', $subscription_types['NOTIFICATION_GROUP_POSTING']);
- $this->assertArrayHasKey('post', $subscription_types['NOTIFICATION_GROUP_POSTING']);
- $this->assertArrayHasKey('quote', $subscription_types['NOTIFICATION_GROUP_POSTING']);
- $this->assertArrayHasKey('topic', $subscription_types['NOTIFICATION_GROUP_POSTING']);
+ $this->assertArrayHasKey('notification.type.bookmark', $subscription_types['NOTIFICATION_GROUP_POSTING']);
+ $this->assertArrayHasKey('notification.type.post', $subscription_types['NOTIFICATION_GROUP_POSTING']);
+ $this->assertArrayHasKey('notification.type.quote', $subscription_types['NOTIFICATION_GROUP_POSTING']);
+ $this->assertArrayHasKey('notification.type.topic', $subscription_types['NOTIFICATION_GROUP_POSTING']);
- $this->assertArrayHasKey('pm', $subscription_types['NOTIFICATION_GROUP_MISCELLANEOUS']);
+ $this->assertArrayHasKey('notification.type.pm', $subscription_types['NOTIFICATION_GROUP_MISCELLANEOUS']);
//get_subscription_types
//get_subscription_methods
@@ -72,12 +72,12 @@ class phpbb_notification_test extends phpbb_tests_notification_base
public function test_subscriptions()
{
$expected_subscriptions = array(
- 'post' => array(''),
- 'topic' => array(''),
- 'quote' => array(''),
- 'bookmark' => array(''),
+ 'notification.type.post' => array(''),
+ 'notification.type.topic' => array(''),
+ 'notification.type.quote' => array(''),
+ 'notification.type.bookmark' => array(''),
'test' => array(''),
- 'pm' => array(''),
+ 'notification.type.pm' => array(''),
);
$subscriptions = $this->notifications->get_global_subscriptions(2);
@@ -92,20 +92,20 @@ class phpbb_notification_test extends phpbb_tests_notification_base
$this->assert_array_content_equals($methods, $expected_subscriptions[$item_type]);
}
- $this->notifications->delete_subscription('post', 0, '', 2);
+ $this->notifications->delete_subscription('notification.type.post', 0, '', 2);
- $this->assertArrayNotHasKey('post', $this->notifications->get_global_subscriptions(2));
+ $this->assertArrayNotHasKey('notification.type.post', $this->notifications->get_global_subscriptions(2));
- $this->notifications->add_subscription('post', 0, '', 2);
+ $this->notifications->add_subscription('notification.type.post', 0, '', 2);
- $this->assertArrayHasKey('post', $this->notifications->get_global_subscriptions(2));
+ $this->assertArrayHasKey('notification.type.post', $this->notifications->get_global_subscriptions(2));
}
public function test_notifications()
{
$this->db->sql_query('DELETE FROM phpbb_notification_types');
- $types = array('quote', 'bookmark', 'post', 'test');
+ $types = array('notification.type.quote', 'notification.type.bookmark', 'notification.type.post', 'test');
foreach ($types as $id => $type)
{
$this->db->sql_query('INSERT INTO phpbb_notification_types ' .
@@ -150,7 +150,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
'post_time' => 1349413323,
));
- $this->notifications->add_notifications(array('quote', 'bookmark', 'post', 'test'), array(
+ $this->notifications->add_notifications(array('notification.type.quote', 'notification.type.bookmark', 'notification.type.post', 'test'), array(
'post_id' => '4',
'topic_id' => '2',
'post_time' => 1349413324,
@@ -166,7 +166,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
'user_id' => 0,
)));
- $this->notifications->add_notifications(array('quote', 'bookmark', 'post', 'test'), array(
+ $this->notifications->add_notifications(array('notification.type.quote', 'notification.type.bookmark', 'notification.type.post', 'test'), array(
'post_id' => '5',
'topic_id' => '2',
'post_time' => 1349413325,
@@ -258,7 +258,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
'post_time' => 1234, // change time
));
- $this->notifications->update_notifications(array('quote', 'bookmark', 'post', 'test'), array(
+ $this->notifications->update_notifications(array('notification.type.quote', 'notification.type.bookmark', 'notification.type.post', 'test'), array(
'post_id' => '5',
'topic_id' => '2',
'poster_id' => 2,
diff --git a/tests/notification/submit_post_type_bookmark_test.php b/tests/notification/submit_post_type_bookmark_test.php
index 6d7747c2ba..7c3b9f938f 100644
--- a/tests/notification/submit_post_type_bookmark_test.php
+++ b/tests/notification/submit_post_type_bookmark_test.php
@@ -15,7 +15,7 @@ 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';
+ protected $item_type = 'notification.type.bookmark';
public function setUp()
{
diff --git a/tests/notification/submit_post_type_post_in_queue_test.php b/tests/notification/submit_post_type_post_in_queue_test.php
index 6bd9c8c93f..1390e92d96 100644
--- a/tests/notification/submit_post_type_post_in_queue_test.php
+++ b/tests/notification/submit_post_type_post_in_queue_test.php
@@ -15,7 +15,7 @@ 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';
+ protected $item_type = 'notification.type.post_in_queue';
public function setUp()
{
diff --git a/tests/notification/submit_post_type_post_test.php b/tests/notification/submit_post_type_post_test.php
index 5007424690..037c326bc0 100644
--- a/tests/notification/submit_post_type_post_test.php
+++ b/tests/notification/submit_post_type_post_test.php
@@ -15,7 +15,7 @@ require_once dirname(__FILE__) . '/submit_post_base.php';
class phpbb_notification_submit_post_type_post_test extends phpbb_notification_submit_post_base
{
- protected $item_type = 'post';
+ protected $item_type = 'notification.type.post';
public function setUp()
{
diff --git a/tests/notification/submit_post_type_quote_test.php b/tests/notification/submit_post_type_quote_test.php
index 94979fd154..61e3840773 100644
--- a/tests/notification/submit_post_type_quote_test.php
+++ b/tests/notification/submit_post_type_quote_test.php
@@ -15,7 +15,7 @@ require_once dirname(__FILE__) . '/submit_post_base.php';
class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_submit_post_base
{
- protected $item_type = 'quote';
+ protected $item_type = 'notification.type.quote';
public function setUp()
{
diff --git a/tests/notification/submit_post_type_topic_test.php b/tests/notification/submit_post_type_topic_test.php
index 52e9353c7c..c095fbc4ba 100644
--- a/tests/notification/submit_post_type_topic_test.php
+++ b/tests/notification/submit_post_type_topic_test.php
@@ -15,7 +15,7 @@ require_once dirname(__FILE__) . '/submit_post_base.php';
class phpbb_notification_submit_post_type_topic_test extends phpbb_notification_submit_post_base
{
- protected $item_type = 'topic';
+ protected $item_type = 'notification.type.topic';
public function setUp()
{