Issue #1262592 by jmarkel, pingers, marcingy: Fixed numeric names fail image creation.
parent
bd7712385a
commit
6adf8ca0c2
|
@ -749,7 +749,10 @@ function image_style_options($include_empty = TRUE) {
|
|||
if ($include_empty && !empty($styles)) {
|
||||
$options[''] = t('<none>');
|
||||
}
|
||||
$options = array_merge($options, drupal_map_assoc(array_keys($styles)));
|
||||
// Use the array concatenation operator '+' here instead of array_merge(),
|
||||
// because the latter loses the datatype of the array keys, turning
|
||||
// associative string keys into numeric ones without warning.
|
||||
$options = $options + drupal_map_assoc(array_keys($styles));
|
||||
if (empty($options)) {
|
||||
$options[''] = t('No defined styles');
|
||||
}
|
||||
|
|
|
@ -354,6 +354,21 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
|
|||
return count(file_scan_directory('public://styles/' . $style['name'], '/.*/'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test creating an image style with a numeric name and ensuring it can be
|
||||
* applied to an image.
|
||||
*/
|
||||
function testNumericStyleName() {
|
||||
$style_name = rand();
|
||||
$edit = array(
|
||||
'name' => $style_name,
|
||||
);
|
||||
$this->drupalPost('admin/config/media/image-styles/add', $edit, t('Create new style'));
|
||||
$this->assertRaw(t('Style %name was created.', array('%name' => $style_name)), t('Image style successfully created.'));
|
||||
$options = image_style_options();
|
||||
$this->assertTrue(array_key_exists($style_name, $options), t('Array key %key exists.', array('%key' => $style_name)));
|
||||
}
|
||||
|
||||
/**
|
||||
* General test to add a style, add/remove/edit effects to it, then delete it.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue