function ContentTranslationSettingsApiTest::testSettingsApi

Same name in other branches
  1. 8.9.x core/modules/content_translation/tests/src/Kernel/ContentTranslationSettingsApiTest.php \Drupal\Tests\content_translation\Kernel\ContentTranslationSettingsApiTest::testSettingsApi()
  2. 10 core/modules/content_translation/tests/src/Kernel/ContentTranslationSettingsApiTest.php \Drupal\Tests\content_translation\Kernel\ContentTranslationSettingsApiTest::testSettingsApi()
  3. 11.x core/modules/content_translation/tests/src/Kernel/ContentTranslationSettingsApiTest.php \Drupal\Tests\content_translation\Kernel\ContentTranslationSettingsApiTest::testSettingsApi()

Tests that enabling translation via the API triggers schema updates.

File

core/modules/content_translation/tests/src/Kernel/ContentTranslationSettingsApiTest.php, line 38

Class

ContentTranslationSettingsApiTest
Tests the content translation settings API.

Namespace

Drupal\Tests\content_translation\Kernel

Code

public function testSettingsApi() {
    $this->container
        ->get('content_translation.manager')
        ->setEnabled('entity_test_mul', 'entity_test_mul', TRUE);
    $schema = Database::getConnection()->schema();
    $result = $schema->fieldExists('entity_test_mul_property_data', 'content_translation_source') && $schema->fieldExists('entity_test_mul_property_data', 'content_translation_outdated');
    $this->assertTrue($result, 'Schema updates correctly performed.');
}

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