Security update for Core, with self-updated composer
[yaffs-website] / web / core / tests / Drupal / KernelTests / Core / KeyValueStore / KeyValueContentEntityStorageTest.php
index 31300dbcd77a46eecbcc2d0a931380e34b683b32..98850055a5fb92195d9c0d64ba96cb67fe92f743 100644 (file)
@@ -31,9 +31,15 @@ class KeyValueContentEntityStorageTest extends KernelTestBase {
 
   /**
    * Tests CRUD operations.
+   *
+   * @covers \Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage::hasData
    */
   public function testCRUD() {
     $default_langcode = \Drupal::languageManager()->getDefaultLanguage()->getId();
+
+    $storage = \Drupal::entityTypeManager()->getStorage('entity_test_label');
+    $this->assertFalse($storage->hasData());
+
     // Verify default properties on a newly created empty entity.
     $empty = EntityTestLabel::create();
     $this->assertIdentical($empty->id->value, NULL);
@@ -108,6 +114,9 @@ class KeyValueContentEntityStorageTest extends KernelTestBase {
       $this->fail('EntityMalformedException was not thrown.');
     }
 
+    // Verify that hasData() returns the expected result.
+    $this->assertTrue($storage->hasData());
+
     // Verify that the correct status is returned and properties did not change.
     $this->assertIdentical($status, SAVED_NEW);
     $this->assertIdentical($entity_test->id(), $expected['id']);
@@ -157,4 +166,12 @@ class KeyValueContentEntityStorageTest extends KernelTestBase {
     }
   }
 
+  /**
+   * Tests uninstallation of a module that does not use the SQL entity storage.
+   */
+  public function testUninstall() {
+    $uninstall_validator_reasons = \Drupal::service('content_uninstall_validator')->validate('keyvalue_test');
+    $this->assertEmpty($uninstall_validator_reasons);
+  }
+
 }