You are here

public function ConfigTranslationFormTest::testConfigTranslationFormAlter in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/config_translation/src/Tests/ConfigTranslationFormTest.php \Drupal\config_translation\Tests\ConfigTranslationFormTest::testConfigTranslationFormAlter()

Tests altering of the configuration translation forms.

File

core/modules/config_translation/src/Tests/ConfigTranslationFormTest.php, line 56
Contains \Drupal\config_translation\Tests\ConfigTranslationFormTest.

Class

ConfigTranslationFormTest
Tests for altering configuration translation forms.

Namespace

Drupal\config_translation\Tests

Code

public function testConfigTranslationFormAlter() {
  $form_builder = \Drupal::formBuilder();
  $add_form = $form_builder
    ->getForm('Drupal\\config_translation\\Form\\ConfigTranslationAddForm', \Drupal::routeMatch(), $this->pluginId, $this->langcode);
  $edit_form = $form_builder
    ->getForm('Drupal\\config_translation\\Form\\ConfigTranslationEditForm', \Drupal::routeMatch(), $this->pluginId, $this->langcode);

  // Test that hook_form_BASE_FORM_ID_alter() was called for the base form ID
  // 'config_translation_form'.
  $this
    ->assertTrue($add_form['#base_altered']);
  $this
    ->assertTrue($edit_form['#base_altered']);

  // Test that hook_form_FORM_ID_alter() was called for the form IDs
  // 'config_translation_add_form' and 'config_translation_edit_form'.
  $this
    ->assertTrue($add_form['#altered']);
  $this
    ->assertTrue($edit_form['#altered']);
}