public function SmsFrameworkGatewayAdminTest::testGatewayAdd in SMS Framework 8
Same name and namespace in other branches
- 2.x tests/src/Functional/SmsFrameworkGatewayAdminTest.php \Drupal\Tests\sms\Functional\SmsFrameworkGatewayAdminTest::testGatewayAdd()
- 2.1.x tests/src/Functional/SmsFrameworkGatewayAdminTest.php \Drupal\Tests\sms\Functional\SmsFrameworkGatewayAdminTest::testGatewayAdd()
Test adding a gateway.
File
- tests/
src/ Functional/ SmsFrameworkGatewayAdminTest.php, line 89
Class
- SmsFrameworkGatewayAdminTest
- Tests gateway administration user interface.
Namespace
Drupal\Tests\sms\FunctionalCode
public function testGatewayAdd() {
$account = $this
->drupalCreateUser([
'administer smsframework',
]);
$this
->drupalLogin($account);
$this
->drupalGet(Url::fromRoute('entity.sms_gateway.add'));
$this
->assertResponse(200);
$edit = [
'label' => $this
->randomString(),
'id' => Unicode::strtolower($this
->randomMachineName()),
'status' => TRUE,
'plugin_id' => 'memory',
];
$this
->drupalPostForm(Url::fromRoute('entity.sms_gateway.add'), $edit, t('Save'));
$this
->assertResponse(200);
$this
->assertUrl(Url::fromRoute('entity.sms_gateway.edit_form', [
'sms_gateway' => $edit['id'],
]));
$this
->assertRaw(t('Gateway created.'));
$this
->drupalGet(Url::fromRoute('sms.gateway.list'));
$this
->assertRaw('<td>' . t('@label', [
'@label' => $edit['label'],
]) . '</td>', 'New gateway appears on list.');
}