You are here

public function SmsDevelMessageTest::testNoFallbackGateway in SMS Framework 2.1.x

Same name and namespace in other branches
  1. 8 modules/sms_devel/tests/src/Functional/SmsDevelMessageTest.php \Drupal\Tests\sms_devel\Functional\SmsDevelMessageTest::testNoFallbackGateway()
  2. 2.x modules/sms_devel/tests/src/Functional/SmsDevelMessageTest.php \Drupal\Tests\sms_devel\Functional\SmsDevelMessageTest::testNoFallbackGateway()

Tests error shown if gateway found for message.

File

modules/sms_devel/tests/src/Functional/SmsDevelMessageTest.php, line 168

Class

SmsDevelMessageTest
Tests the message form.

Namespace

Drupal\Tests\sms_devel\Functional

Code

public function testNoFallbackGateway() {
  $this
    ->setFallbackGateway(NULL);
  $edit['number'] = $this
    ->randomPhoneNumbers(1)[0];
  $edit['message'] = $this
    ->randomString();
  $edit['skip_queue'] = TRUE;
  $this
    ->drupalPostForm(Url::fromRoute('sms_devel.message'), $edit, t('Send'));
  $this
    ->assertSession()
    ->responseContains('Message could not be sent');
  $messages = $this
    ->getTestMessages($this->gateway);
  $this
    ->assertEquals(0, count($messages), 'No messages sent.');
}