public function LingotekSettingsTabContentFormTest::testICanDisableFields in Lingotek Translation 8
File
- src/Tests/Form/LingotekSettingsTabContentFormTest.php, line 116
Class
- LingotekSettingsTabContentFormTest
- Tests the Lingotek content settings form.
Namespace
Drupal\lingotek\Tests\Form
Code
public function testICanDisableFields() {
ContentLanguageSettings::loadByEntityTypeBundle('node', 'article')
->setLanguageAlterable(TRUE)
->save();
\Drupal::service('content_translation.manager')
->setEnabled('node', 'article', TRUE);
drupal_static_reset();
\Drupal::entityManager()
->clearCachedDefinitions();
\Drupal::service('entity.definition_update_manager')
->applyUpdates();
$this
->rebuildContainer();
\Drupal::service('entity.definition_update_manager')
->applyUpdates();
$this
->drupalGet('admin/lingotek/settings');
$edit = [
'node[article][enabled]' => 1,
'node[article][profiles]' => 'automatic',
'node[article][fields][title]' => 1,
'node[article][fields][body]' => 1,
'node[article][fields][field_image]' => 1,
'node[article][fields][field_image:properties][alt]' => 'alt',
];
$this
->drupalPostForm(NULL, $edit, 'Save', [], [], 'lingoteksettings-tab-content-form');
$this
->assertFieldChecked('edit-node-article-fields-body');
$this
->assertFieldChecked('edit-node-article-fields-field-imageproperties-alt');
$edit = [
'node[article][enabled]' => 1,
'node[article][profiles]' => 'automatic',
'node[article][fields][title]' => 1,
'node[article][fields][body]' => FALSE,
'node[article][fields][field_image]' => FALSE,
'node[article][fields][field_image:properties][alt]' => FALSE,
];
$this
->drupalPostForm(NULL, $edit, 'Save', [], [], 'lingoteksettings-tab-content-form');
$this
->assertNoFieldChecked('edit-node-article-fields-body');
$this
->assertNoFieldChecked('edit-node-article-fields-field-imageproperties-alt');
}