You are here

public function SmsFrameworkGatewayAdminTest::testFallbackGateway in SMS Framework 2.1.x

Same name and namespace in other branches
  1. 8 tests/src/Functional/SmsFrameworkGatewayAdminTest.php \Drupal\Tests\sms\Functional\SmsFrameworkGatewayAdminTest::testFallbackGateway()
  2. 2.x tests/src/Functional/SmsFrameworkGatewayAdminTest.php \Drupal\Tests\sms\Functional\SmsFrameworkGatewayAdminTest::testFallbackGateway()

Tests setting up the fallback gateway.

File

tests/src/Functional/SmsFrameworkGatewayAdminTest.php, line 67

Class

SmsFrameworkGatewayAdminTest
Tests gateway administration user interface.

Namespace

Drupal\Tests\sms\Functional

Code

public function testFallbackGateway() {
  $test_gateway = $this
    ->createMemoryGateway([
    'skip_queue' => TRUE,
  ]);

  // Test initial fallback gateway.
  $sms_gateway_fallback = SmsGateway::load($this
    ->config('sms.settings')
    ->get('fallback_gateway'));
  $this
    ->assertEqual($sms_gateway_fallback
    ->id(), 'log', 'Initial fallback gateway is "log".');
  $this
    ->drupalLogin($this
    ->drupalCreateUser([
    'administer smsframework',
  ]));

  // Change fallback gateway.
  $this
    ->drupalPostForm(Url::fromRoute('sms.settings'), [
    'fallback_gateway' => $test_gateway
      ->id(),
  ], 'Save configuration');
  $this
    ->assertResponse(200);
  $sms_gateway_fallback = SmsGateway::load($this
    ->config('sms.settings')
    ->get('fallback_gateway'));
  $this
    ->assertEqual($sms_gateway_fallback
    ->id(), $test_gateway
    ->id(), 'Fallback gateway changed.');
}