SmsFrameworkSettingsTest.php in SMS Framework 2.1.x
File
tests/src/Functional/SmsFrameworkSettingsTest.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\sms\Functional;
use Drupal\Core\Url;
class SmsFrameworkSettingsTest extends SmsFrameworkBrowserTestBase {
protected function setUp() {
parent::setUp();
$account = $this
->drupalCreateUser([
'administer smsframework',
]);
$this
->drupalLogin($account);
}
public function testSettingsForm() {
$edit['fallback_gateway'] = '';
$edit['pages[verify]'] = '/' . $this
->randomMachineName();
$this
->drupalPostForm(Url::fromRoute('sms.settings'), $edit, 'Save configuration');
$this
->assertRaw(t('SMS settings saved.'));
}
public function testGatewaySet() {
$gateway = $this
->createMemoryGateway();
$edit['fallback_gateway'] = $gateway
->id();
$edit['pages[verify]'] = '/' . $this
->randomMachineName();
$this
->drupalPostForm(Url::fromRoute('sms.settings'), $edit, 'Save configuration');
$this
->assertRaw(t('SMS settings saved.'));
}
public function testVerificationPathInvalid() {
$edit['pages[verify]'] = $this
->randomMachineName() . '/' . $this
->randomMachineName();
$this
->drupalPostForm(Url::fromRoute('sms.settings'), $edit, 'Save configuration');
$this
->assertRaw(t("Path must begin with a '/' character."));
}
}