ContentTranslationStandardFieldsTest.php 2.14 KB
Newer Older
1 2
<?php

3
namespace Drupal\Tests\content_translation\Functional;
4

5
use Drupal\Tests\BrowserTestBase;
6 7 8

/**
 * Tests the Content translation settings using the standard profile.
9 10
 *
 * @group content_translation
11
 */
12
class ContentTranslationStandardFieldsTest extends BrowserTestBase {
13 14 15 16 17 18

  /**
   * Modules to enable.
   *
   * @var array
   */
19
  protected static $modules = [
20 21 22 23 24 25
    'language',
    'content_translation',
    'node',
    'comment',
    'field_ui',
    'entity_test',
26
  ];
27 28 29 30 31 32 33 34 35

  /**
   * {@inheritdoc}
   */
  protected $profile = 'standard';

  /**
   * {@inheritdoc}
   */
36
  protected function setUp(): void {
37 38
    parent::setUp();

39
    $admin_user = $this->drupalCreateUser([
40 41 42 43 44 45 46 47
      'access administration pages',
      'administer languages',
      'administer content translation',
      'administer content types',
      'administer node fields',
      'administer comment fields',
      'administer comments',
      'administer comment types',
48
    ]);
49 50 51 52 53 54 55 56 57 58 59
    $this->drupalLogin($admin_user);
  }

  /**
   * Tests that translatable fields are being rendered.
   */
  public function testFieldTranslatableArticle() {

    $path = 'admin/config/regional/content-language';
    $this->drupalGet($path);

60
    // Check content block fields.
61
    $this->assertSession()->checkboxChecked('edit-settings-block-content-basic-fields-body');
62

63
    // Check comment fields.
64
    $this->assertSession()->checkboxChecked('edit-settings-comment-comment-fields-comment-body');
65

66
    // Check node fields.
67 68 69
    $this->assertSession()->checkboxChecked('edit-settings-node-article-fields-comment');
    $this->assertSession()->checkboxChecked('edit-settings-node-article-fields-field-image');
    $this->assertSession()->checkboxChecked('edit-settings-node-article-fields-field-tags');
70 71

    // Check user fields.
72
    $this->assertSession()->checkboxChecked('edit-settings-user-user-fields-user-picture');
73 74
  }

75 76 77 78 79 80
  /**
   * Test that revision_log is not translatable.
   */
  public function testRevisionLogNotTranslatable() {
    $path = 'admin/config/regional/content-language';
    $this->drupalGet($path);
81
    $this->assertSession()->fieldNotExists('edit-settings-node-article-fields-revision-log');
82 83
  }

84
}