You are here

protected function LinkFieldTest::assertInvalidEntries in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/link/src/Tests/LinkFieldTest.php \Drupal\link\Tests\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/src/Tests/LinkFieldTest.php
Tests link field URL validation.

File

core/modules/link/src/Tests/LinkFieldTest.php, line 205
Contains \Drupal\link\Tests\LinkFieldTest.

Class

LinkFieldTest
Tests link field widgets and formatters.

Namespace

Drupal\link\Tests

Code

protected function assertInvalidEntries($field_name, array $invalid_entries) {
  foreach ($invalid_entries as $invalid_value => $error_message) {
    $edit = array(
      "{$field_name}[0][uri]" => $invalid_value,
    );
    $this
      ->drupalPostForm('entity_test/add', $edit, t('Save'));
    $this
      ->assertText(t($error_message, array(
      '@link_path' => $invalid_value,
    )));
  }
}