Verified Commit 94a40596 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3299024 by amarlata, reenaraghavan, quietone, larowlan:...

Issue #3299024 by amarlata, reenaraghavan, quietone, larowlan: EntityReferenceFormatterTest should use ->label()
parent 803da73c
Loading
Loading
Loading
Loading
+4 −4
Changes for core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceFormatterTest.php: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -267,7 +267,7 @@ public function testEntityFormatterRecursiveRendering() {
    // the entity title because we're rendering the full entity, not just the
    // reference field.
    $expected_occurrences = EntityReferenceEntityFormatter::RECURSIVE_RENDER_LIMIT * 2 + 2;
    $actual_occurrences = substr_count($output, $referencing_entity_1->name->value);
    $actual_occurrences = substr_count($output, $referencing_entity_1->label());
    $this->assertEquals($expected_occurrences, $actual_occurrences);

    // Repeat the process with another entity in order to check that the
@@ -280,17 +280,17 @@ public function testEntityFormatterRecursiveRendering() {
    $build = $view_builder->view($referencing_entity_2, 'default');
    $output = $renderer->renderRoot($build);

    $actual_occurrences = substr_count($output, $referencing_entity_2->name->value);
    $actual_occurrences = substr_count($output, $referencing_entity_2->label());
    $this->assertEquals($expected_occurrences, $actual_occurrences);

    // Now render both entities at the same time and check again.
    $build = $view_builder->viewMultiple([$referencing_entity_1, $referencing_entity_2], 'default');
    $output = $renderer->renderRoot($build);

    $actual_occurrences = substr_count($output, $referencing_entity_1->name->value);
    $actual_occurrences = substr_count($output, $referencing_entity_1->label());
    $this->assertEquals($expected_occurrences, $actual_occurrences);

    $actual_occurrences = substr_count($output, $referencing_entity_2->name->value);
    $actual_occurrences = substr_count($output, $referencing_entity_2->label());
    $this->assertEquals($expected_occurrences, $actual_occurrences);
  }