Commit c281ef5a authored by alexpott's avatar alexpott

Issue #2322377 by slashrsm | roald.umandal: Fixed No validation for default image.

parent 0aaa1c80
......@@ -350,6 +350,7 @@ protected function defaultImageForm(array &$element, array $settings) {
'#default_value' => empty($settings['default_image']['fid']) ? array() : array($settings['default_image']['fid']),
'#upload_location' => $settings['uri_scheme'] . '://default_images/',
'#element_validate' => array('file_managed_file_validate', array(get_class($this), 'validateDefaultImageForm')),
'#upload_validators' => $this->getUploadValidators(),
);
$element['default_image']['alt'] = array(
'#type' => 'textfield',
......
......@@ -278,6 +278,10 @@ public function testDefaultImages() {
array('@fid' => $default_images['instance2']->id())
)
);
$non_image = $this->drupalGetTestFiles('text');
$this->drupalPostForm(NULL, array('files[instance_settings_default_image_fid]' => drupal_realpath($non_image[0]->uri)), t("Upload"));
$this->assertText(t('The specified file text-0.txt could not be uploaded. Only files with the following extensions are allowed: png gif jpg jpeg.'), 'Non-image file cannot be used as default image.');
}
/**
......
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