You are here

public function FormModeManagerUiTest::testEntityFormModeManagerSettingsUi 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::testEntityFormModeManagerSettingsUi()

Tests the Form Mode Manager Settings interface.

File

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

Class

FormModeManagerUiTest
Tests the Form mode manager user interfaces.

Namespace

Drupal\Tests\form_mode_manager\Functional

Code

public function testEntityFormModeManagerSettingsUi() {
  $node_form_mode_id = $this->formModeManager
    ->getFormModeMachineName($this->nodeFormMode
    ->id());

  // Test the Form Mode Manager UI page.
  $this
    ->drupalLogin($this->anonymousUser);
  $this
    ->drupalGet('admin/config/content/form_mode_manager');
  $this
    ->assertSession()
    ->statusCodeEquals(403);
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet('admin/config/content/form_mode_manager');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->titleEquals('Form Mode Manager settings | Drupal');
  $this
    ->assertLocalTasks(self::$uiLocalTabsExpected);

  // Check existance of select element.
  $this
    ->assertSession()
    ->selectExists('element_node[]');
  $this
    ->getSession()
    ->getPage()
    ->selectFieldOption('element_node[]', $node_form_mode_id);
  $this
    ->getSession()
    ->getPage()
    ->pressButton('Save configuration');
  $this
    ->assertSession()
    ->pageTextContains(t('The configuration options have been saved.'));
}