You are here

protected function EntityReferenceFieldTranslatedReferenceViewTest::assertEntityReferenceDisplay 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::assertEntityReferenceDisplay()

Assert entity reference display.

1 call to EntityReferenceFieldTranslatedReferenceViewTest::assertEntityReferenceDisplay()
EntityReferenceFieldTranslatedReferenceViewTest::testEntityReferenceDisplay in core/modules/field/src/Tests/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php
Tests if the entity is displayed in an entity reference field.

File

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

Class

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

Namespace

Drupal\field\Tests\EntityReference

Code

protected function assertEntityReferenceDisplay() {
  $url = $this->referrerEntity
    ->urlInfo();
  $translation_url = $this->referrerEntity
    ->urlInfo('canonical', [
    'language' => ConfigurableLanguage::load($this->translateToLangcode),
  ]);
  $this
    ->drupalGet($url);
  $this
    ->assertText($this->labelOfNotTranslatedReference, 'The label of not translated reference is displayed.');
  $this
    ->assertText($this->originalLabel, 'The default label of translated reference is displayed.');
  $this
    ->assertNoText($this->translatedLabel, 'The translated label of translated reference is not displayed.');
  $this
    ->drupalGet($translation_url);
  $this
    ->assertText($this->labelOfNotTranslatedReference, 'The label of not translated reference is displayed.');
  $this
    ->assertNoText($this->originalLabel, 'The default label of translated reference is not displayed.');
  $this
    ->assertText($this->translatedLabel, 'The translated label of translated reference is displayed.');
}