function ContentTranslationUntranslatableFieldsTest::setUp

Same name in other branches
  1. 9 core/modules/content_translation/tests/src/Functional/ContentTranslationUntranslatableFieldsTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationUntranslatableFieldsTest::setUp()
  2. 8.9.x core/modules/content_translation/tests/src/Functional/ContentTranslationUntranslatableFieldsTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationUntranslatableFieldsTest::setUp()
  3. 11.x core/modules/content_translation/tests/src/Functional/ContentTranslationUntranslatableFieldsTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationUntranslatableFieldsTest::setUp()

Overrides ContentTranslationPendingRevisionTestBase::setUp

File

core/modules/content_translation/tests/src/Functional/ContentTranslationUntranslatableFieldsTest.php, line 35

Class

ContentTranslationUntranslatableFieldsTest
Tests the untranslatable fields behaviors.

Namespace

Drupal\Tests\content_translation\Functional

Code

protected function setUp() : void {
    parent::setUp();
    $this->doSetup();
    // Configure one field as untranslatable.
    $this->drupalLogin($this->administrator);
    static::setFieldTranslatable($this->entityTypeId, $this->bundle, $this->fieldName, FALSE);
    
    /** @var \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager */
    $entity_field_manager = $this->container
        ->get('entity_field.manager');
    $entity_field_manager->clearCachedFieldDefinitions();
    $definitions = $entity_field_manager->getFieldDefinitions($this->entityTypeId, $this->bundle);
    $this->assertFalse($definitions[$this->fieldName]
        ->isTranslatable());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.