ConfigTranslationFormTest.php in Zircon Profile 8
File
core/modules/config_translation/src/Tests/ConfigTranslationFormTest.php
View source
<?php
namespace Drupal\config_translation\Tests;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\simpletest\WebTestBase;
class ConfigTranslationFormTest extends WebTestBase {
public static $modules = array(
'config_translation',
'config_translation_test',
'editor',
);
protected $pluginId;
protected $langcode;
protected function setUp() {
parent::setUp();
$definitions = \Drupal::service('plugin.manager.config_translation.mapper')
->getDefinitions();
$this->pluginId = key($definitions);
$this->langcode = 'xx';
ConfigurableLanguage::create(array(
'id' => $this->langcode,
'label' => 'XX',
))
->save();
\Drupal::state()
->set('config_translation_test_alter_form_alter', TRUE);
}
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);
$this
->assertTrue($add_form['#base_altered']);
$this
->assertTrue($edit_form['#base_altered']);
$this
->assertTrue($add_form['#altered']);
$this
->assertTrue($edit_form['#altered']);
}
}