You are here

public function RecipientGatewayEventTest::testGetGateways in SMS Framework 8

Same name and namespace in other branches
  1. 2.x tests/src/Unit/Event/RecipientGatewayEventTest.php \Drupal\Tests\sms\Unit\Event\RecipientGatewayEventTest::testGetGateways()
  2. 2.1.x tests/src/Unit/Event/RecipientGatewayEventTest.php \Drupal\Tests\sms\Unit\Event\RecipientGatewayEventTest::testGetGateways()

Tests gateway add and getter.

@covers ::addGateway @covers ::getGateways

File

tests/src/Unit/Event/RecipientGatewayEventTest.php, line 80

Class

RecipientGatewayEventTest
Unit Tests for SmsMessage.

Namespace

Drupal\Tests\sms\Unit\Event

Code

public function testGetGateways() {
  $event = $this
    ->createEvent($this
    ->randomPhoneNumbers()[0]);
  $gateway = $this
    ->getMock(SmsGatewayInterface::class);
  $gateway
    ->expects($this
    ->any())
    ->method('id')
    ->willReturn('gateway_1');
  $event
    ->addGateway($gateway, 200);
  $gateway = $this
    ->getMock(SmsGatewayInterface::class);
  $gateway
    ->expects($this
    ->any())
    ->method('id')
    ->willReturn('gateway_2');
  $event
    ->addGateway($gateway, 400);
  $gateways = $event
    ->getGateways();
  $this
    ->assertEquals('gateway_1', $gateways[0][0]
    ->id());
  $this
    ->assertEquals(200, $gateways[0][1]);
  $this
    ->assertEquals('gateway_2', $gateways[1][0]
    ->id());
  $this
    ->assertEquals(400, $gateways[1][1]);
}