protected function EntityReferenceFieldTranslatedReferenceViewTest::assertEntityReferenceFormDisplay in Drupal 9
Same name and namespace in other branches
- 8 core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php \Drupal\Tests\field\Functional\EntityReference\EntityReferenceFieldTranslatedReferenceViewTest::assertEntityReferenceFormDisplay()
Assert entity reference form display.
1 call to EntityReferenceFieldTranslatedReferenceViewTest::assertEntityReferenceFormDisplay()
- EntityReferenceFieldTranslatedReferenceViewTest::testEntityReferenceDisplay in core/
modules/ field/ tests/ src/ Functional/ EntityReference/ EntityReferenceFieldTranslatedReferenceViewTest.php - Tests if the entity is displayed in an entity reference field.
File
- core/
modules/ field/ tests/ src/ Functional/ EntityReference/ EntityReferenceFieldTranslatedReferenceViewTest.php, line 196
Class
- EntityReferenceFieldTranslatedReferenceViewTest
- Tests the translation of entity reference field display on nodes.
Namespace
Drupal\Tests\field\Functional\EntityReferenceCode
protected function assertEntityReferenceFormDisplay() {
$this
->drupalLogin($this->webUser);
$url = $this->referrerEntity
->toUrl('edit-form');
$translation_url = $this->referrerEntity
->toUrl('edit-form', [
'language' => ConfigurableLanguage::load($this->translateToLangcode),
]);
$this
->drupalGet($url);
$this
->assertSession()
->fieldValueEquals('test_reference_field[0][target_id]', $this->originalLabel . ' (1)');
$this
->assertSession()
->fieldValueEquals('test_reference_field[1][target_id]', $this->labelOfNotTranslatedReference . ' (2)');
$this
->drupalGet($translation_url);
$this
->assertSession()
->fieldValueEquals('test_reference_field[0][target_id]', $this->translatedLabel . ' (1)');
$this
->assertSession()
->fieldValueEquals('test_reference_field[1][target_id]', $this->labelOfNotTranslatedReference . ' (2)');
$this
->drupalLogout();
}