public function LingotekSettingsTabContentFormTest::testCreateFieldAndUseLingotekToTranslateWithBodyField in Lingotek Translation 3.5.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testCreateFieldAndUseLingotekToTranslateWithBodyField()
- 4.0.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testCreateFieldAndUseLingotekToTranslateWithBodyField()
- 3.0.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testCreateFieldAndUseLingotekToTranslateWithBodyField()
- 3.1.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testCreateFieldAndUseLingotekToTranslateWithBodyField()
- 3.2.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testCreateFieldAndUseLingotekToTranslateWithBodyField()
- 3.3.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testCreateFieldAndUseLingotekToTranslateWithBodyField()
- 3.4.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testCreateFieldAndUseLingotekToTranslateWithBodyField()
- 3.6.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testCreateFieldAndUseLingotekToTranslateWithBodyField()
- 3.7.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testCreateFieldAndUseLingotekToTranslateWithBodyField()
- 3.8.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testCreateFieldAndUseLingotekToTranslateWithBodyField()
Tests the "Use Lingotek To Translate" option when creating a new body field.
File
- tests/
src/ Functional/ Form/ LingotekSettingsTabContentFormTest.php, line 505
Class
- LingotekSettingsTabContentFormTest
- Tests the Lingotek content settings form.
Namespace
Drupal\Tests\lingotek\Functional\FormCode
public function testCreateFieldAndUseLingotekToTranslateWithBodyField() {
// Enable translation for the current entity type and ensure the change is
// picked up.
ContentLanguageSettings::loadByEntityTypeBundle('node', 'article')
->setLanguageAlterable(TRUE)
->save();
\Drupal::service('content_translation.manager')
->setEnabled('node', 'article', TRUE);
drupal_static_reset();
\Drupal::entityTypeManager()
->clearCachedDefinitions();
$this
->applyEntityUpdates();
// Rebuild the container so that the new languages are picked up by services
// that hold a list of languages.
$this
->rebuildContainer();
$this
->applyEntityUpdates();
$this
->drupalGet('admin/lingotek/settings');
// Check the form contains the fields but they are disabled.
$this
->assertNoFieldChecked('edit-node-article-fields-body');
// Check body field.
$edit = [
'node[article][enabled]' => 1,
'node[article][profiles]' => 'automatic',
'node[article][fields][body]' => 1,
];
$this
->drupalPostForm(NULL, $edit, 'Save', [], 'lingoteksettings-tab-content-form');
$this
->assertFieldChecked('edit-node-article-fields-body');
$this
->drupalGet('/admin/config/regional/config-translation/node_fields');
$this
->clickLink(t('Translate'), 0);
$this
->clickLink('Edit');
$this
->assertFieldChecked('edit-translatable-for-lingotek');
// There are no properties to show.
$this
->assertNoRaw('Lingotek translation');
$edit = [
'translatable_for_lingotek' => FALSE,
];
$this
->drupalPostForm(NULL, $edit, 'Save settings');
$this
->clickLink('Edit');
$this
->assertNoFieldChecked('edit-translatable-for-lingotek');
$this
->drupalGet('/admin/lingotek/settings');
$this
->assertNoFieldChecked("edit-node-article-fields-body");
$this
->drupalGet('/admin/config/regional/config-translation/node_fields');
$this
->clickLink(t('Translate'), 0);
$this
->clickLink('Edit');
$edit = [
'translatable_for_lingotek' => 1,
];
$this
->drupalPostForm(NULL, $edit, 'Save settings');
$this
->clickLink('Edit');
$this
->assertFieldChecked('edit-translatable-for-lingotek');
$this
->drupalGet('/admin/lingotek/settings');
$this
->assertFieldChecked("edit-node-article-fields-body");
}