You are here

public function GroupTypeFormTest::testCustomGroupTitleFieldLabel in Group 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Functional/GroupTypeFormTest.php \Drupal\Tests\group\Functional\GroupTypeFormTest::testCustomGroupTitleFieldLabel()

Tests that a group type has option to change the title field label.

File

tests/src/Functional/GroupTypeFormTest.php, line 42

Class

GroupTypeFormTest
Tests the behavior of the group type form.

Namespace

Drupal\Tests\group\Functional

Code

public function testCustomGroupTitleFieldLabel() {
  $this
    ->drupalGet('/admin/group/types/add');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $submit_button = 'Save group type';
  $this
    ->assertSession()
    ->buttonExists($submit_button);
  $group_type_id = 'my_first_group_type';
  $title_field_label = 'Title for foo';
  $edit = [
    'Name' => 'My first group type',
    'id' => $group_type_id,
    'Title field label' => $title_field_label,
  ];
  $this
    ->submitForm($edit, $submit_button);
  $fields = $this->entityFieldManager
    ->getFieldDefinitions('group', $group_type_id);
  $this
    ->assertEquals($title_field_label, $fields['label']
    ->getLabel());
}