$this->fieldTypePluginManager->
expects($this->
any()) ->
method('getDefinition'
) ->
with('test_field'
) ->
willReturn(['provider' => 'test_module', 'config_dependencies' =>
['module' =>
['test_module2'
]], 'class' => '\Drupal\Tests\field\Unit\DependencyFieldItem'
]);
$this->fieldStorage->
expects($this->
once()) ->
method('getConfigDependencyName'
) ->
willReturn('field.storage.test_entity_type.test_field'
);
$field =
new FieldConfig([ 'field_name' =>
$this->fieldStorage->
getName(),
'entity_type' => 'test_entity_type',
'bundle' => 'test_bundle',
'field_type' => 'test_field',
],
$this->entityTypeId
);
$dependencies =
$field->
calculateDependencies()->
getDependencies();
$this->
assertContains('field.storage.test_entity_type.test_field',
$dependencies['config'
]);
$this->
assertContains('test.test_entity_type.id',
$dependencies['config'
]);
$this->
assertEquals(['test_module', 'test_module2', 'test_module3'
],
$dependencies['module'
]);
}