From: Seamus Lee Date: Tue, 15 Jun 2021 02:50:50 +0000 (+1000) Subject: [NFC] Fix test failure on MySQL8 because of lack of order in API X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=fa782affa53739dfef2e2d7ccc36e13c07e64a68;p=civicrm-core.git [NFC] Fix test failure on MySQL8 because of lack of order in API --- diff --git a/tests/phpunit/api/v3/ContactTest.php b/tests/phpunit/api/v3/ContactTest.php index b7cd5c74c0..e3a56d0bb3 100644 --- a/tests/phpunit/api/v3/ContactTest.php +++ b/tests/phpunit/api/v3/ContactTest.php @@ -305,7 +305,11 @@ class api_v3_ContactTest extends CiviUnitTestCase { // get all students and parents $result = $this->callAPISuccess('Contact', 'get', ['return' => 'id', 'contact_sub_type' => ['IN' => ['Parent', 'Student']]])['values']; - $this->assertEquals([$student['id'], $parent['id']], array_keys($result)); + // check that we retrieved the student and the parent. + // On MySQL 8 this can have different order in the array as there is no specific order set. + $this->assertArrayHasKey($student['id'], $result); + $this->assertArrayHasKey($parent['id'], $result); + $this->assertCount(2, $result); } /**