public function LingotekSettingsTabContentFormTest::testFieldsAreNotAvailableIfTranslatableEvenIfStorageIsTranslatable in Lingotek Translation 3.4.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testFieldsAreNotAvailableIfTranslatableEvenIfStorageIsTranslatable()
- 4.0.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testFieldsAreNotAvailableIfTranslatableEvenIfStorageIsTranslatable()
- 3.0.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testFieldsAreNotAvailableIfTranslatableEvenIfStorageIsTranslatable()
- 3.1.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testFieldsAreNotAvailableIfTranslatableEvenIfStorageIsTranslatable()
- 3.2.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testFieldsAreNotAvailableIfTranslatableEvenIfStorageIsTranslatable()
- 3.3.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testFieldsAreNotAvailableIfTranslatableEvenIfStorageIsTranslatable()
- 3.5.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testFieldsAreNotAvailableIfTranslatableEvenIfStorageIsTranslatable()
- 3.6.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testFieldsAreNotAvailableIfTranslatableEvenIfStorageIsTranslatable()
- 3.7.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testFieldsAreNotAvailableIfTranslatableEvenIfStorageIsTranslatable()
- 3.8.x tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekSettingsTabContentFormTest::testFieldsAreNotAvailableIfTranslatableEvenIfStorageIsTranslatable()
File
- tests/src/Functional/Form/LingotekSettingsTabContentFormTest.php, line 376
Class
- LingotekSettingsTabContentFormTest
- Tests the Lingotek content settings form.
Namespace
Drupal\Tests\lingotek\Functional\Form
Code
public function testFieldsAreNotAvailableIfTranslatableEvenIfStorageIsTranslatable() {
ContentLanguageSettings::loadByEntityTypeBundle('node', 'article')
->setLanguageAlterable(TRUE)
->save();
\Drupal::service('content_translation.manager')
->setEnabled('node', 'article', TRUE);
drupal_static_reset();
\Drupal::entityTypeManager()
->clearCachedDefinitions();
$this
->applyEntityUpdates();
$this
->rebuildContainer();
$this
->applyEntityUpdates();
$field_storage = FieldStorageConfig::loadByName('node', 'field_image');
$field_storage
->setTranslatable(TRUE)
->save();
$field = FieldConfig::loadByName('node', 'article', 'field_image');
$field
->setTranslatable(FALSE)
->save();
$field_storage = FieldStorageConfig::loadByName('node', 'field_image');
$field = FieldConfig::loadByName('node', 'article', 'field_image');
$this
->assertTrue($field_storage
->isTranslatable(), 'Field storage is translatable.');
$this
->assertFalse($field
->isTranslatable(), 'Field instance is not translatable.');
$this
->drupalGet('admin/lingotek/settings');
$this
->assertNoFieldById('edit-node-article-fields-field-image', '', 'The image field is not present after marked as not translatable.');
$field
->setTranslatable(TRUE)
->save();
$this
->drupalGet('admin/lingotek/settings');
$this
->assertFieldById('edit-node-article-fields-field-image', '', 'The image field is present after marked as translatable.');
}