You are here

public function EntityReferenceFieldTranslatedReferenceViewTest::testEntityReferenceDisplay in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/field/src/Tests/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php \Drupal\field\Tests\EntityReference\EntityReferenceFieldTranslatedReferenceViewTest::testEntityReferenceDisplay()

Tests if the entity is displayed in an entity reference field.

File

core/modules/field/src/Tests/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php, line 145
Contains \Drupal\field\Tests\EntityReference\EntityReferenceFieldTranslatedReferenceViewTest.

Class

EntityReferenceFieldTranslatedReferenceViewTest
Tests the translation of entity reference field display on nodes.

Namespace

Drupal\field\Tests\EntityReference

Code

public function testEntityReferenceDisplay() {

  // Create a translated referrer entity.
  $this->referrerEntity = $this
    ->createReferrerEntity();
  $this
    ->assertEntityReferenceDisplay();

  // Disable translation for referrer content type.
  $this
    ->drupalLogin($this->rootUser);
  $this
    ->drupalPostForm('admin/config/regional/content-language', [
    'settings[node][referrer][translatable]' => FALSE,
  ], t('Save configuration'));

  // Create a referrer entity without translation.
  $this->referrerEntity = $this
    ->createReferrerEntity(FALSE);
  $this
    ->assertEntityReferenceDisplay();
}