From: Thiemo Kreuz Date: Fri, 15 Mar 2019 09:10:33 +0000 (+0100) Subject: Fix ChangeTagsTest failing on Postgres X-Git-Tag: 1.34.0-rc.0~2512^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=15111ac4c5cb1047e73159813d7c36f4739abd48 Fix ChangeTagsTest failing on Postgres The order of elements returned by the SELECT is not guaranteed. But the assertEquals() can't know this. It does not know how to identify the two objects, other than by their array index. Using assertArrayEquals() would fix this. But I honestly don't like this helper method. It is expensive, for example. So I went for an ORDER BY. An example for this failure can be seen here: https://integration.wikimedia.org/ci/job/mediawiki-quibble-vendor-postgres-php70-docker/2484/console Change-Id: I284d13d21b9bc34270307e78430180d94fc6665e --- diff --git a/tests/phpunit/includes/changetags/ChangeTagsTest.php b/tests/phpunit/includes/changetags/ChangeTagsTest.php index 0e209d533d..1405680b6f 100644 --- a/tests/phpunit/includes/changetags/ChangeTagsTest.php +++ b/tests/phpunit/includes/changetags/ChangeTagsTest.php @@ -592,7 +592,13 @@ class ChangeTagsTest extends MediaWikiTestCase { 'ctd_user_defined' => 1 ], ]; - $res = $dbr->select( 'change_tag_def', [ 'ctd_name', 'ctd_user_defined' ], '' ); + $res = $dbr->select( + 'change_tag_def', + [ 'ctd_name', 'ctd_user_defined' ], + '', + __METHOD__, + [ 'ORDER BY' => 'ctd_name' ] + ); $this->assertEquals( $expected, iterator_to_array( $res, false ) ); } }