Loading core/modules/content_translation/tests/src/Functional/ContentTranslationStandardFieldsTest.php +93 −3 Original line number Diff line number Diff line Loading @@ -2,10 +2,12 @@ namespace Drupal\Tests\content_translation\Functional; use Drupal\block_content\Entity\BlockContentType; use Drupal\comment\Entity\CommentType; use Drupal\Tests\BrowserTestBase; /** * Tests the Content translation settings using the standard profile. * Tests the Content translation settings. * * @group content_translation */ Loading @@ -22,13 +24,17 @@ class ContentTranslationStandardFieldsTest extends BrowserTestBase { 'node', 'comment', 'field_ui', 'entity_test', ]; /** * {@inheritdoc} */ protected $profile = 'standard'; protected $defaultTheme = 'stark'; /** * {@inheritdoc} */ protected $profile = 'testing'; /** * {@inheritdoc} Loading @@ -53,6 +59,90 @@ protected function setUp(): void { * Tests that translatable fields are being rendered. */ public function testFieldTranslatableArticle() { // Install block and field modules. \Drupal::service('module_installer')->install( [ 'block', 'block_content', 'filter', 'image', 'text', ]); // Create a basic block type with a body field. $bundle = BlockContentType::create([ 'id' => 'basic', 'label' => 'Basic', 'revision' => FALSE, ]); $bundle->save(); block_content_add_body_field($bundle->id()); // Create a comment type with a body field. $bundle = CommentType::create([ 'id' => 'comment', 'label' => 'Comment', 'target_entity_type_id' => 'node', ]); $bundle->save(); \Drupal::service('comment.manager')->addBodyField('comment'); // Create the article content type and add a comment, image and tag field. $this->drupalCreateContentType(['type' => 'article', 'title' => 'Article']); $entity_type_manager = \Drupal::entityTypeManager(); $entity_type_manager->getStorage('field_storage_config')->create([ 'entity_type' => 'node', 'field_name' => 'comment', 'type' => 'text', ])->save(); $entity_type_manager->getStorage('field_config')->create([ 'label' => 'Comments', 'field_name' => 'comment', 'entity_type' => 'node', 'bundle' => 'article', ])->save(); $entity_type_manager->getStorage('field_storage_config')->create([ 'entity_type' => 'node', 'field_name' => 'field_image', 'type' => 'image', ])->save(); $entity_type_manager->getStorage('field_config')->create([ 'label' => 'Image', 'field_name' => 'field_image', 'entity_type' => 'node', 'bundle' => 'article', ])->save(); $entity_type_manager->getStorage('field_storage_config')->create([ 'entity_type' => 'node', 'field_name' => 'field_tags', 'type' => 'text', ])->save(); $entity_type_manager->getStorage('field_config')->create([ 'label' => 'Tags', 'field_name' => 'field_tags', 'entity_type' => 'node', 'bundle' => 'article', ])->save(); $entity_type_manager->getStorage('field_storage_config')->create([ 'entity_type' => 'user', 'field_name' => 'user_picture', 'type' => 'image', ])->save(); // Add a user picture field to the user entity. $entity_type_manager->getStorage('field_config')->create([ 'label' => 'Tags', 'field_name' => 'user_picture', 'entity_type' => 'user', 'bundle' => 'user', ])->save(); $path = 'admin/config/regional/content-language'; $this->drupalGet($path); Loading Loading
core/modules/content_translation/tests/src/Functional/ContentTranslationStandardFieldsTest.php +93 −3 Original line number Diff line number Diff line Loading @@ -2,10 +2,12 @@ namespace Drupal\Tests\content_translation\Functional; use Drupal\block_content\Entity\BlockContentType; use Drupal\comment\Entity\CommentType; use Drupal\Tests\BrowserTestBase; /** * Tests the Content translation settings using the standard profile. * Tests the Content translation settings. * * @group content_translation */ Loading @@ -22,13 +24,17 @@ class ContentTranslationStandardFieldsTest extends BrowserTestBase { 'node', 'comment', 'field_ui', 'entity_test', ]; /** * {@inheritdoc} */ protected $profile = 'standard'; protected $defaultTheme = 'stark'; /** * {@inheritdoc} */ protected $profile = 'testing'; /** * {@inheritdoc} Loading @@ -53,6 +59,90 @@ protected function setUp(): void { * Tests that translatable fields are being rendered. */ public function testFieldTranslatableArticle() { // Install block and field modules. \Drupal::service('module_installer')->install( [ 'block', 'block_content', 'filter', 'image', 'text', ]); // Create a basic block type with a body field. $bundle = BlockContentType::create([ 'id' => 'basic', 'label' => 'Basic', 'revision' => FALSE, ]); $bundle->save(); block_content_add_body_field($bundle->id()); // Create a comment type with a body field. $bundle = CommentType::create([ 'id' => 'comment', 'label' => 'Comment', 'target_entity_type_id' => 'node', ]); $bundle->save(); \Drupal::service('comment.manager')->addBodyField('comment'); // Create the article content type and add a comment, image and tag field. $this->drupalCreateContentType(['type' => 'article', 'title' => 'Article']); $entity_type_manager = \Drupal::entityTypeManager(); $entity_type_manager->getStorage('field_storage_config')->create([ 'entity_type' => 'node', 'field_name' => 'comment', 'type' => 'text', ])->save(); $entity_type_manager->getStorage('field_config')->create([ 'label' => 'Comments', 'field_name' => 'comment', 'entity_type' => 'node', 'bundle' => 'article', ])->save(); $entity_type_manager->getStorage('field_storage_config')->create([ 'entity_type' => 'node', 'field_name' => 'field_image', 'type' => 'image', ])->save(); $entity_type_manager->getStorage('field_config')->create([ 'label' => 'Image', 'field_name' => 'field_image', 'entity_type' => 'node', 'bundle' => 'article', ])->save(); $entity_type_manager->getStorage('field_storage_config')->create([ 'entity_type' => 'node', 'field_name' => 'field_tags', 'type' => 'text', ])->save(); $entity_type_manager->getStorage('field_config')->create([ 'label' => 'Tags', 'field_name' => 'field_tags', 'entity_type' => 'node', 'bundle' => 'article', ])->save(); $entity_type_manager->getStorage('field_storage_config')->create([ 'entity_type' => 'user', 'field_name' => 'user_picture', 'type' => 'image', ])->save(); // Add a user picture field to the user entity. $entity_type_manager->getStorage('field_config')->create([ 'label' => 'Tags', 'field_name' => 'user_picture', 'entity_type' => 'user', 'bundle' => 'user', ])->save(); $path = 'admin/config/regional/content-language'; $this->drupalGet($path); Loading