protected function HelperTrait::submitForm in Style Switcher 3.0.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/HelperTrait.php \Drupal\Tests\styleswitcher\Functional\HelperTrait::submitForm()
Fills and submits a form and checks for exceptions.
@todo Remove this method once the https://www.drupal.org/i/3137242 mystery is solved.
See also
\Drupal\Tests\UiHelperTrait::submitForm()
8 calls to HelperTrait::submitForm()
- BlockTest::testBlockExists in tests/
src/ Functional/ BlockTest.php - Tests that the Style Switcher block exists and functions as a normal block.
- FormTest::testAddStyleExistingName in tests/
src/ Functional/ FormTest.php - Tests a validation error when trying to add a style with existing name.
- FormTest::testConfigThemeForm in tests/
src/ Functional/ FormTest.php - Tests the config theme form exists and functions properly.
- FormTest::testCustomStyleOps in tests/
src/ Functional/ FormTest.php - Tests add/edit and delete operations with a custom style.
- FormTest::testEditStyleExistingName in tests/
src/ Functional/ FormTest.php - Tests a validation error on setting a style other existing name.
File
- tests/
src/ Functional/ HelperTrait.php, line 38
Class
- HelperTrait
- Provides helper methods for the Style Switcher testing.
Namespace
Drupal\Tests\styleswitcher\FunctionalCode
protected function submitForm(array $edit, $submit, $form_html_id = NULL) {
parent::submitForm($edit, $submit, $form_html_id);
$out = $this
->getSession()
->getPage()
->getContent();
if (strpos($out, 'The website encountered an unexpected error') !== FALSE) {
$out = preg_replace('/<\\/?br\\s*\\/?>|<pre class="backtrace">/i', PHP_EOL, $out);
$out = trim(htmlspecialchars_decode(strip_tags($out), ENT_QUOTES));
throw new \Exception($out);
}
}