LinkFieldUITest.php 1.44 KB
Newer Older
1
2
3
4
5
6
7
8
9
<?php

/**
 * @file
 * Contains Drupal\link\Tests\LinkFieldUITest.
 */

namespace Drupal\link\Tests;

10
use Drupal\Component\Utility\Unicode;
11
use Drupal\field_ui\Tests\FieldUiTestTrait;
12
13
14
15
use Drupal\simpletest\WebTestBase;

/**
 * Tests link field UI functionality.
16
17
 *
 * @group link
18
19
20
 */
class LinkFieldUITest extends WebTestBase {

21
22
  use FieldUiTestTrait;

23
24
25
26
27
28
29
  /**
   * Modules to enable.
   *
   * @var array
   */
  public static $modules = array('node', 'link', 'field_ui');

30
  protected function setUp() {
31
32
    parent::setUp();

33
    $this->web_user = $this->drupalCreateUser(array('administer content types', 'administer node fields', 'administer node display'));
34
35
36
37
38
39
40
41
42
43
44
45
    $this->drupalLogin($this->web_user);
  }

  /**
   * Tests that link field UI functionality does not generate warnings.
   */
  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.
46
    $label = $this->randomMachineName();
47
    $field_name = Unicode::strtolower($label);
48
    $this->fieldUIAddNewField($type_path, $field_name, $label, 'link');
49
50
51
52
53
54
55
56
57

    // 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)));
  }

}