CiviMailUtils::assertRecipients - Fix sorting of recipients
authorTim Otten <totten@civicrm.org>
Tue, 12 May 2015 04:07:35 +0000 (21:07 -0700)
committerTim Otten <totten@civicrm.org>
Mon, 15 Jun 2015 17:34:03 +0000 (10:34 -0700)
tests/phpunit/CiviTest/CiviMailUtils.php

index e1450bd3d959410d2287f81e1861632fc88566f0..ff9767786eaec96d2fdc673529aa760bd38f6965 100644 (file)
@@ -289,8 +289,14 @@ class CiviMailUtils extends PHPUnit_Framework_TestCase {
     foreach ($this->getAllMessages('ezc') as $message) {
       $recipients[] = CRM_Utils_Array::collect('email', $message->to);
     }
-    sort($recipients);
-    sort($expectedRecipients);
+    $cmp = function($a, $b) {
+      if ($a[0] == $b[0]) {
+        return 0;
+      }
+      return ($a[0] < $b[0]) ? 1 : -1;
+    };
+    usort($recipients, $cmp);
+    usort($expectedRecipients, $cmp);
     $this->_ut->assertEquals(
       $expectedRecipients,
       $recipients,