Commit 337b3709 authored by alexpott's avatar alexpott

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
......@@ -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.');
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment