[ticket/9687] Fix tests on postgres

PHPBB3-9687
This commit is contained in:
Marc Alexander 2023-07-31 18:48:09 +02:00
parent a0bd70885d
commit 66cb07d2f4
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
3 changed files with 9 additions and 2 deletions

View file

@ -115,7 +115,7 @@ abstract class base implements type_interface
WHERE (ban_end >= ' . time() . "
OR ban_end = 0)
AND ban_mode = '{$this->get_type()}'
ORDER BY ban_item ASC, ban_id ASC";
ORDER BY ban_item";
$result = $this->db->sql_query($sql);
$rowset = $this->db->sql_fetchrowset($result);
$this->db->sql_freeresult($result);

View file

@ -80,7 +80,7 @@ class user extends base
OR b.ban_end = 0)
AND b.ban_userid = u.user_id
AND b.ban_mode = '{$this->get_type()}'
ORDER BY username_clean ASC";
ORDER BY u.username_clean ASC";
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{

View file

@ -276,6 +276,13 @@ class ban_manager_test extends \phpbb_session_test_case
{
$this->expectException($expected_exception);
}
// Fix weird sorting by postgres
if (is_array($expected) && $ban_type == 'email' && $this->db->get_sql_layer() == 'postgres')
{
$expected = array_reverse($expected);
}
$this->assertEquals($expected, $this->ban_manager->get_bans($ban_type));
}