mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
[ticket/11744] Fix tests for postgresql
PHPBB3-11744
This commit is contained in:
parent
7dd16f4148
commit
49c6e83560
3 changed files with 31 additions and 50 deletions
|
@ -94,15 +94,10 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->notifications->set_var('notification_types', $types);
|
$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_notification_types');
|
||||||
$this->db->sql_query('DELETE FROM phpbb_notifications');
|
$this->db->sql_query('DELETE FROM phpbb_notifications');
|
||||||
$this->db->sql_query('DELETE FROM phpbb_user_notifications');
|
$this->db->sql_query('DELETE FROM phpbb_user_notifications');
|
||||||
|
|
||||||
parent::tearDown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function build_type($type)
|
protected function build_type($type)
|
||||||
|
|
|
@ -65,7 +65,7 @@ class phpbb_notification_group_request_test extends phpbb_tests_notification_bas
|
||||||
));
|
));
|
||||||
|
|
||||||
$expected = array(
|
$expected = array(
|
||||||
1 => array(
|
array(
|
||||||
'item_id' => 3, // user_id of requesting join
|
'item_id' => 3, // user_id of requesting join
|
||||||
'item_parent_id' => $group_id,
|
'item_parent_id' => $group_id,
|
||||||
'user_id' => 2,
|
'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']);
|
$this->assertEquals(sizeof($expected), $notifications['unread_count']);
|
||||||
|
|
||||||
$notifications = $notifications['notifications'];
|
$i = 0;
|
||||||
|
foreach ($notifications['notifications'] as $notification)
|
||||||
foreach ($expected as $notification_id => $notification_data)
|
|
||||||
{
|
{
|
||||||
$this->assertEquals($notification_id, $notifications[$notification_id]->notification_id, 'notification_id');
|
foreach ($expected[$i] as $notification_data)
|
||||||
|
|
||||||
foreach ($notification_data as $key => $value)
|
|
||||||
{
|
{
|
||||||
$this->assertEquals($value, $notifications[$notification_id]->$key, $key . ' ' . $notification_id);
|
$this->assertEquals($value, $notification->$key, $key . ' ' . $i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,8 +165,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
|
||||||
));
|
));
|
||||||
|
|
||||||
$expected = array(
|
$expected = array(
|
||||||
1 => array(
|
array(
|
||||||
'notification_type_id' => 4,
|
|
||||||
'item_id' => 1,
|
'item_id' => 1,
|
||||||
'item_parent_id' => 1,
|
'item_parent_id' => 1,
|
||||||
'user_id' => 0,
|
'user_id' => 0,
|
||||||
|
@ -174,8 +173,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
|
||||||
'notification_time' => 1349413321,
|
'notification_time' => 1349413321,
|
||||||
'notification_data' => array(),
|
'notification_data' => array(),
|
||||||
),
|
),
|
||||||
2 => array(
|
array(
|
||||||
'notification_type_id' => 4,
|
|
||||||
'item_id' => 2,
|
'item_id' => 2,
|
||||||
'item_parent_id' => 2,
|
'item_parent_id' => 2,
|
||||||
'user_id' => 0,
|
'user_id' => 0,
|
||||||
|
@ -183,8 +181,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
|
||||||
'notification_time' => 1349413322,
|
'notification_time' => 1349413322,
|
||||||
'notification_data' => array(),
|
'notification_data' => array(),
|
||||||
),
|
),
|
||||||
3 => array(
|
array(
|
||||||
'notification_type_id' => 4,
|
|
||||||
'item_id' => 3,
|
'item_id' => 3,
|
||||||
'item_parent_id' => 2,
|
'item_parent_id' => 2,
|
||||||
'user_id' => 0,
|
'user_id' => 0,
|
||||||
|
@ -192,8 +189,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
|
||||||
'notification_time' => 1349413323,
|
'notification_time' => 1349413323,
|
||||||
'notification_data' => array(),
|
'notification_data' => array(),
|
||||||
),
|
),
|
||||||
4 => array(
|
array(
|
||||||
'notification_type_id' => 3,
|
|
||||||
'item_id' => 4,
|
'item_id' => 4,
|
||||||
'item_parent_id' => 2,
|
'item_parent_id' => 2,
|
||||||
'user_id' => 0,
|
'user_id' => 0,
|
||||||
|
@ -208,8 +204,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
|
||||||
'forum_name' => 'Your first forum',
|
'forum_name' => 'Your first forum',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
5 => array(
|
array(
|
||||||
'notification_type_id' => 2,
|
|
||||||
'item_id' => 5,
|
'item_id' => 5,
|
||||||
'item_parent_id' => 2,
|
'item_parent_id' => 2,
|
||||||
'user_id' => 0,
|
'user_id' => 0,
|
||||||
|
@ -228,18 +223,15 @@ class phpbb_notification_test extends phpbb_tests_notification_base
|
||||||
|
|
||||||
$this->assertEquals(sizeof($expected), $notifications['unread_count']);
|
$this->assertEquals(sizeof($expected), $notifications['unread_count']);
|
||||||
|
|
||||||
$notifications = $notifications['notifications'];
|
$i = 0;
|
||||||
|
foreach ($notifications['notifications'] as $notification)
|
||||||
foreach ($expected as $notification_id => $notification_data)
|
|
||||||
{
|
{
|
||||||
//echo $notifications[$notification_id];
|
foreach ($expected[$i] as $notification_data)
|
||||||
|
|
||||||
$this->assertEquals($notification_id, $notifications[$notification_id]->notification_id, 'notification_id');
|
|
||||||
|
|
||||||
foreach ($notification_data as $key => $value)
|
|
||||||
{
|
{
|
||||||
$this->assertEquals($value, $notifications[$notification_id]->$key, $key . ' ' . $notification_id);
|
$this->assertEquals($value, $notification->$key, $key . ' ' . $i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now test updating -------------------------------
|
// Now test updating -------------------------------
|
||||||
|
@ -271,8 +263,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
|
||||||
));
|
));
|
||||||
|
|
||||||
$expected = array(
|
$expected = array(
|
||||||
1 => array(
|
array(
|
||||||
'notification_type_id' => 4,
|
|
||||||
'item_id' => 1,
|
'item_id' => 1,
|
||||||
'item_parent_id' => 2,
|
'item_parent_id' => 2,
|
||||||
'user_id' => 0,
|
'user_id' => 0,
|
||||||
|
@ -280,8 +271,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
|
||||||
'notification_time' => 1349413321,
|
'notification_time' => 1349413321,
|
||||||
'notification_data' => array(),
|
'notification_data' => array(),
|
||||||
),
|
),
|
||||||
2 => array(
|
array(
|
||||||
'notification_type_id' => 4,
|
|
||||||
'item_id' => 2,
|
'item_id' => 2,
|
||||||
'item_parent_id' => 2,
|
'item_parent_id' => 2,
|
||||||
'user_id' => 0,
|
'user_id' => 0,
|
||||||
|
@ -289,7 +279,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
|
||||||
'notification_time' => 1349413322,
|
'notification_time' => 1349413322,
|
||||||
'notification_data' => array(),
|
'notification_data' => array(),
|
||||||
),
|
),
|
||||||
3 => array(
|
array(
|
||||||
'notification_type_id' => 4,
|
'notification_type_id' => 4,
|
||||||
'item_id' => 3,
|
'item_id' => 3,
|
||||||
'item_parent_id' => 2,
|
'item_parent_id' => 2,
|
||||||
|
@ -298,8 +288,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
|
||||||
'notification_time' => 1234,
|
'notification_time' => 1234,
|
||||||
'notification_data' => array(),
|
'notification_data' => array(),
|
||||||
),
|
),
|
||||||
4 => array(
|
array(
|
||||||
'notification_type_id' => 3,
|
|
||||||
'item_id' => 4,
|
'item_id' => 4,
|
||||||
'item_parent_id' => 2,
|
'item_parent_id' => 2,
|
||||||
'user_id' => 0,
|
'user_id' => 0,
|
||||||
|
@ -314,8 +303,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
|
||||||
'forum_name' => 'Your first forum',
|
'forum_name' => 'Your first forum',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
5 => array(
|
array(
|
||||||
'notification_type_id' => 2,
|
|
||||||
'item_id' => 5,
|
'item_id' => 5,
|
||||||
'item_parent_id' => 2,
|
'item_parent_id' => 2,
|
||||||
'user_id' => 0,
|
'user_id' => 0,
|
||||||
|
@ -334,18 +322,16 @@ class phpbb_notification_test extends phpbb_tests_notification_base
|
||||||
|
|
||||||
$this->assertEquals(sizeof($expected), $notifications['unread_count']);
|
$this->assertEquals(sizeof($expected), $notifications['unread_count']);
|
||||||
|
|
||||||
$notifications = $notifications['notifications'];
|
$i = 0;
|
||||||
|
foreach ($notifications['notifications'] as $notification)
|
||||||
foreach ($expected as $notification_id => $notification_data)
|
|
||||||
{
|
{
|
||||||
//echo $notifications[$notification_id];
|
foreach ($expected[$i] as $notification_data)
|
||||||
|
|
||||||
$this->assertEquals($notification_id, $notifications[$notification_id]->notification_id, 'notification_id');
|
|
||||||
|
|
||||||
foreach ($notification_data as $key => $value)
|
|
||||||
{
|
{
|
||||||
$this->assertEquals($value, $notifications[$notification_id]->$key, $key . ' ' . $notification_id);
|
$this->assertEquals($value, $notification->$key, $key . ' ' . $i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue