protected function ComplexWidgetTest::checkExistingValidationExpectation in Inline Entity Form 8
Check existing node field validation.
Checks that an invalid value for an existing node will be display the expected error.
Parameters
string $existing_node_text: The text to enter into the existing node text field.
string $expected_error: The error message that is expected to be shown.
1 call to ComplexWidgetTest::checkExistingValidationExpectation()
- ComplexWidgetTest::testReferenceExistingValidation in tests/
src/ FunctionalJavascript/ ComplexWidgetTest.php - Test if invalid values get correct validation messages.
File
- tests/
src/ FunctionalJavascript/ ComplexWidgetTest.php, line 824
Class
- ComplexWidgetTest
- IEF complex field widget tests.
Namespace
Drupal\Tests\inline_entity_form\FunctionalJavascriptCode
protected function checkExistingValidationExpectation(string $existing_node_text, string $expected_error) {
$page = $this
->getSession()
->getPage();
$assert_session = $this
->assertSession();
$this
->openMultiExistingForm();
$field = $assert_session
->waitForElement('xpath', $this
->getXpathForAutoCompleteInput());
$field
->setValue($existing_node_text);
$page
->pressButton('Add node');
$this
->assertNotNull($assert_session
->waitForText($expected_error));
$assert_session
->buttonExists('Cancel')
->press();
$this
->assertNotEmpty($assert_session
->waitForElementRemoved('xpath', $this
->getXpathForAutoCompleteInput()));
}