Loading tests/src/Functional/SharpspringWebformTest.php +7 −7 Original line number Diff line number Diff line Loading @@ -85,7 +85,7 @@ class SharpspringWebformTest extends BrowserTestBase { /** * {@inheritdoc} */ public function setUp() { protected function setUp(): void { parent::setUp(); $this->webUser = $this->createUser(); Loading Loading @@ -127,13 +127,13 @@ class SharpspringWebformTest extends BrowserTestBase { $this->assertSession()->statusCodeEquals(200); // Check if base uri and endpoint are required. $this->drupalPostForm(NULL, ['sharpspring_status' => TRUE], 'Save'); $this->submitForm(['sharpspring_status' => TRUE], 'Save'); $this->assertSession()->pageTextContains('Base URI field is required.'); $this->assertSession()->pageTextContains('Endpoint field is required.'); $this->assertSession()->pageTextNotContains('The configuration options have been saved.'); $this->drupalGet(Url::fromRoute('sharpspring_webforms.configuration', ['webform' => $this->webformId1])); $this->drupalPostForm(NULL, [ $this->submitForm([ 'sharpspring_status' => TRUE, 'sharpspring_base_uri' => 'http://random-url.com', ], 'Save'); Loading @@ -142,7 +142,7 @@ class SharpspringWebformTest extends BrowserTestBase { $this->assertSession()->pageTextNotContains('The configuration options have been saved.'); $this->drupalGet(Url::fromRoute('sharpspring_webforms.configuration', ['webform' => $this->webformId1])); $this->drupalPostForm(NULL, [ $this->submitForm([ 'sharpspring_status' => TRUE, 'sharpspring_endpoint' => 'random-endpoint', ], 'Save'); Loading @@ -152,7 +152,7 @@ class SharpspringWebformTest extends BrowserTestBase { // Check if saving actually saves the configured values. $this->drupalGet(Url::fromRoute('sharpspring_webforms.configuration', ['webform' => $this->webformId1])); $this->drupalPostForm(NULL, [ $this->submitForm([ 'sharpspring_status' => TRUE, 'sharpspring_base_uri' => 'http://random-url.com/', 'sharpspring_endpoint' => 'random-endpoint', Loading @@ -170,7 +170,7 @@ class SharpspringWebformTest extends BrowserTestBase { // Make sure that a trailing slash is added to the base_uri. $this->drupalGet(Url::fromRoute('sharpspring_webforms.configuration', ['webform' => $this->webformId1])); $this->drupalPostForm(NULL, [ $this->submitForm([ 'sharpspring_status' => TRUE, 'sharpspring_base_uri' => 'http://random-url.com', 'sharpspring_endpoint' => 'random-endpoint', Loading @@ -181,7 +181,7 @@ class SharpspringWebformTest extends BrowserTestBase { // Disabling sharpspring removes all third party settings. $this->drupalGet(Url::fromRoute('sharpspring_webforms.configuration', ['webform' => $this->webformId1])); $this->drupalPostForm(NULL, [ $this->submitForm([ 'sharpspring_status' => FALSE, 'sharpspring_base_uri' => '', 'sharpspring_endpoint' => '', Loading tests/src/Functional/SharpspringWebformsHandlerTest.php +14 −9 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ class SharpspringWebformsHandlerTest extends BrowserTestBase { /** * {@inheritdoc} */ public function setUp() { protected function setUp(): void { parent::setUp(); $this->drupalPlaceBlock('local_actions_block'); Loading @@ -81,12 +81,14 @@ class SharpspringWebformsHandlerTest extends BrowserTestBase { // Create FR. ConfigurableLanguage::createFromLangcode('fr')->save(); // Set prefixes to en and fr. $this->drupalPostForm('admin/config/regional/language/detection/url', [ $this->drupalGet('admin/config/regional/language/detection/url'); $this->submitForm([ 'prefix[en]' => 'en', 'prefix[fr]' => 'fr', ], 'Save configuration'); // Set up URL and language selection page methods. $this->drupalPostForm('admin/config/regional/language/detection', [ $this->drupalGet('admin/config/regional/language/detection'); $this->submitForm([ 'language_interface[enabled][language-url]' => 1, ], 'Save settings'); Loading Loading @@ -158,7 +160,7 @@ class SharpspringWebformsHandlerTest extends BrowserTestBase { $this->clickLink('Add handler'); $this->clickLink('SharpSpring Remote Post'); $this->drupalPostForm(NULL, [ $this->submitForm([ 'label' => 'Test sharpspring handler', 'handler_id' => 'test_sharpspring_handler', 'settings[base_uri]' => 'http://example.org', Loading @@ -185,7 +187,7 @@ class SharpspringWebformsHandlerTest extends BrowserTestBase { $this->assertFalse($this->state->get('sharpspring_webforms.test.call_executed', FALSE)); // Submit a webform. $this->drupalPostForm(NULL, [ $this->submitForm([ 'name' => 'Name', 'email' => 'mail@example.org', 'address[address]' => 'address', Loading Loading @@ -233,7 +235,7 @@ class SharpspringWebformsHandlerTest extends BrowserTestBase { $this->assertFalse($this->state->get('sharpspring_webforms.test.call_executed', FALSE)); $this->drupalPostForm(NULL, [ $this->submitForm([ 'name' => 'Name', 'email' => 'mail@example.org', 'address[address]' => 'address', Loading @@ -259,13 +261,15 @@ class SharpspringWebformsHandlerTest extends BrowserTestBase { public function testTranslatedHandler() { /** @var \Drupal\webform\WebformInterface $webform */ $webform = $this->webformStorage->loadUnchanged($this->webformId); $this->drupalPostForm('/admin/structure/webform/manage/' . $this->webformId . '/translate/fr/add', [ $this->drupalGet('admin/structure/webform/manage/' . $this->webformId . '/translate/fr/add'); $this->submitForm([ 'translation[config_names][webform.webform.' . $this->webformId . '][handlers][sharpspring_remote_post][settings][base_uri]' => rtrim($this->baseUrl, '/') . '/sharpspring-webforms-test/handler-translated/', 'translation[config_names][webform.webform.' . $this->webformId . '][handlers][sharpspring_remote_post][settings][endpoint]' => 'random_endpoint_fr', ], 'Save translation'); $this->assertFalse($this->state->get('sharpspring_webforms.test.call_executed', FALSE)); $this->drupalPostForm('en/webform/' . $this->webformId, [ $this->drupalGet('en/webform/' . $this->webformId); $this->submitForm([ 'name' => 'Name', 'email' => 'mail@example.org', 'address[address]' => 'address', Loading Loading @@ -297,7 +301,8 @@ class SharpspringWebformsHandlerTest extends BrowserTestBase { ], $this->state->get('sharpspring_webforms.test.handler_data')); $this->assertFalse($this->state->get('sharpspring_webforms.test.translated_call_executed', FALSE)); $this->drupalPostForm('fr/webform/' . $this->webformId, [ $this->drupalGet('fr/webform/' . $this->webformId); $this->submitForm([ 'name' => 'Name', 'email' => 'mail@example.org', 'address[address]' => 'address', Loading tests/src/Functional/SharpspringWebformsTranslationTest.php +9 −5 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ class SharpspringWebformsTranslationTest extends BrowserTestBase { /** * {@inheritdoc} */ public function setUp() { protected function setUp(): void { parent::setUp(); $admin = $this->drupalCreateUser([], NULL, TRUE); Loading @@ -78,12 +78,14 @@ class SharpspringWebformsTranslationTest extends BrowserTestBase { // Create FR. ConfigurableLanguage::createFromLangcode('fr')->save(); // Set prefixes to en and fr. $this->drupalPostForm('admin/config/regional/language/detection/url', [ $this->drupalGet('admin/config/regional/language/detection/url'); $this->submitForm([ 'prefix[en]' => 'en', 'prefix[fr]' => 'fr', ], 'Save configuration'); // Set up URL and language selection page methods. $this->drupalPostForm('admin/config/regional/language/detection', [ $this->drupalGet('admin/config/regional/language/detection'); $this->submitForm([ 'language_interface[enabled][language-url]' => 1, ], 'Save settings'); Loading @@ -107,12 +109,14 @@ class SharpspringWebformsTranslationTest extends BrowserTestBase { * Tests if the correct translated drupal settings are set. */ public function testTranslatedDrupalSettings() { $this->drupalPostForm(Url::fromRoute('sharpspring_webforms.configuration', ['webform' => $this->webformId]), [ $this->drupalGet(Url::fromRoute('sharpspring_webforms.configuration', ['webform' => $this->webformId])); $this->submitForm([ 'sharpspring_status' => TRUE, 'sharpspring_base_uri' => 'http://random-url.com/', 'sharpspring_endpoint' => 'random-endpoint', ], 'Save'); $this->drupalPostForm('/admin/structure/webform/manage/' . $this->webformId . '/translate/fr/add', [ $this->drupalGet('admin/structure/webform/manage/' . $this->webformId . '/translate/fr/add'); $this->submitForm([ 'translation[config_names][webform.webform.' . $this->webformId . '][third_party_settings][sharpspring_webforms][base_uri]' => 'http://random-url.com/fr', 'translation[config_names][webform.webform.' . $this->webformId . '][third_party_settings][sharpspring_webforms][endpoint]' => 'random-endpoint-fr', ], 'Save translation'); Loading Loading
tests/src/Functional/SharpspringWebformTest.php +7 −7 Original line number Diff line number Diff line Loading @@ -85,7 +85,7 @@ class SharpspringWebformTest extends BrowserTestBase { /** * {@inheritdoc} */ public function setUp() { protected function setUp(): void { parent::setUp(); $this->webUser = $this->createUser(); Loading Loading @@ -127,13 +127,13 @@ class SharpspringWebformTest extends BrowserTestBase { $this->assertSession()->statusCodeEquals(200); // Check if base uri and endpoint are required. $this->drupalPostForm(NULL, ['sharpspring_status' => TRUE], 'Save'); $this->submitForm(['sharpspring_status' => TRUE], 'Save'); $this->assertSession()->pageTextContains('Base URI field is required.'); $this->assertSession()->pageTextContains('Endpoint field is required.'); $this->assertSession()->pageTextNotContains('The configuration options have been saved.'); $this->drupalGet(Url::fromRoute('sharpspring_webforms.configuration', ['webform' => $this->webformId1])); $this->drupalPostForm(NULL, [ $this->submitForm([ 'sharpspring_status' => TRUE, 'sharpspring_base_uri' => 'http://random-url.com', ], 'Save'); Loading @@ -142,7 +142,7 @@ class SharpspringWebformTest extends BrowserTestBase { $this->assertSession()->pageTextNotContains('The configuration options have been saved.'); $this->drupalGet(Url::fromRoute('sharpspring_webforms.configuration', ['webform' => $this->webformId1])); $this->drupalPostForm(NULL, [ $this->submitForm([ 'sharpspring_status' => TRUE, 'sharpspring_endpoint' => 'random-endpoint', ], 'Save'); Loading @@ -152,7 +152,7 @@ class SharpspringWebformTest extends BrowserTestBase { // Check if saving actually saves the configured values. $this->drupalGet(Url::fromRoute('sharpspring_webforms.configuration', ['webform' => $this->webformId1])); $this->drupalPostForm(NULL, [ $this->submitForm([ 'sharpspring_status' => TRUE, 'sharpspring_base_uri' => 'http://random-url.com/', 'sharpspring_endpoint' => 'random-endpoint', Loading @@ -170,7 +170,7 @@ class SharpspringWebformTest extends BrowserTestBase { // Make sure that a trailing slash is added to the base_uri. $this->drupalGet(Url::fromRoute('sharpspring_webforms.configuration', ['webform' => $this->webformId1])); $this->drupalPostForm(NULL, [ $this->submitForm([ 'sharpspring_status' => TRUE, 'sharpspring_base_uri' => 'http://random-url.com', 'sharpspring_endpoint' => 'random-endpoint', Loading @@ -181,7 +181,7 @@ class SharpspringWebformTest extends BrowserTestBase { // Disabling sharpspring removes all third party settings. $this->drupalGet(Url::fromRoute('sharpspring_webforms.configuration', ['webform' => $this->webformId1])); $this->drupalPostForm(NULL, [ $this->submitForm([ 'sharpspring_status' => FALSE, 'sharpspring_base_uri' => '', 'sharpspring_endpoint' => '', Loading
tests/src/Functional/SharpspringWebformsHandlerTest.php +14 −9 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ class SharpspringWebformsHandlerTest extends BrowserTestBase { /** * {@inheritdoc} */ public function setUp() { protected function setUp(): void { parent::setUp(); $this->drupalPlaceBlock('local_actions_block'); Loading @@ -81,12 +81,14 @@ class SharpspringWebformsHandlerTest extends BrowserTestBase { // Create FR. ConfigurableLanguage::createFromLangcode('fr')->save(); // Set prefixes to en and fr. $this->drupalPostForm('admin/config/regional/language/detection/url', [ $this->drupalGet('admin/config/regional/language/detection/url'); $this->submitForm([ 'prefix[en]' => 'en', 'prefix[fr]' => 'fr', ], 'Save configuration'); // Set up URL and language selection page methods. $this->drupalPostForm('admin/config/regional/language/detection', [ $this->drupalGet('admin/config/regional/language/detection'); $this->submitForm([ 'language_interface[enabled][language-url]' => 1, ], 'Save settings'); Loading Loading @@ -158,7 +160,7 @@ class SharpspringWebformsHandlerTest extends BrowserTestBase { $this->clickLink('Add handler'); $this->clickLink('SharpSpring Remote Post'); $this->drupalPostForm(NULL, [ $this->submitForm([ 'label' => 'Test sharpspring handler', 'handler_id' => 'test_sharpspring_handler', 'settings[base_uri]' => 'http://example.org', Loading @@ -185,7 +187,7 @@ class SharpspringWebformsHandlerTest extends BrowserTestBase { $this->assertFalse($this->state->get('sharpspring_webforms.test.call_executed', FALSE)); // Submit a webform. $this->drupalPostForm(NULL, [ $this->submitForm([ 'name' => 'Name', 'email' => 'mail@example.org', 'address[address]' => 'address', Loading Loading @@ -233,7 +235,7 @@ class SharpspringWebformsHandlerTest extends BrowserTestBase { $this->assertFalse($this->state->get('sharpspring_webforms.test.call_executed', FALSE)); $this->drupalPostForm(NULL, [ $this->submitForm([ 'name' => 'Name', 'email' => 'mail@example.org', 'address[address]' => 'address', Loading @@ -259,13 +261,15 @@ class SharpspringWebformsHandlerTest extends BrowserTestBase { public function testTranslatedHandler() { /** @var \Drupal\webform\WebformInterface $webform */ $webform = $this->webformStorage->loadUnchanged($this->webformId); $this->drupalPostForm('/admin/structure/webform/manage/' . $this->webformId . '/translate/fr/add', [ $this->drupalGet('admin/structure/webform/manage/' . $this->webformId . '/translate/fr/add'); $this->submitForm([ 'translation[config_names][webform.webform.' . $this->webformId . '][handlers][sharpspring_remote_post][settings][base_uri]' => rtrim($this->baseUrl, '/') . '/sharpspring-webforms-test/handler-translated/', 'translation[config_names][webform.webform.' . $this->webformId . '][handlers][sharpspring_remote_post][settings][endpoint]' => 'random_endpoint_fr', ], 'Save translation'); $this->assertFalse($this->state->get('sharpspring_webforms.test.call_executed', FALSE)); $this->drupalPostForm('en/webform/' . $this->webformId, [ $this->drupalGet('en/webform/' . $this->webformId); $this->submitForm([ 'name' => 'Name', 'email' => 'mail@example.org', 'address[address]' => 'address', Loading Loading @@ -297,7 +301,8 @@ class SharpspringWebformsHandlerTest extends BrowserTestBase { ], $this->state->get('sharpspring_webforms.test.handler_data')); $this->assertFalse($this->state->get('sharpspring_webforms.test.translated_call_executed', FALSE)); $this->drupalPostForm('fr/webform/' . $this->webformId, [ $this->drupalGet('fr/webform/' . $this->webformId); $this->submitForm([ 'name' => 'Name', 'email' => 'mail@example.org', 'address[address]' => 'address', Loading
tests/src/Functional/SharpspringWebformsTranslationTest.php +9 −5 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ class SharpspringWebformsTranslationTest extends BrowserTestBase { /** * {@inheritdoc} */ public function setUp() { protected function setUp(): void { parent::setUp(); $admin = $this->drupalCreateUser([], NULL, TRUE); Loading @@ -78,12 +78,14 @@ class SharpspringWebformsTranslationTest extends BrowserTestBase { // Create FR. ConfigurableLanguage::createFromLangcode('fr')->save(); // Set prefixes to en and fr. $this->drupalPostForm('admin/config/regional/language/detection/url', [ $this->drupalGet('admin/config/regional/language/detection/url'); $this->submitForm([ 'prefix[en]' => 'en', 'prefix[fr]' => 'fr', ], 'Save configuration'); // Set up URL and language selection page methods. $this->drupalPostForm('admin/config/regional/language/detection', [ $this->drupalGet('admin/config/regional/language/detection'); $this->submitForm([ 'language_interface[enabled][language-url]' => 1, ], 'Save settings'); Loading @@ -107,12 +109,14 @@ class SharpspringWebformsTranslationTest extends BrowserTestBase { * Tests if the correct translated drupal settings are set. */ public function testTranslatedDrupalSettings() { $this->drupalPostForm(Url::fromRoute('sharpspring_webforms.configuration', ['webform' => $this->webformId]), [ $this->drupalGet(Url::fromRoute('sharpspring_webforms.configuration', ['webform' => $this->webformId])); $this->submitForm([ 'sharpspring_status' => TRUE, 'sharpspring_base_uri' => 'http://random-url.com/', 'sharpspring_endpoint' => 'random-endpoint', ], 'Save'); $this->drupalPostForm('/admin/structure/webform/manage/' . $this->webformId . '/translate/fr/add', [ $this->drupalGet('admin/structure/webform/manage/' . $this->webformId . '/translate/fr/add'); $this->submitForm([ 'translation[config_names][webform.webform.' . $this->webformId . '][third_party_settings][sharpspring_webforms][base_uri]' => 'http://random-url.com/fr', 'translation[config_names][webform.webform.' . $this->webformId . '][third_party_settings][sharpspring_webforms][endpoint]' => 'random-endpoint-fr', ], 'Save translation'); Loading