function ConfigTranslationOverviewTest::testListingFieldsPage

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

Tests the field listing for the translate operation.

File

core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php, line 185

Class

ConfigTranslationOverviewTest
Translate settings and entities to various languages.

Namespace

Drupal\Tests\config_translation\Functional

Code

public function testListingFieldsPage() : void {
    // Create a content type.
    $node_type = NodeType::create([
        'type' => 'basic',
        'name' => 'Basic',
    ]);
    $node_type->save();
    $field = FieldConfig::create([
        // The field storage is guaranteed to exist because it is supplied by the
        // node module.
'field_storage' => FieldStorageConfig::loadByName('node', 'body'),
        'bundle' => $node_type->id(),
        'label' => 'Body',
        'settings' => [
            'display_summary' => FALSE,
        ],
    ]);
    $field->save();
    $this->drupalGet('admin/config/regional/config-translation/node_fields');
    $this->assertSession()
        ->pageTextContains('Body');
    $this->assertSession()
        ->pageTextContains('Basic');
    $this->assertSession()
        ->linkByHrefExists('admin/structure/types/manage/basic/fields/node.basic.body/translate');
}

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