Loading tests/src/Fuctional/WhatsappFormTest.php 0 → 100644 +68 −0 Original line number Diff line number Diff line <?php namespace Drupal\Tests\whatsapp\Functional; namespace Drupal\onlyone\Utility; use Drupal\Tests\BrowserTestBase; /** * WhatsApp functional test. * * @group whatsapp */ class WhatsappFormTest extends BrowserTestBase { /** * {@inheritdoc} */ protected static $modules = ['whatsapp', 'whatsapp_test', 'key', 'user']; /** * {@inheritdoc} */ protected $defaultTheme = 'stable'; /** * {@inheritdoc} */ protected function setUp(): void { parent::setUp(); $this->adminUser = $this->drupalCreateUser(['whatsapp configuration form', 'administer keys', ]); $this->drupalLogin($this->adminUser); } /** * Tests the config form. */ public function testSettingsForm() { // Add a key with a 4 characters. $this->drupalGet('admin/config/system/keys/add'); $testingKey = [ 'id' => 'testing_key', 'label' => 'Testing Key', 'key_type' => 'authentication', 'key_input_settings[key_value]' => str_pad('', 4, 'z'), ]; $this->submitForm($testingKey, 'Save'); $assert_session = $this->assertSession(); $edit = [ 'id' => 'testing_key', ]; $this->drupalGet('admin/config/services/whatsapp'); $this->submitForm($edit, 'Save configuration'); $assert_session->statusCodeEquals(200); $assert_session->pageTextNotContains('No keys are available.'); } } Loading
tests/src/Fuctional/WhatsappFormTest.php 0 → 100644 +68 −0 Original line number Diff line number Diff line <?php namespace Drupal\Tests\whatsapp\Functional; namespace Drupal\onlyone\Utility; use Drupal\Tests\BrowserTestBase; /** * WhatsApp functional test. * * @group whatsapp */ class WhatsappFormTest extends BrowserTestBase { /** * {@inheritdoc} */ protected static $modules = ['whatsapp', 'whatsapp_test', 'key', 'user']; /** * {@inheritdoc} */ protected $defaultTheme = 'stable'; /** * {@inheritdoc} */ protected function setUp(): void { parent::setUp(); $this->adminUser = $this->drupalCreateUser(['whatsapp configuration form', 'administer keys', ]); $this->drupalLogin($this->adminUser); } /** * Tests the config form. */ public function testSettingsForm() { // Add a key with a 4 characters. $this->drupalGet('admin/config/system/keys/add'); $testingKey = [ 'id' => 'testing_key', 'label' => 'Testing Key', 'key_type' => 'authentication', 'key_input_settings[key_value]' => str_pad('', 4, 'z'), ]; $this->submitForm($testingKey, 'Save'); $assert_session = $this->assertSession(); $edit = [ 'id' => 'testing_key', ]; $this->drupalGet('admin/config/services/whatsapp'); $this->submitForm($edit, 'Save configuration'); $assert_session->statusCodeEquals(200); $assert_session->pageTextNotContains('No keys are available.'); } }