MDL-49203 webservices: Fix unit tests for avoid random order issues
This problem usually happens in Postgres where a set of records is ordered by a timestamp column and there are two or more records with the same value
This commit is contained in:
@@ -106,6 +106,7 @@ class core_comment_externallib_testcase extends externallib_advanced_testcase {
|
||||
$cmtid1 = $DB->insert_record('comments', $newcmt);
|
||||
|
||||
$newcmt->content = 'New comment 2';
|
||||
$newcmt->timecreated = time() + 1;
|
||||
$cmtid2 = $DB->insert_record('comments', $newcmt);
|
||||
|
||||
$contextlevel = 'module';
|
||||
@@ -126,7 +127,7 @@ class core_comment_externallib_testcase extends externallib_advanced_testcase {
|
||||
$this->assertEquals($user->id, $result['comments'][0]['userid']);
|
||||
$this->assertEquals($user->id, $result['comments'][1]['userid']);
|
||||
|
||||
$this->assertEquals($cmtid1, $result['comments'][0]['id']);
|
||||
$this->assertEquals($cmtid2, $result['comments'][1]['id']);
|
||||
$this->assertEquals($cmtid2, $result['comments'][0]['id']);
|
||||
$this->assertEquals($cmtid1, $result['comments'][1]['id']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user