protected function assertContentTypeGroupsCorrect(array $expectedGroups, array $actualGroups) { $sorter = function ($a, $b) { if ($a->id == $b->id) { return 0; } return $a->id < $b->id ? -1 : 1; }; usort($expectedGroups, $sorter); usort($actualGroups, $sorter); foreach ($expectedGroups as $index => $expectedGroup) { $this->assertContentTypeGroupsEqual(array('expected' => $expectedGroup, 'actual' => $actualGroups[$index])); } }