You are here

protected function LinkFieldTest::assertValidEntries 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::assertValidEntries()

Asserts that valid URLs can be submitted.

Parameters

string $field_name: The field name.

array $valid_entries: An array of valid URL entries.

1 call to LinkFieldTest::assertValidEntries()
LinkFieldTest::testURLValidation in core/modules/link/src/Tests/LinkFieldTest.php
Tests link field URL validation.

File

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

Class

LinkFieldTest
Tests link field widgets and formatters.

Namespace

Drupal\link\Tests

Code

protected function assertValidEntries($field_name, array $valid_entries) {
  foreach ($valid_entries as $uri => $string) {
    $edit = array(
      "{$field_name}[0][uri]" => $uri,
    );
    $this
      ->drupalPostForm('entity_test/add', $edit, t('Save'));
    preg_match('|entity_test/manage/(\\d+)|', $this->url, $match);
    $id = $match[1];
    $this
      ->assertText(t('entity_test @id has been created.', array(
      '@id' => $id,
    )));
    $this
      ->assertRaw($string);
  }
}