function EntityFieldTest::testDataTypes

Same name and namespace in other branches
  1. 10 core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php \Drupal\KernelTests\Core\Entity\EntityFieldTest::testDataTypes()
  2. 9 core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php \Drupal\KernelTests\Core\Entity\EntityFieldTest::testDataTypes()
  3. 8.9.x core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php \Drupal\KernelTests\Core\Entity\EntityFieldTest::testDataTypes()
  4. main core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php \Drupal\KernelTests\Core\Entity\EntityFieldTest::testDataTypes()

Makes sure data types are correctly derived for all entity types.

File

core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php, line 685

Class

EntityFieldTest
Tests the Entity Field API.

Namespace

Drupal\KernelTests\Core\Entity

Code

public function testDataTypes() : void {
  $types = \Drupal::typedDataManager()->getDefinitions();
  foreach (EntityTestHelper::getEntityTypes() as $entity_type) {
    $this->assertNotEmpty($types['entity:' . $entity_type]['class'], 'Entity data type registered.');
  }
  // Check bundle types are provided as well.
  EntityTestHelper::createBundle('bundle');
  $types = \Drupal::typedDataManager()->getDefinitions();
  $this->assertNotEmpty($types['entity:entity_test:bundle']['class'], 'Entity bundle data type registered.');
}

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