aboutsummaryrefslogtreecommitdiffstats
path: root/tests/notification
diff options
context:
space:
mode:
authorNathaniel Guse <nathaniel.guse@gmail.com>2013-07-26 17:27:52 -0500
committerNathaniel Guse <nathaniel.guse@gmail.com>2013-07-26 17:27:52 -0500
commit49c6e835605a6f36c050cda2e92646941668e415 (patch)
tree480d25dd76f369eee76ed7ca1eec6f46a6b43674 /tests/notification
parent7dd16f4148890a2c1f52eeb9c660afe2fb85d23c (diff)
downloadforums-49c6e835605a6f36c050cda2e92646941668e415.tar
forums-49c6e835605a6f36c050cda2e92646941668e415.tar.gz
forums-49c6e835605a6f36c050cda2e92646941668e415.tar.bz2
forums-49c6e835605a6f36c050cda2e92646941668e415.tar.xz
forums-49c6e835605a6f36c050cda2e92646941668e415.zip
[ticket/11744] Fix tests for postgresql
PHPBB3-11744
Diffstat (limited to 'tests/notification')
-rw-r--r--tests/notification/base.php5
-rw-r--r--tests/notification/group_request_test.php16
-rw-r--r--tests/notification/notification_test.php60
3 files changed, 31 insertions, 50 deletions
diff --git a/tests/notification/base.php b/tests/notification/base.php
index 3560ac6fcd..f8c39934bb 100644
--- a/tests/notification/base.php
+++ b/tests/notification/base.php
@@ -94,15 +94,10 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
}
$this->notifications->set_var('notification_types', $types);
- }
- protected function tearDown()
- {
$this->db->sql_query('DELETE FROM phpbb_notification_types');
$this->db->sql_query('DELETE FROM phpbb_notifications');
$this->db->sql_query('DELETE FROM phpbb_user_notifications');
-
- parent::tearDown();
}
protected function build_type($type)
diff --git a/tests/notification/group_request_test.php b/tests/notification/group_request_test.php
index d36864cc27..d61c4adf38 100644
--- a/tests/notification/group_request_test.php
+++ b/tests/notification/group_request_test.php
@@ -65,7 +65,7 @@ class phpbb_notification_group_request_test extends phpbb_tests_notification_bas
));
$expected = array(
- 1 => array(
+ array(
'item_id' => 3, // user_id of requesting join
'item_parent_id' => $group_id,
'user_id' => 2,
@@ -78,16 +78,16 @@ class phpbb_notification_group_request_test extends phpbb_tests_notification_bas
$this->assertEquals(sizeof($expected), $notifications['unread_count']);
- $notifications = $notifications['notifications'];
-
- foreach ($expected as $notification_id => $notification_data)
+ $i = 0;
+ foreach ($notifications['notifications'] as $notification)
{
- $this->assertEquals($notification_id, $notifications[$notification_id]->notification_id, 'notification_id');
-
- foreach ($notification_data as $key => $value)
+ foreach ($expected[$i] as $notification_data)
{
- $this->assertEquals($value, $notifications[$notification_id]->$key, $key . ' ' . $notification_id);
+ $this->assertEquals($value, $notification->$key, $key . ' ' . $i);
}
+
+ $i++;
}
+
}
}
diff --git a/tests/notification/notification_test.php b/tests/notification/notification_test.php
index 94453fe201..b8dc9a9042 100644
--- a/tests/notification/notification_test.php
+++ b/tests/notification/notification_test.php
@@ -165,8 +165,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
));
$expected = array(
- 1 => array(
- 'notification_type_id' => 4,
+ array(
'item_id' => 1,
'item_parent_id' => 1,
'user_id' => 0,
@@ -174,8 +173,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
'notification_time' => 1349413321,
'notification_data' => array(),
),
- 2 => array(
- 'notification_type_id' => 4,
+ array(
'item_id' => 2,
'item_parent_id' => 2,
'user_id' => 0,
@@ -183,8 +181,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
'notification_time' => 1349413322,
'notification_data' => array(),
),
- 3 => array(
- 'notification_type_id' => 4,
+ array(
'item_id' => 3,
'item_parent_id' => 2,
'user_id' => 0,
@@ -192,8 +189,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
'notification_time' => 1349413323,
'notification_data' => array(),
),
- 4 => array(
- 'notification_type_id' => 3,
+ array(
'item_id' => 4,
'item_parent_id' => 2,
'user_id' => 0,
@@ -208,8 +204,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
'forum_name' => 'Your first forum',
),
),
- 5 => array(
- 'notification_type_id' => 2,
+ array(
'item_id' => 5,
'item_parent_id' => 2,
'user_id' => 0,
@@ -228,18 +223,15 @@ class phpbb_notification_test extends phpbb_tests_notification_base
$this->assertEquals(sizeof($expected), $notifications['unread_count']);
- $notifications = $notifications['notifications'];
-
- foreach ($expected as $notification_id => $notification_data)
+ $i = 0;
+ foreach ($notifications['notifications'] as $notification)
{
- //echo $notifications[$notification_id];
-
- $this->assertEquals($notification_id, $notifications[$notification_id]->notification_id, 'notification_id');
-
- foreach ($notification_data as $key => $value)
+ foreach ($expected[$i] as $notification_data)
{
- $this->assertEquals($value, $notifications[$notification_id]->$key, $key . ' ' . $notification_id);
+ $this->assertEquals($value, $notification->$key, $key . ' ' . $i);
}
+
+ $i++;
}
// Now test updating -------------------------------
@@ -271,8 +263,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
));
$expected = array(
- 1 => array(
- 'notification_type_id' => 4,
+ array(
'item_id' => 1,
'item_parent_id' => 2,
'user_id' => 0,
@@ -280,8 +271,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
'notification_time' => 1349413321,
'notification_data' => array(),
),
- 2 => array(
- 'notification_type_id' => 4,
+ array(
'item_id' => 2,
'item_parent_id' => 2,
'user_id' => 0,
@@ -289,7 +279,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
'notification_time' => 1349413322,
'notification_data' => array(),
),
- 3 => array(
+ array(
'notification_type_id' => 4,
'item_id' => 3,
'item_parent_id' => 2,
@@ -298,8 +288,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
'notification_time' => 1234,
'notification_data' => array(),
),
- 4 => array(
- 'notification_type_id' => 3,
+ array(
'item_id' => 4,
'item_parent_id' => 2,
'user_id' => 0,
@@ -314,8 +303,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
'forum_name' => 'Your first forum',
),
),
- 5 => array(
- 'notification_type_id' => 2,
+ array(
'item_id' => 5,
'item_parent_id' => 2,
'user_id' => 0,
@@ -334,18 +322,16 @@ class phpbb_notification_test extends phpbb_tests_notification_base
$this->assertEquals(sizeof($expected), $notifications['unread_count']);
- $notifications = $notifications['notifications'];
-
- foreach ($expected as $notification_id => $notification_data)
+ $i = 0;
+ foreach ($notifications['notifications'] as $notification)
{
- //echo $notifications[$notification_id];
-
- $this->assertEquals($notification_id, $notifications[$notification_id]->notification_id, 'notification_id');
-
- foreach ($notification_data as $key => $value)
+ foreach ($expected[$i] as $notification_data)
{
- $this->assertEquals($value, $notifications[$notification_id]->$key, $key . ' ' . $notification_id);
+ $this->assertEquals($value, $notification->$key, $key . ' ' . $i);
}
+
+ $i++;
}
+
}
}