Tests that custom and overridden image styles have been upgraded.
public function testImageStyleUpgrade() {
$this
->assertTrue($this
->performUpgrade(), 'The upgrade was completed successfully.');
// Verify that image styles were properly upgraded.
$expected_styles['test-custom'] = array(
'name' => 'test-custom',
'effects' => array(
'image_rotate' => array(
'name' => 'image_rotate',
'data' => array(
'degrees' => '90',
'bgcolor' => '#FFFFFF',
'random' => '1',
),
'weight' => '1',
),
'image_desaturate' => array(
'name' => 'image_desaturate',
'data' => array(),
'weight' => '2',
),
),
);
$expected_styles['thumbnail'] = array(
'name' => 'thumbnail',
'effects' => array(
'image_scale' => array(
'name' => 'image_scale',
'data' => array(
'width' => '177',
'height' => '177',
'upscale' => '0',
),
'weight' => '0',
),
),
);
foreach ($expected_styles as $name => $style) {
$config = config('image.style.' . $name);
// Replace placeholder with image effect name keys with UUID's generated
// during by the image style upgrade functions.
foreach ($config
->get('effects') as $uuid => $effect) {
// Copy placeholder data.
$style['effects'][$uuid] = $style['effects'][$effect['name']];
// Set the missing ieid key as this is unknown because it is a UUID.
$style['effects'][$uuid]['ieid'] = $uuid;
// Remove the placeholder data.
unset($style['effects'][$effect['name']]);
}
$this
->assertEqual($this
->sortByKey($style), $config
->get(), format_string('@first is equal to @second.', array(
'@first' => var_export($this
->sortByKey($style), TRUE),
'@second' => var_export($config
->get(), TRUE),
)));
}
}