More updates to stop using dev or alpha or beta versions.
[yaffs-website] / web / core / tests / Drupal / Tests / Core / Entity / EntityTypeTest.php
index d1045f5ffad6eb849ab90701376cba962c6c4699..b28a72c617f7bf97e519955744e4d398fe31549d 100644 (file)
@@ -58,7 +58,11 @@ class EntityTypeTest extends UnitTestCase {
    */
   public function testGetKeys($entity_keys, $expected) {
     $entity_type = $this->setUpEntityType(['entity_keys' => $entity_keys]);
-    $this->assertSame($expected + ['default_langcode' => 'default_langcode'], $entity_type->getKeys());
+    $expected += [
+      'default_langcode' => 'default_langcode',
+      'revision_translation_affected' => 'revision_translation_affected',
+    ];
+    $this->assertSame($expected, $entity_type->getKeys());
   }
 
   /**
@@ -123,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.
    */
@@ -388,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.
    *