function EntityTypeTest::testGetGroupLabel

Same name and namespace in other branches
  1. 10 core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php \Drupal\Tests\Core\Entity\EntityTypeTest::testGetGroupLabel()
  2. 9 core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php \Drupal\Tests\Core\Entity\EntityTypeTest::testGetGroupLabel()
  3. 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php \Drupal\Tests\Core\Entity\EntityTypeTest::testGetGroupLabel()

Tests get group label.

File

core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php, line 388

Class

EntityTypeTest
Tests Drupal\Core\Entity\EntityType.

Namespace

Drupal\Tests\Core\Entity

Code

public function testGetGroupLabel() : void {
  // phpcs:ignore Drupal.Semantics.FunctionT.NotLiteralString
  $translatable_group_label = new TranslatableMarkup($this->randomMachineName());
  $entity_type = $this->setUpEntityType([
    'group_label' => $translatable_group_label,
  ]);
  $this->assertSame($translatable_group_label, $entity_type->getGroupLabel());
  $default_label = $this->randomMachineName();
  $entity_type = $this->setUpEntityType([
    'group_label' => $default_label,
  ]);
  $this->assertSame($default_label, $entity_type->getGroupLabel());
  $default_label = new TranslatableMarkup('Other', [], [
    'context' => 'Entity type group',
  ]);
  $entity_type = $this->setUpEntityType([
    'group_label' => $default_label,
  ]);
  $this->assertSame($default_label, $entity_type->getGroupLabel());
}

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