function ManageFieldsTest::manageFieldsPage

Tests the manage fields page.

Parameters

string $type: (optional) The name of a content type.

2 calls to ManageFieldsTest::manageFieldsPage()
ManageFieldsTest::testCRUDFields in drupal/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php
Runs the field CRUD tests.
ManageFieldsTest::testRenameBundle in drupal/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php
Tests renaming a bundle.

File

drupal/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php, line 83
Contains \Drupal\field_ui\Tests\ManageFieldsTest.

Class

ManageFieldsTest
Tests the functionality of the 'Manage fields' screen.

Namespace

Drupal\field_ui\Tests

Code

function manageFieldsPage($type = '') {
  $type = empty($type) ? $this->type : $type;
  $this
    ->drupalGet('admin/structure/types/manage/' . $type . '/fields');

  // Check all table columns.
  $table_headers = array(
    t('Label'),
    t('Machine name'),
    t('Field type'),
    t('Widget'),
    t('Operations'),
  );
  foreach ($table_headers as $table_header) {

    // We check that the label appear in the table headings.
    $this
      ->assertRaw($table_header . '</th>', format_string('%table_header table header was found.', array(
      '%table_header' => $table_header,
    )));
  }

  // "Add new field" and "Re-use existing field" aren't a table heading so just
  // test the text.
  foreach (array(
    'Add new field',
    'Re-use existing field',
  ) as $element) {
    $this
      ->assertText($element, format_string('"@element" was found.', array(
      '@element' => $element,
    )));
  }
}