You are here

public function SmsDevelMessageTest::testSendNoSkipQueue in SMS Framework 8

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

Tests sending functionality entering queue.

File

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

Class

SmsDevelMessageTest
Tests the message form.

Namespace

Drupal\Tests\sms_devel\Functional

Code

public function testSendNoSkipQueue() {
  $edit['number'] = $this
    ->randomPhoneNumbers(1)[0];
  $edit['message'] = $this
    ->randomString();
  $edit['skip_queue'] = FALSE;
  $this
    ->drupalPostForm(Url::fromRoute('sms_devel.message'), $edit, t('Send'));
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->responseContains('Message added to the outgoing queue.');
  $messages = SmsMessage::loadMultiple();
  $message = reset($messages);
  $this
    ->assertEquals($edit['message'], $message
    ->getMessage(), 'Message is same');
  $this
    ->assertEquals(Direction::OUTGOING, $message
    ->getDirection(), 'Message is outgoing');
}