public function EntityTypeTest::testGetGroupLabel in Zircon Profile 8
Same name and namespace in other branches
- 8.0 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 304 - Contains \Drupal\Tests\Core\Entity\EntityTypeTest.
Class
- EntityTypeTest
- @coversDefaultClass \Drupal\Core\Entity\EntityType @group Entity
Namespace
Drupal\Tests\Core\EntityCode
public function testGetGroupLabel() {
$translatable_group_label = new TranslatableMarkup($this
->randomMachineName());
$entity_type = $this
->setUpEntityType(array(
'group_label' => $translatable_group_label,
));
$this
->assertSame($translatable_group_label, $entity_type
->getGroupLabel());
$default_label = $this
->randomMachineName();
$entity_type = $this
->setUpEntityType(array(
'group_label' => $default_label,
));
$this
->assertSame($default_label, $entity_type
->getGroupLabel());
$default_label = new TranslatableMarkup('Other', array(), array(
'context' => 'Entity type group',
));
$entity_type = $this
->setUpEntityType([]);
$string_translation = $this
->getMock(TranslationInterface::class);
$string_translation
->expects($this
->atLeastOnce())
->method('translate')
->with('Other', array(), array(
'context' => 'Entity type group',
))
->willReturn($default_label);
$entity_type
->setStringTranslation($string_translation);
$this
->assertSame($default_label, $entity_type
->getGroupLabel());
}