Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / tests / Drupal / Tests / Core / Entity / EntityTypeTest.php
index 431831c4e9afc4d042ab1757e4c6022da5c9092a..b28a72c617f7bf97e519955744e4d398fe31549d 100644 (file)
@@ -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.
    *