diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/UserPictureUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/UserPictureUpgradePathTest.php new file mode 100644 index 0000000..68bb384 --- /dev/null +++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/UserPictureUpgradePathTest.php @@ -0,0 +1,49 @@ + 'User picture upgrade test', + 'description' => 'Upgrade tests with user picture data.', + 'group' => 'Upgrade path', + ); + } + + public function setUp() { + $path = drupal_get_path('module', 'system') . '/tests/upgrade'; + $this->databaseDumpFiles = array( + $path . '/drupal-7.bare.standard_all.database.php.gz', + $path . '/drupal-7.user_picture.database.php', + ); + parent::setUp(); + } + + /** + * Tests expected user picture conversions after a successful upgrade. + */ + public function testUserPictureUpgrade() { + $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.'); + + // Retrieve the field instance and check for migrated settings. + $instance = field_info_instance('user', 'user_picture', 'user'); + $this->assertEqual($instance['settings']['default_image'], 'http://drupal.org/files/druplicon.small_.png', 'Default user picture has been migrated.'); + $this->assertEqual($instance['settings']['max_resolution'], '800x800', 'User picture maximum resolution has been migrated.'); + $this->assertEqual($instance['settings']['max_filesize'], '700 KB', 'User picture maximum filesize has been migrated.'); + $this->assertEqual($instance['description'], 'These are user picture guidelines.', 'User picture guidelines are now the user picture field description.'); + $this->assertEqual($instance['settings']['file_directory'], 'user_pictures_dir', 'User picture directory path has been migrated.'); + $this->assertEqual($instance['display']['default']['settings']['image_style'], 'medium', 'User picture image style setting has been migrated.'); + } +} diff --git a/core/modules/system/tests/upgrade/drupal-7.user_picture.database.php b/core/modules/system/tests/upgrade/drupal-7.user_picture.database.php new file mode 100644 index 0000000..2b9e22c --- /dev/null +++ b/core/modules/system/tests/upgrade/drupal-7.user_picture.database.php @@ -0,0 +1,59 @@ +condition('name', $deleted_variables, 'IN') + ->execute(); + +db_insert('variable')->fields(array( + 'name', + 'value', +)) +->values(array( + 'name' => 'user_pictures', + 'value' => 'i:1;', +)) +->values(array( + 'name' => 'user_picture_default', + 'value' => 's:44:"http://drupal.org/files/druplicon.small_.png";', +)) +->values(array( + 'name' => 'user_picture_dimensions', + 'value' => 's:7:"800x800";', +)) +->values(array( + 'name' => 'user_picture_file_size', + 'value' => 's:3:"700";', +)) +->values(array( + 'name' => 'user_picture_guidelines', + 'value' => 's:34:"These are user picture guidelines.";', +)) +->values(array( + 'name' => 'user_picture_path', + 'value' => 's:17:"user_pictures_dir";', +)) +->values(array( + 'name' => 'user_picture_style', + 'value' => 's:6:"medium";', +)) +->execute();