function ConfigEntityStorageTest::testHasData

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStorageTest.php \Drupal\KernelTests\Core\Config\ConfigEntityStorageTest::testHasData()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStorageTest.php \Drupal\KernelTests\Core\Config\ConfigEntityStorageTest::testHasData()
  3. 10 core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStorageTest.php \Drupal\KernelTests\Core\Config\ConfigEntityStorageTest::testHasData()

Tests the hasData() method for config entity storage.

@covers \Drupal\Core\Config\Entity\ConfigEntityStorage::hasData

File

core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStorageTest.php, line 58

Class

ConfigEntityStorageTest
Tests configuration entity storage.

Namespace

Drupal\KernelTests\Core\Config

Code

public function testHasData() : void {
    $storage = \Drupal::entityTypeManager()->getStorage('config_test');
    $this->assertFalse($storage->hasData());
    // Add a test config entity and check again.
    $storage->create([
        'id' => $this->randomMachineName(),
    ])
        ->save();
    $this->assertTrue($storage->hasData());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.