Skip to content
Snippets Groups Projects
Commit 337b3709 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2046809 by larowlan, quicksketch: Fixed UUIDs not added when file...

Issue #2046809 by larowlan, quicksketch: Fixed UUIDs not added when file uploaded using managed_file() FAPI element.
parent d88a2be4
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -52,7 +52,7 @@ public function baseFieldDefinitions() {
$properties['uuid'] = array(
'label' => t('UUID'),
'description' => t('The file UUID.'),
'type' => 'string_field',
'type' => 'uuid_field',
'read-only' => TRUE,
);
$properties['langcode'] = array(
......
......@@ -88,4 +88,23 @@ function testMultiple() {
$this->assertTrue($by_fid_file->file_test['loaded'], 'file_test_file_load() was able to modify the file during load.');
$this->assertEqual($by_fid_file->getFileUri(), $file->getFileUri(), 'Loading by fid got the correct filepath.', 'File');
}
/**
* Loads a single file and ensure that the correct values are returned.
*/
public function testUuidValues() {
// Create a new file entity from scratch so we know the values.
$file = $this->createFile('druplicon.txt', NULL, 'public');
$file->save();
file_test_reset();
$by_uuid_file = entity_load_by_uuid('file', $file->uuid());
$this->assertFileHookCalled('load');
$this->assertTrue(is_object($by_uuid_file), 'entity_load_by_uuid() returned a file object.');
if (is_object($by_uuid_file)) {
$this->assertEqual($by_uuid_file->id(), $file->id(), 'Loading by UUID got the same fid.', 'File');
$this->assertTrue($by_uuid_file->file_test['loaded'], 'file_test_file_load() was able to modify the file during load.');
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment