Cleaning up some notices and incorrect function signatures for tests

8.0.x
Greg Dunlap 2012-02-13 19:18:14 -05:00
parent 757ce5148e
commit 6f1946a393
2 changed files with 15 additions and 30 deletions

View File

@ -496,12 +496,12 @@ function image_style_load($name = NULL) {
* @param style
* An image style array.
* @return
* An image style array. In the case of a new style, 'isid' will be populated.
* An image style array.
*/
function image_style_save($style) {
$config = config('image.styles.' . $style['name']);
$config->set('name', $style['name']);
if ($style['effects']) {
if (isset($style['effects'])) {
$config->set('effects', $style['effects']);
}
else {
@ -553,17 +553,12 @@ function image_style_delete($style, $replacement_style_name = '') {
* An array of image effects associated with specified image style in the
* format array('isid' => array()), or an empty array if the specified style
* has no effects.
*
* @todo I think this function can be deprecated since we automatically
* load all effects with a style now.
*/
function image_style_effects($style) {
$effects = image_effects();
$style_effects = array();
foreach ($effects as $effect) {
if ($style['isid'] == $effect['isid']) {
$style_effects[$effect['ieid']] = $effect;
}
}
return $style_effects;
return $style['effects'];
}
/**
@ -943,7 +938,6 @@ function image_effects() {
* @return
* An image effect array, consisting of the following keys:
* - "ieid": The unique image effect ID.
* - "isid": The unique image style ID that contains this image effect.
* - "weight": The weight of this image effect within the image style.
* - "name": The name of the effect definition that powers this image effect.
* - "data": An array of configuration options for this image effect.

View File

@ -977,10 +977,9 @@ class ImageDimensionsUnitTest extends DrupalWebTestCase {
'height' => 90,
'upscale' => TRUE,
),
'isid' => $style['isid'],
);
image_effect_save($effect);
image_effect_save('test', $effect);
$img_tag = theme_image_style($variables);
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . $url . '" width="120" height="60" alt="" />', t('Expected img tag was found.'));
$this->assertFalse(file_exists($generated_uri), t('Generated file does not exist.'));
@ -998,10 +997,9 @@ class ImageDimensionsUnitTest extends DrupalWebTestCase {
'degrees' => -90,
'random' => FALSE,
),
'isid' => $style['isid'],
);
image_effect_save($effect);
image_effect_save('test', $effect);
$img_tag = theme_image_style($variables);
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . $url . '" width="60" height="120" alt="" />', t('Expected img tag was found.'));
$this->assertFalse(file_exists($generated_uri), t('Generated file does not exist.'));
@ -1020,10 +1018,9 @@ class ImageDimensionsUnitTest extends DrupalWebTestCase {
'height' => 90,
'upscale' => TRUE,
),
'isid' => $style['isid'],
);
image_effect_save($effect);
image_effect_save('test', $effect);
$img_tag = theme_image_style($variables);
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . $url . '" width="45" height="90" alt="" />', t('Expected img tag was found.'));
$this->assertFalse(file_exists($generated_uri), t('Generated file does not exist.'));
@ -1042,10 +1039,9 @@ class ImageDimensionsUnitTest extends DrupalWebTestCase {
'height' => 200,
'upscale' => FALSE,
),
'isid' => $style['isid'],
);
image_effect_save($effect);
image_effect_save('test', $effect);
$img_tag = theme_image_style($variables);
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . $url . '" width="45" height="90" alt="" />', t('Expected img tag was found.'));
$this->assertFalse(file_exists($generated_uri), t('Generated file does not exist.'));
@ -1060,10 +1056,9 @@ class ImageDimensionsUnitTest extends DrupalWebTestCase {
$effect = array(
'name' => 'image_desaturate',
'data' => array(),
'isid' => $style['isid'],
);
image_effect_save($effect);
image_effect_save('test', $effect);
$img_tag = theme_image_style($variables);
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . $url . '" width="45" height="90" alt="" />', t('Expected img tag was found.'));
$this->assertFalse(file_exists($generated_uri), t('Generated file does not exist.'));
@ -1081,10 +1076,9 @@ class ImageDimensionsUnitTest extends DrupalWebTestCase {
'degrees' => 180,
'random' => TRUE,
),
'isid' => $style['isid'],
);
image_effect_save($effect);
image_effect_save('test', $effect);
$img_tag = theme_image_style($variables);
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . $url . '" alt="" />', t('Expected img tag was found.'));
$this->assertFalse(file_exists($generated_uri), t('Generated file does not exist.'));
@ -1101,10 +1095,9 @@ class ImageDimensionsUnitTest extends DrupalWebTestCase {
'height' => 30,
'anchor' => 'center-center',
),
'isid' => $style['isid'],
);
image_effect_save($effect);
image_effect_save('test', $effect);
$img_tag = theme_image_style($variables);
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . $url . '" width="30" height="30" alt="" />', t('Expected img tag was found.'));
$this->assertFalse(file_exists($generated_uri), t('Generated file does not exist.'));
@ -1122,10 +1115,9 @@ class ImageDimensionsUnitTest extends DrupalWebTestCase {
'degrees' => 57,
'random' => FALSE,
),
'isid' => $style['isid'],
);
$effect = image_effect_save($effect);
$effect = image_effect_save('test', $effect);
$img_tag = theme_image_style($variables);
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . $url . '" alt="" />', t('Expected img tag was found.'));
$this->assertFalse(file_exists($generated_uri), t('Generated file does not exist.'));
@ -1140,10 +1132,9 @@ class ImageDimensionsUnitTest extends DrupalWebTestCase {
$effect = array(
'name' => 'image_module_test_null',
'data' => array(),
'isid' => $style['isid'],
);
image_effect_save($effect);
image_effect_save('test', $effect);
$img_tag = theme_image_style($variables);
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . $url . '" alt="" />', t('Expected img tag was found.'));
}