function BreadcrumbPreprocessTest::testEntityWithBundleEntity

Tests that a resolvable bundle entity still supplies the label.

File

core/themes/default_admin/tests/src/Kernel/BreadcrumbPreprocessTest.php, line 108

Class

BreadcrumbPreprocessTest
Tests breadcrumb preprocessing for entities.

Namespace

Drupal\Tests\default_admin\Kernel

Code

public function testEntityWithBundleEntity() : void {
  NodeType::create([
    'type' => 'article',
    'name' => 'Article',
  ])->save();
  $node = Node::create([
    'type' => 'article',
    'title' => 'A node',
  ]);
  $node->save();
  $variables = $this->preprocessBreadcrumb($node, 'entity.node.edit_form');
  $this->assertSame('Edit Article', (string) end($variables['breadcrumb'])['text']);
}

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