aboutsummaryrefslogtreecommitdiffstats
path: root/tests/notification/notification_test.php
diff options
context:
space:
mode:
authorNathaniel Guse <nathaniel.guse@gmail.com>2013-04-30 21:10:04 -0500
committerNathaniel Guse <nathaniel.guse@gmail.com>2013-04-30 21:10:04 -0500
commitf2e618a05de5f406477363cb9236aca46569afe1 (patch)
treecf1463d56e61054cd150ee472cae95a2c41f2421 /tests/notification/notification_test.php
parent81b2ad158c272cd306ea35a9b44875a5c11e7135 (diff)
downloadforums-f2e618a05de5f406477363cb9236aca46569afe1.tar
forums-f2e618a05de5f406477363cb9236aca46569afe1.tar.gz
forums-f2e618a05de5f406477363cb9236aca46569afe1.tar.bz2
forums-f2e618a05de5f406477363cb9236aca46569afe1.tar.xz
forums-f2e618a05de5f406477363cb9236aca46569afe1.zip
[ticket/11413] Test get_notification_type_id and _ids functions
PHPBB3-11413
Diffstat (limited to 'tests/notification/notification_test.php')
-rw-r--r--tests/notification/notification_test.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/notification/notification_test.php b/tests/notification/notification_test.php
index 5746d0090e..4ffd3587f1 100644
--- a/tests/notification/notification_test.php
+++ b/tests/notification/notification_test.php
@@ -99,6 +99,35 @@ class phpbb_notification_test extends phpbb_database_test_case
return new $type($this->user_loader, $this->db, $this->cache, $this->user, $this->auth, $this->config, $phpbb_root_path, $phpEx, 'phpbb_notification_types', 'phpbb_notifications', 'phpbb_user_notifications');
}
+ public function test_get_notification_type_id()
+ {
+ // They should be inserted the first time
+ $this->assertEquals(1, $this->notifications->get_notification_type_id('post'));
+ $this->assertEquals(2, $this->notifications->get_notification_type_id('quote'));
+ $this->assertEquals(3, $this->notifications->get_notification_type_id('test'));
+
+ $this->assertEquals(array(
+ 'test' => 3,
+ 'quote' => 2,
+ 'post' => 1,
+ ),
+ $this->notifications->get_notification_type_ids(array(
+ 'test',
+ 'quote',
+ 'post',
+ )
+ ));
+ $this->assertEquals(2, $this->notifications->get_notification_type_id('quote'));
+
+ try
+ {
+ $this->assertEquals(3, $this->notifications->get_notification_type_id('fail'));
+
+ $this->fail('Non-existant type should throw exception');
+ }
+ catch (Exception $e) {}
+ }
+
public function test_get_subscription_types()
{
$subscription_types = $this->notifications->get_subscription_types();