public function testCalculateDependencies() { // Mock the interfaces necessary to create a dependency on a bundle entity.
$target_entity_type =
$this->
createMock('\Drupal\Core\Entity\EntityTypeInterface'
);
$target_entity_type->
expects($this->
any()) ->
method('getBundleConfigDependency'
) ->
willReturn(['type' => 'config', 'name' => 'test.test_entity_type.id'
]);
$this->entityTypeManager->
expects($this->
any()) ->
method('getDefinition'
) ->
willReturnMap([ [$this->entityTypeId, TRUE,
$this->entityType
],
['test_entity_type', TRUE,
$target_entity_type],
]);
$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'
)