// Check that the image item can be set to the referenced file directly.
$entity->image_test =
$this->image;
$this->
assertEquals($this->image->
id(),
$entity->image_test->target_id
);
// Delete the image and try to save the entity again.
$this->image->
delete();
$entity = EntityTest::
create(['name' =>
$this->
randomMachineName()]);
$entity->
save();
// Test image item properties.
$expected =
['target_id', 'entity', 'alt', 'title', 'width', 'height'
];
$properties =
$entity->
getFieldDefinition('image_test'
)->
getFieldStorageDefinition()->
getPropertyDefinitions();
$this->
assertEquals($expected,
array_keys($properties));
} /**
* Tests generateSampleItems() method under different resolutions.
*/
public function testImageItemSampleValueGeneration() { // Default behaviour. No resolution configuration.
$entity = EntityTest::
create();