X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Ftests%2FDrupal%2FTests%2FCore%2FEntity%2FEntityTypeTest.php;fp=web%2Fcore%2Ftests%2FDrupal%2FTests%2FCore%2FEntity%2FEntityTypeTest.php;h=b28a72c617f7bf97e519955744e4d398fe31549d;hp=431831c4e9afc4d042ab1757e4c6022da5c9092a;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/web/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php b/web/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php index 431831c4e..b28a72c61 100644 --- a/web/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php +++ b/web/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php @@ -127,6 +127,18 @@ class EntityTypeTest extends UnitTestCase { ]; } + /** + * Tests the isInternal() method. + */ + public function testIsInternal() { + $entity_type = $this->setUpEntityType(['internal' => TRUE]); + $this->assertTrue($entity_type->isInternal()); + $entity_type = $this->setUpEntityType(['internal' => FALSE]); + $this->assertFalse($entity_type->isInternal()); + $entity_type = $this->setUpEntityType([]); + $this->assertFalse($entity_type->isInternal()); + } + /** * Tests the isRevisionable() method. */ @@ -392,6 +404,28 @@ class EntityTypeTest extends UnitTestCase { $this->assertEquals('200 entity test plural entities', $entity_type->getCountLabel(200)); } + /** + * Tests the ::getBundleLabel() method. + * + * @covers ::getBundleLabel + * @dataProvider providerTestGetBundleLabel + */ + public function testGetBundleLabel($definition, $expected) { + $entity_type = $this->setUpEntityType($definition); + $entity_type->setStringTranslation($this->getStringTranslationStub()); + $this->assertEquals($expected, $entity_type->getBundleLabel()); + } + + /** + * Provides test data for ::testGetBundleLabel(). + */ + public function providerTestGetBundleLabel() { + return [ + [['label' => 'Entity Label Foo'], 'Entity Label Foo bundle'], + [['bundle_label' => 'Bundle Label Bar'], 'Bundle Label Bar'], + ]; + } + /** * Gets a mock controller class name. *