You are here

public function FormModeManagerUiTest::testFormModeManagerTaxonomyTermOverview in Form mode manager 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/FormModeManagerUiTest.php \Drupal\Tests\form_mode_manager\Functional\FormModeManagerUiTest::testFormModeManagerTaxonomyTermOverview()

Tests Form Mode links provide by module for Term entity.

File

tests/src/Functional/FormModeManagerUiTest.php, line 161

Class

FormModeManagerUiTest
Tests the Form mode manager user interfaces.

Namespace

Drupal\Tests\form_mode_manager\Functional

Code

public function testFormModeManagerTaxonomyTermOverview() {
  $term_form_mode = $this
    ->drupalCreateFormMode('taxonomy_term');
  $this
    ->drupalGet("admin/structure/taxonomy/manage/{$this->vocabulary->id()}/overview/form-display");
  $edit = [
    "display_modes_custom[{$this->formModeManager->getFormModeMachineName($term_form_mode->id())}]" => TRUE,
  ];
  $this
    ->drupalPostForm("admin/structure/taxonomy/manage/{$this->vocabulary->id()}/overview/form-display", $edit, t('Save'));
  Role::load($this->adminUser
    ->getRoles()[1])
    ->grantPermission('administer taxonomy')
    ->grantPermission('use ' . $term_form_mode
    ->id() . ' form mode')
    ->save();
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet("admin/structure/taxonomy/manage/{$this->vocabulary->id()}/overview");
  $this
    ->assertSession()
    ->linkExists("Add term as {$term_form_mode->label()}");

  // Enable this cas whenever issue,
  // https://www.drupal.org/node/2469567 are switch to fixed.

  /* $this->assertSession()
     ->linkExists("Edit as {$term_form_mode->label()}"); */
}