You are here

public function SmsFrameworkGatewayAdminTest::testGatewayList 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::testGatewayList()
  2. 2.x tests/src/Functional/SmsFrameworkGatewayAdminTest.php \Drupal\Tests\sms\Functional\SmsFrameworkGatewayAdminTest::testGatewayList()

Tests the Gateway list implementation.

File

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

Class

SmsFrameworkGatewayAdminTest
Tests gateway administration user interface.

Namespace

Drupal\Tests\sms\Functional

Code

public function testGatewayList() {
  $this
    ->createMemoryGateway();

  // Test no access for anonymous.
  $this
    ->drupalGet(Url::fromRoute('sms.gateway.list'));
  $this
    ->assertResponse(403);
  $account = $this
    ->drupalCreateUser([
    'administer smsframework',
  ]);
  $this
    ->drupalLogin($account);
  $this
    ->drupalGet(Url::fromRoute('sms.gateway.list'));
  $this
    ->assertResponse(200);
  $this
    ->assertRaw('<td>Drupal log</td>');
  $this
    ->assertRaw('<td>Memory</td>');

  // Delete all gateways.
  $this->smsGatewayStorage
    ->delete($this->smsGatewayStorage
    ->loadMultiple());
  $this
    ->drupalGet(Url::fromRoute('sms.gateway.list'));
  $this
    ->assertRaw(t('No gateways found.'));
}