From #2643408: Implement a more intelligent SMS Gateway selection mechanism for SMS Framework #53

There's a bug in this hunk

public function getGatewaysSorted() {
  $gateways = $this->gateways;
  uasort($gateways, function($a, $b) {
    list(, $priority_a) = $a;
    list(, $priority_b) = $b;
    if ($priority_a == $priority_b) {
      return 0;
    }
    return ($priority_a > $priority_b) ? -1 : 1;
  });

  $gateways = [];
  foreach ($gateways as $tuple) {
    list($gateway, ) = $tuple;
    $gateways[] = $gateway;
  }

  return $gateways;
}
Where $gateways = [] is initialized then iterated over. It also means we need tests for that class.

Comments

dpi created an issue. See original summary.

dpi’s picture

Status: Active » Needs review
StatusFileSize
new6.9 KB
dpi’s picture

StatusFileSize
new12.38 KB

Add ID detect to createMemoryGateway so the id passed to settings is correct.
Added test coverage to make sure the gateway event is invoked.

  • dpi committed c397ba5 on 8.x-1.x
    Issue #2787259 by dpi: RecipientGatewayEvent::getGatewaysSorted does not...
dpi’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.