public function LingotekSettingsTabContentFormTest::testEditContentTypeAndUseLingotekToTranslate in Lingotek Translation 3.6.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testEditContentTypeAndUseLingotekToTranslate()
- 4.0.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testEditContentTypeAndUseLingotekToTranslate()
- 3.0.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testEditContentTypeAndUseLingotekToTranslate()
- 3.1.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testEditContentTypeAndUseLingotekToTranslate()
- 3.2.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testEditContentTypeAndUseLingotekToTranslate()
- 3.3.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testEditContentTypeAndUseLingotekToTranslate()
- 3.4.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testEditContentTypeAndUseLingotekToTranslate()
- 3.5.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testEditContentTypeAndUseLingotekToTranslate()
- 3.7.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testEditContentTypeAndUseLingotekToTranslate()
- 3.8.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testEditContentTypeAndUseLingotekToTranslate()
Tests the "Use Lingotek To Translate" option when editing a content type.
File
- tests/
src/ Functional/ Form/ LingotekSettingsTabContentFormTest.php, line 449
Class
- LingotekSettingsTabContentFormTest
- Tests the Lingotek content settings form.
Namespace
Drupal\Tests\lingotek\Functional\FormCode
public function testEditContentTypeAndUseLingotekToTranslate() {
// 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();
// Check the form contains the article type and only its text-based fields.
$this
->drupalGet('admin/structure/types/manage/article');
// It should result that the field is disabled in Lingotek.
$edit = [
'language_configuration[language_alterable]' => FALSE,
'language_configuration[content_translation]' => FALSE,
'language_configuration[content_translation_for_lingotek]' => FALSE,
];
$this
->drupalPostForm('admin/structure/types/manage/article', $edit, t('Save content type'));
// Check the form contains the article type and only its text-based fields.
$this
->drupalGet('admin/structure/types/manage/article');
$this
->drupalGet('admin/lingotek/settings');
$this
->assertText('There are no translatable content entities specified');
// It should result that the field is enabled in Lingotek.
$edit = [
'language_configuration[language_alterable]' => TRUE,
'language_configuration[content_translation]' => TRUE,
'language_configuration[content_translation_for_lingotek]' => TRUE,
];
$this
->drupalPostForm('admin/structure/types/manage/article', $edit, t('Save content type'));
$this
->applyEntityUpdates();
// Check the form contains the article type and only its text-based fields.
$this
->drupalGet('admin/structure/types/manage/article');
$this
->drupalGet('admin/lingotek/settings');
$this
->assertFieldChecked('edit-node-article-enabled');
// We automatically enabled sensible defaults fields according to their type.
$this
->assertFieldChecked('edit-node-article-fields-title');
$this
->assertFieldChecked('edit-node-article-fields-body');
$this
->assertNoFieldChecked('edit-node-article-fields-uid');
}