mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/9687] Fix text inconsistency between mysql & postgres
PHPBB3-9687
This commit is contained in:
parent
040b277fd9
commit
0f18869702
1 changed files with 14 additions and 5 deletions
|
@ -277,13 +277,22 @@ class ban_manager_test extends \phpbb_session_test_case
|
|||
$this->expectException($expected_exception);
|
||||
}
|
||||
|
||||
// Fix weird sorting by postgres
|
||||
if (strtolower(substr(PHP_OS, 0, 3)) === 'linux' && is_array($expected) && $ban_type == 'email' && $this->db->get_sql_layer() == 'postgres')
|
||||
$actual = $this->ban_manager->get_bans($ban_type);
|
||||
// Sort both arrays by ban_item to be synced
|
||||
if (is_array($expected) && !empty($actual))
|
||||
{
|
||||
$expected = array_reverse($expected);
|
||||
usort($expected, function($a, $b)
|
||||
{
|
||||
return strcmp($a['ban_item'], $b['ban_item']) <=> 0;
|
||||
}
|
||||
);
|
||||
usort($actual, function($a, $b)
|
||||
{
|
||||
return strcmp($a['ban_item'], $b['ban_item']) <=> 0;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
$this->assertEquals($expected, $this->ban_manager->get_bans($ban_type));
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
public function data_get_ban_end(): array
|
||||
|
|
Loading…
Add table
Reference in a new issue