public function BlockUiTest::testBlockValidateErrors in Drupal 10
Same name and namespace in other branches
- 8 core/modules/block/tests/src/Functional/BlockUiTest.php \Drupal\Tests\block\Functional\BlockUiTest::testBlockValidateErrors()
- 9 core/modules/block/tests/src/Functional/BlockUiTest.php \Drupal\Tests\block\Functional\BlockUiTest::testBlockValidateErrors()
Tests if validation errors are passed plugin form to the parent form.
File
- core/
modules/ block/ tests/ src/ Functional/ BlockUiTest.php, line 358
Class
- BlockUiTest
- Tests that the block configuration UI exists and stores data correctly.
Namespace
Drupal\Tests\block\FunctionalCode
public function testBlockValidateErrors() {
$this
->drupalGet('admin/structure/block/add/test_settings_validation/stark');
$this
->submitForm([
'region' => 'content',
'settings[digits]' => 'abc',
], 'Save block');
$this
->assertSession()
->statusMessageContains('Only digits are allowed', 'error');
$error_class_pattern = '//div[contains(@class,"form-item-settings-digits")]/input[contains(@class,"error")]';
$error_class = $this
->xpath($error_class_pattern);
$this
->assertNotEmpty($error_class, 'Plugin error class found in parent form.');
}