function ManageFieldsTest::manageFieldsPage in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/field_ui/src/Tests/ManageFieldsTest.php \Drupal\field_ui\Tests\ManageFieldsTest::manageFieldsPage()
Tests the manage fields page.
Parameters
string $type: (optional) The name of a content type.
1 call to ManageFieldsTest::manageFieldsPage()
- ManageFieldsTest::testCRUDFields in core/
modules/ field_ui/ src/ Tests/ ManageFieldsTest.php - Runs the field CRUD tests.
File
- core/
modules/ field_ui/ src/ Tests/ ManageFieldsTest.php, line 136 - Contains \Drupal\field_ui\Tests\ManageFieldsTest.
Class
- ManageFieldsTest
- Tests the Field UI "Manage fields" screen.
Namespace
Drupal\field_ui\TestsCode
function manageFieldsPage($type = '') {
$type = empty($type) ? $this->contentType : $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('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,
)));
}
// Test the "Add field" action link.
$this
->assertLink('Add field');
// Assert entity operations for all fields.
$number_of_links = 3;
$number_of_links_found = 0;
$operation_links = $this
->xpath('//ul[@class = "dropbutton"]/li/a');
$url = base_path() . "admin/structure/types/manage/{$type}/fields/node.{$type}.body";
foreach ($operation_links as $link) {
switch ($link['title']) {
case 'Edit field settings.':
$this
->assertIdentical($url, (string) $link['href']);
$number_of_links_found++;
break;
case 'Edit storage settings.':
$this
->assertIdentical("{$url}/storage", (string) $link['href']);
$number_of_links_found++;
break;
case 'Delete field.':
$this
->assertIdentical("{$url}/delete", (string) $link['href']);
$number_of_links_found++;
break;
}
}
$this
->assertEqual($number_of_links, $number_of_links_found);
}