diff --git a/core/modules/system/system.info b/core/modules/system/system.info index 41495f3..29a9c00 100644 --- a/core/modules/system/system.info +++ b/core/modules/system/system.info @@ -42,4 +42,6 @@ files[] = tests/xmlrpc.test files[] = tests/upgrade/upgrade.test files[] = tests/upgrade/upgrade_bare.test files[] = tests/upgrade/upgrade_filled.test +files[] = tests/upgrade/upgrade.image.test files[] = tests/upgrade/upgrade.language.test +files[] = tests/upgrade/upgrade.system.test diff --git a/core/modules/system/tests/upgrade/drupal-7.image.database.php b/core/modules/system/tests/upgrade/drupal-7.image.database.php new file mode 100644 index 0000000..9a5dc7f --- /dev/null +++ b/core/modules/system/tests/upgrade/drupal-7.image.database.php @@ -0,0 +1,66 @@ +fields(array( + 'ieid', + 'isid', + 'weight', + 'name', + 'data', +)) +->values(array( + 'ieid' => '1', + 'isid' => '1', + 'weight' => '0', + 'name' => 'image_scale', + 'data' => 'a:3:{s:5:"width";s:3:"177";s:6:"height";s:3:"177";s:7:"upscale";i:0;}', +)) +->values(array( + 'ieid' => '2', + 'isid' => '1', + 'weight' => '2', + 'name' => 'image_desaturate', + 'data' => 'a:0:{}', +)) +->values(array( + 'ieid' => '3', + 'isid' => '2', + 'weight' => '1', + 'name' => 'image_rotate', + 'data' => 'a:3:{s:7:"degrees";s:2:"90";s:7:"bgcolor";s:7:"#FFFFFF";s:6:"random";i:1;}', +)) +->values(array( + 'ieid' => '4', + 'isid' => '2', + 'weight' => '2', + 'name' => 'image_desaturate', + 'data' => 'a:0:{}', +)) +->execute(); + +// Add image styles. +db_insert('image_styles')->fields(array( + 'isid', + 'name', +)) +// Custom style. +->values(array( + 'isid' => '2', + 'name' => 'test-custom', +)) +// Override thumbnail style. +->values(array( + 'isid' => '1', + 'name' => 'thumbnail', +)) +->execute(); diff --git a/core/modules/system/tests/upgrade/drupal-7.system.database.php b/core/modules/system/tests/upgrade/drupal-7.system.database.php new file mode 100644 index 0000000..e3d0fb4 --- /dev/null +++ b/core/modules/system/tests/upgrade/drupal-7.system.database.php @@ -0,0 +1,42 @@ +fields(array( + 'name', + 'value', +)) +->values(array( + 'name' => 'cache', + 'value'=> 'i:1;', +)) +->values(array( + 'name' => 'cache_lifetime', + 'value' => 's:5:"10800";', + )) +->values(array( + 'name' => 'page_cache_maximum_age', + 'value' => 's:4:"1800";', + )) +->values(array( + 'name' => 'page_compression', + 'value' => 'i:1;', + )) +->values(array( + 'name' => 'preprocess_css', + 'value' => 'i:1;', + )) +->values(array( + 'name' => 'preprocess_js', + 'value' => 'i:1;', + )) +->execute(); \ No newline at end of file diff --git a/core/modules/system/tests/upgrade/upgrade.image.test b/core/modules/system/tests/upgrade/upgrade.image.test new file mode 100644 index 0000000..2a784fe --- /dev/null +++ b/core/modules/system/tests/upgrade/upgrade.image.test @@ -0,0 +1,35 @@ + 'Image upgrade test', + 'description' => 'Upgrade tests for overridden and custom image styles.', + 'group' => 'Upgrade path', + ); + } + + public function setUp() { + // Path to the database dump files. + $path = drupal_get_path('module', 'system') . '/tests/upgrade'; + $this->databaseDumpFiles = array( + $path . '/drupal-7.bare.database.php.gz', + $path . '/drupal-7.image.database.php', + ); + parent::setUp(); + } + + /** + * Tests that custom and overridden image styles have been upgraded. + */ + public function testImageStyleUpgrade() { + $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.'); + } +} \ No newline at end of file diff --git a/core/modules/system/tests/upgrade/upgrade.system.test b/core/modules/system/tests/upgrade/upgrade.system.test new file mode 100644 index 0000000..d621067 --- /dev/null +++ b/core/modules/system/tests/upgrade/upgrade.system.test @@ -0,0 +1,54 @@ + 'System upgrade test', + 'description' => 'Upgrade tests for non-default values of system variables.', + 'group' => 'Upgrade path', + ); + } + + public function setUp() { + // Path to the database dump files. + $path = drupal_get_path('module', 'system') . '/tests/upgrade'; + $this->databaseDumpFiles = array( + $path . '/drupal-7.bare.database.php.gz', + $path . '/drupal-7.system.database.php', + ); + parent::setUp(); + } + + /** + * Tests that custom and overridden image styles have been upgraded. + */ + public function testSystemVariableUpgrade() { + $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.'); + + // Test that the overridden values were properly converted. + $overrides = array( + 'system.performance' => array( + 'cache' => 1, + 'cache_lifetime' => '10800', + 'page_cache_maximum_age' => '1800', + 'page_compression' => 1, + 'preprocess_css' => 1, + 'preprocess_js' => 1, + ), + ); + foreach ($overrides as $file => $values) { + $config = config($file); + foreach ($values as $name => $value) { + $stored = $config->get($name); + $this->assertEqual($value, $stored, t('Stored value %stored for %name matches old value %value.', array('%stored' => $stored, '%name' => $name, '%value' => $value))); + } + } + } +} \ No newline at end of file