protected function LinkFieldTest::assertInvalidEntries in Drupal 9
Same name and namespace in other branches
- 8 core/modules/link/tests/src/Functional/LinkFieldTest.php \Drupal\Tests\link\Functional\LinkFieldTest::assertInvalidEntries()
Asserts that invalid URLs cannot be submitted.
Parameters
string $field_name: The field name.
array $invalid_entries: An array of invalid URL entries.
1 call to LinkFieldTest::assertInvalidEntries()
- LinkFieldTest::testURLValidation in core/
modules/ link/ tests/ src/ Functional/ LinkFieldTest.php - Tests link field URL validation.
File
- core/
modules/ link/ tests/ src/ Functional/ LinkFieldTest.php, line 237
Class
- LinkFieldTest
- Tests link field widgets and formatters.
Namespace
Drupal\Tests\link\FunctionalCode
protected function assertInvalidEntries($field_name, array $invalid_entries) {
foreach ($invalid_entries as $invalid_value => $error_message) {
$edit = [
"{$field_name}[0][uri]" => $invalid_value,
];
$this
->drupalGet('entity_test/add');
$this
->submitForm($edit, 'Save');
$this
->assertSession()
->responseContains(strtr($error_message, [
'@link_path' => $invalid_value,
]));
}
}