function LinkFieldUITest::testFieldUI

Tests that link field UI functionality does not generate warnings.

File

drupal/core/modules/link/lib/Drupal/link/Tests/LinkFieldUITest.php, line 42
Contains Drupal\link\Tests\LinkFieldUITest.

Class

LinkFieldUITest
Tests link field UI functionality.

Namespace

Drupal\link\Tests

Code

function testFieldUI() {

  // Add a content type.
  $type = $this
    ->drupalCreateContentType();
  $type_path = 'admin/structure/types/manage/' . $type->type;

  // Add a link field to the newly-created type.
  $label = $this
    ->randomName();
  $field_name = drupal_strtolower($label);
  $edit = array(
    'fields[_add_new_field][label]' => $label,
    'fields[_add_new_field][field_name]' => $field_name,
    'fields[_add_new_field][type]' => 'link',
    'fields[_add_new_field][widget_type]' => 'link_default',
  );
  $this
    ->drupalPost("{$type_path}/fields", $edit, t('Save'));

  // Proceed to the Edit (field instance settings) page.
  $this
    ->drupalPost(NULL, array(), t('Save field settings'));

  // Proceed to the Manage fields overview page.
  $this
    ->drupalPost(NULL, array(), t('Save settings'));

  // Load the formatter page to check that the settings summary does not
  // generate warnings.
  // @todo Mess with the formatter settings a bit here.
  $this
    ->drupalGet("{$type_path}/display");
  $this
    ->assertText(t('Link text trimmed to @limit characters', array(
    '@limit' => 80,
  )));
}