function ContentTranslationEntityBundleInfoTest::testHookInvocationOrder
Same name in other branches
- 9 core/modules/content_translation/tests/src/Kernel/ContentTranslationEntityBundleInfoTest.php \Drupal\Tests\content_translation\Kernel\ContentTranslationEntityBundleInfoTest::testHookInvocationOrder()
- 8.9.x core/modules/content_translation/tests/src/Kernel/ContentTranslationEntityBundleInfoTest.php \Drupal\Tests\content_translation\Kernel\ContentTranslationEntityBundleInfoTest::testHookInvocationOrder()
- 10 core/modules/content_translation/tests/src/Kernel/ContentTranslationEntityBundleInfoTest.php \Drupal\Tests\content_translation\Kernel\ContentTranslationEntityBundleInfoTest::testHookInvocationOrder()
Tests that modules can know whether bundles are translatable.
File
-
core/
modules/ content_translation/ tests/ src/ Kernel/ ContentTranslationEntityBundleInfoTest.php, line 64
Class
- ContentTranslationEntityBundleInfoTest
- Tests the Content Translation bundle info logic.
Namespace
Drupal\Tests\content_translation\KernelCode
public function testHookInvocationOrder() : void {
$this->contentTranslationManager
->setEnabled('entity_test_mul', 'entity_test_mul', TRUE);
$this->bundleInfo
->clearCachedBundles();
$this->bundleInfo
->getAllBundleInfo();
// Verify that the test module comes first in the module list, which would
// normally make its hook implementation to be invoked first.
/** @var \Drupal\Core\Extension\ModuleHandlerInterface $module_handler */
$module_handler = $this->container
->get('module_handler');
$module_list = $module_handler->getModuleList();
$expected_modules = [
'content_translation_test',
'content_translation',
];
$actual_modules = array_keys(array_intersect_key($module_list, array_flip($expected_modules)));
$this->assertEquals($expected_modules, $actual_modules);
// Check that the "content_translation_test" hook implementation has access
// to the "translatable" bundle info property.
/** @var \Drupal\Core\State\StateInterface $state */
$state = $this->container
->get('state');
$this->assertTrue($state->get('content_translation_test.translatable'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.