function EntityTypeTest::testGetGroupLabel

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

@covers ::getGroupLabel

File

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

Class

EntityTypeTest
@coversDefaultClass \Drupal\Core\Entity\EntityType @group Entity

Namespace

Drupal\Tests\Core\Entity

Code

public function testGetGroupLabel() {
    $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.