3 namespace Drupal\Tests\field\Kernel;
5 use Drupal\field\Entity\FieldConfig;
6 use Drupal\field\Entity\FieldStorageConfig;
9 * Tests the new entity API for the test field with dependencies type.
13 class TestItemWithDependenciesTest extends FieldKernelTestBase {
20 public static $modules = ['field_test'];
23 * The name of the field to use in this test.
27 protected $fieldName = 'field_test';
30 * Tests that field types can add dependencies to field config entities.
32 public function testTestItemWithDepenencies() {
33 // Create a 'test_field_with_dependencies' field and storage for validation.
34 FieldStorageConfig::create([
35 'field_name' => $this->fieldName,
36 'entity_type' => 'entity_test',
37 'type' => 'test_field_with_dependencies',
39 $field = FieldConfig::create([
40 'entity_type' => 'entity_test',
41 'field_name' => $this->fieldName,
42 'bundle' => 'entity_test',
46 // Validate that the field configuration entity has the expected
49 'content' => ['node:article:uuid'],
50 'config' => ['field.storage.entity_test.field_test'],
51 'module' => ['entity_test', 'field_test', 'test_module']
52 ], $field->getDependencies());