],
],
];
$actual =
$this->installedStorageSchema->
get('entity_test.field_schema_data.shape'
);
$this->
assertSame($expected,
$actual);
// Make the field an entity key, so that it will get marked as NOT NULL.
$entity_type =
$this->entityDefinitionUpdateManager->
getEntityType('entity_test'
);
$original_keys =
$entity_type->
getKeys();
$entity_type->
set('entity_keys',
$original_keys +
['shape' => 'shape'
]);
$this->entityDefinitionUpdateManager->
updateEntityType($entity_type);
// Update the field and make sure the schema got updated.
$this->entityDefinitionUpdateManager->
updateFieldStorageDefinition($field);
$expected['entity_test'
]['fields'
]['shape__shape'
]['not null'
] = TRUE;
$expected['entity_test'
]['fields'
]['shape__color'
]['not null'
] = TRUE;
$actual =
$this->installedStorageSchema->
get('entity_test.field_schema_data.shape'
);
$this->
assertSame($expected,
$actual);
// Remove the entity key again and check that the schema got reverted.
$entity_type->
set('entity_keys',
$original_keys);
$this->entityDefinitionUpdateManager->
updateEntityType($entity_type);