From fa782affa53739dfef2e2d7ccc36e13c07e64a68 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Tue, 15 Jun 2021 12:50:50 +1000 Subject: [PATCH] [NFC] Fix test failure on MySQL8 because of lack of order in API --- tests/phpunit/api/v3/ContactTest.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); } /** -- 2.25.1