summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2013-11-15 11:40:44 (GMT)
committerNathaniel Catchpole2013-11-15 11:40:44 (GMT)
commit115b40c9f883e6c292c837b121074011a83743aa (patch)
tree64702f2986a1f3ee5b1b8cc0bfd8526382b8c2cb
parent217d9713e6ad05a7445387fdf3a120df2cc9e70e (diff)
Issue #2134951 by xjm: Remove upgrade path tests.
-rw-r--r--core/modules/contact/lib/Drupal/contact/Tests/ContactUpgradePathTest.php69
-rw-r--r--core/modules/rdf/lib/Drupal/rdf/Tests/RdfMappingUpgradePathTest.php122
-rw-r--r--core/modules/search/lib/Drupal/search/Tests/SearchUpgradePathTest.php49
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/ActionUpgradePathTest.php42
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/BareMinimalAnonymousUpgradePathTest.php58
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/BareMinimalNoConfigUpgradePathTest.php79
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/BareMinimalUpgradePathTest.php103
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/BareStandardUpgradePathTest.php90
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/BlockUpgradePathTest.php65
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/CommentUpgradePathTest.php119
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/DateUpgradePathTest.php100
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/ExistingModuleNameLengthUpgradePathTest.php48
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/FieldUIUpgradePathTest.php76
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/FieldUpgradePathTest.php294
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/FilledMinimalUpgradePathTest.php83
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/FilledStandardUpgradePathTest.php136
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/FilterFormatUpgradePathTest.php93
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/ForumUpgradePathTest.php56
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/ImageUpgradePathTest.php185
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/LanguageUpgradePathTest.php196
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/MailUpgradePathTest.php55
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/ModuleNameLengthUpgradePathTest.php57
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/ModulesDisabledUpgradePathTest.php54
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/ShortcutUpgradePathTest.php55
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/StateSystemUpgradePathTest.php89
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/SystemUpgradePathTest.php195
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php387
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/UserPermissionUpgradePathTest.php64
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/UserPictureUpgradePathTest.php80
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/UserRoleUpgradePathTest.php93
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Upgrade/UuidUpgradePathTest.php62
-rw-r--r--core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyUpgradePathTest.php52
32 files changed, 0 insertions, 3306 deletions
diff --git a/core/modules/contact/lib/Drupal/contact/Tests/ContactUpgradePathTest.php b/core/modules/contact/lib/Drupal/contact/Tests/ContactUpgradePathTest.php
deleted file mode 100644
index b5785aa..0000000
--- a/core/modules/contact/lib/Drupal/contact/Tests/ContactUpgradePathTest.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\contact\Tests\ContactUpgradePathTest.
- */
-
-namespace Drupal\contact\Tests;
-
-use Drupal\system\Tests\Upgrade\UpgradePathTestBase;
-
-/**
- * Tests upgrade of contact.
- */
-class ContactUpgradePathTest extends UpgradePathTestBase {
- public static function getInfo() {
- return array(
- 'name' => 'Contact upgrade test',
- 'description' => 'Tests upgrade of contact to the configuration system.',
- 'group' => 'Contact',
- );
- }
-
- public function setUp() {
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.standard_all.database.php.gz',
- drupal_get_path('module', 'contact') . '/tests/drupal-7.contact.database.php',
- );
- parent::setUp();
- }
-
- /**
- * Tests upgrade of contact table to configuration entities.
- */
- public function testContactUpgrade() {
- $default_contact_category = db_query('SELECT cid FROM {contact} WHERE selected = 1')->fetchField();
-
- $this->assertTrue(db_table_exists('contact'), 'Contact table exists.');
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- // Test that the contact form is available.
- $this->assertFalse(db_table_exists('contact'), 'Contact table has been deleted.');
- $this->drupalGet('contact');
- $this->assertText(t('Your e-mail address'));
-
- // Ensure that the Drupal 7 default contact category has been created.
- $contact_category = entity_load('contact_category', '1');
- $this->assertTrue(isset($contact_category->uuid), 'Converted contact category has a UUID');
- $this->assertEqual($contact_category->label, 'Website feedback');
- $this->assertEqual($contact_category->reply, '');
- $this->assertEqual($contact_category->weight, 0);
- $this->assertEqual($contact_category->recipients, array('admin@example.com'));
-
- // Test that the custom contact category has been updated.
- $contact_category = entity_load('contact_category', '2');
- $this->assertTrue(isset($contact_category->uuid), 'Converted contact category has a UUID');
- $this->assertEqual($contact_category->label, 'Upgrade test');
- $this->assertEqual($contact_category->reply, 'Test reply');
- $this->assertEqual($contact_category->weight, 1);
- $this->assertEqual($contact_category->recipients, array('test1@example.com', 'test2@example.com'));
-
- // Ensure that the default category has been maintained.
- $this->assertEqual(\Drupal::config('contact.settings')->get('default_category'), $default_contact_category, 'Default category upgraded.');
-
- // Check that no default config imported on upgrade.
- $this->assertFalse(entity_load('contact_category', 'feedback'));
- }
-}
-
diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/RdfMappingUpgradePathTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/RdfMappingUpgradePathTest.php
deleted file mode 100644
index bb8f491..0000000
--- a/core/modules/rdf/lib/Drupal/rdf/Tests/RdfMappingUpgradePathTest.php
+++ /dev/null
@@ -1,122 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\rdf\Tests\RdfMappingUpgradePathTest.
- */
-
-namespace Drupal\rdf\Tests;
-
-use Drupal\system\Tests\Upgrade\UpgradePathTestBase;
-
-/**
- * Tests the upgrade path of RDF mappings.
- */
-class RdfMappingUpgradePathTest extends UpgradePathTestBase {
-
- public static function getInfo() {
- return array(
- 'name' => 'RDF mapping upgrade test',
- 'description' => 'Upgrade tests with RDF mapping data.',
- 'group' => 'RDF',
- );
- }
-
- public function setUp() {
- // Path to the database dump files.
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.standard_all.database.php.gz',
- drupal_get_path('module', 'rdf') . '/tests/drupal-7.rdf.database.php',
- );
- parent::setUp();
- }
-
- /**
- * Tests to see if RDF mappings were upgraded.
- */
- public function testRdfMappingUpgrade() {
- $this->assertTrue(db_table_exists('rdf_mapping'), 'RDF mapping table exists.');
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- $this->_testUnalteredMappingUpgrade();
- $this->_testAlteredMappingUpgrade();
- $this->_testReverseRelationUpgrade();
-
- }
-
- /**
- * Helper function to test upgrade of unaltered mappings.
- */
- protected function _testUnalteredMappingUpgrade() {
- $config = rdf_get_mapping('node', 'page');
-
- // Test bundle mapping.
- $mapping = $config->getBundleMapping();
- $expected_mapping = array(
- 'types' => array('foaf:Document'),
- );
- $this->assertEqual($mapping, $expected_mapping, 'Unaltered bundle mapping upgraded correctly.');
-
- // Test field mapping - property.
- $mapping = $config->getFieldMapping('title');
- $expected_mapping = array(
- 'properties' => array('dc:title'),
- );
- $this->assertEqual($mapping, $expected_mapping, 'Unaltered field mapping upgraded correctly.');
-
- // Test field mapping - property with datatype and callback.
- $mapping = $config->getFieldMapping('created');
- $expected_mapping = array(
- 'properties' => array('dc:date', 'dc:created'),
- 'datatype' => 'xsd:dateTime',
- 'datatype_callback' => array('callable' => 'date_iso8601'),
- );
- $this->assertEqual($mapping, $expected_mapping, 'Unaltered field mapping with datatype and datatype callback upgraded correctly.');
-
- // Test field mapping - rel.
- $mapping = $config->getFieldMapping('uid');
- $expected_mapping = array(
- 'properties' => array('sioc:has_creator'),
- 'mapping_type' => 'rel',
- );
- $this->assertEqual($mapping, $expected_mapping, 'Unaltered field mapping with rel mapping type upgraded correctly.');
- }
-
- /**
- * Helper function to test upgrade of altered mappings.
- */
- protected function _testAlteredMappingUpgrade() {
- $config = rdf_get_mapping('node', 'article');
-
- // Test bundle mapping.
- $mapping = $config->getBundleMapping();
- $expected_mapping = array(
- 'types' => array('foo:Type'),
- );
- $this->assertEqual($mapping, $expected_mapping, 'Overriden bundle mapping upgraded correctly.');
-
- // Test field mapping.
- $mapping = $config->getFieldMapping('field_image');
- $expected_mapping = array(
- 'properties' => array('foo:image'),
- );
- $this->assertEqual($expected_mapping, $mapping, 'Overriden field mapping is upgraded correctly.');
-
- // Test field mapping.
- $mapping = $config->getFieldMapping('changed');
- $expected_mapping = array();
- $this->assertEqual($expected_mapping, $mapping, 'Empty field mapping from overriden mapping is upgraded correctly.');
- }
-
- /**
- * Helper function to test handling of deprecated reverse relation mappings.
- */
- protected function _testReverseRelationUpgrade() {
- // Test field mapping - rev.
- $config = rdf_get_mapping('node', 'rev_test');
- $mapping = $config->getFieldMapping('field_rev');
- $expected_mapping = array();
- $this->assertEqual($mapping, $expected_mapping, 'Reverse relation mapping has been dropped.');
- }
-
-}
diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchUpgradePathTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchUpgradePathTest.php
deleted file mode 100644
index e5678bc..0000000
--- a/core/modules/search/lib/Drupal/search/Tests/SearchUpgradePathTest.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\search\Tests\SearchUpgradePathTest.
- */
-
-namespace Drupal\search\Tests;
-
-use Drupal\system\Tests\Upgrade\UpgradePathTestBase;
-
-/**
- * Tests the upgrade path of search configuration and tables.
- */
-class SearchUpgradePathTest extends UpgradePathTestBase {
-
- public static function getInfo() {
- return array(
- 'name' => 'Search module upgrade test',
- 'description' => 'Upgrade tests for search module configuration and tables.',
- 'group' => 'Search',
- );
- }
-
- public function setUp() {
- // Path to the database dump files.
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.standard_all.database.php.gz',
- drupal_get_path('module', 'search') . '/tests/upgrade/drupal-7.search.database.php',
- );
- parent::setUp();
- }
-
- /**
- * Tests to see if search configuration and tables were upgraded.
- */
- public function testSearchUpgrade() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
- $this->assertFalse(db_table_exists('search_node_links'), 'search_node_links table was dropped.');
- $config = \Drupal::config('search.settings');
- // The starting database has user module as the only active search.
- $this->assertEqual($config->get('active_plugins'), array('user_search' => 'user_search'));
- $exists = db_query('SELECT 1 FROM {variable} WHERE name = :name', array(':name' => 'search_active_modules'))->fetchField();
- $this->assertFalse($exists, 'The search_active_modules variable was deleted by the update');
- // The starting database has user module as the default.
- $this->assertEqual($config->get('default_plugin'), 'user_search');
- }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/ActionUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/ActionUpgradePathTest.php
deleted file mode 100644
index 33da11b..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/ActionUpgradePathTest.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\Tests\Upgrade\ActionUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-/**
- * Tests the upgrade path of actions.
- */
-class ActionUpgradePathTest extends UpgradePathTestBase {
-
- public static function getInfo() {
- return array(
- 'name' => 'Action upgrade test',
- 'description' => 'Upgrade tests with action data.',
- 'group' => 'Upgrade path',
- );
- }
-
- public function setUp() {
- // Path to the database dump files.
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.minimal.database.php.gz',
- );
- parent::setUp();
- }
-
- /**
- * Tests to see if actions were upgrade.
- */
- public function testActionUpgrade() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- $this->drupalGet('admin/people');
- $elements = $this->xpath('//select[@name="action"]/option');
- $this->assertTrue(!empty($elements), 'The user actions were upgraded.');
- }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/BareMinimalAnonymousUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/BareMinimalAnonymousUpgradePathTest.php
deleted file mode 100644
index 947625b..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/BareMinimalAnonymousUpgradePathTest.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\Tests\Upgrade\BareMinimalAnonymousUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-/**
- * Tests the upgrade path without prior creation of config directions.
- */
-class BareMinimalAnonymousUpgradePathTest extends BareMinimalUpgradePathTest {
-
- public static function getInfo() {
- return array(
- 'name' => 'Basic minimal profile upgrade, free access',
- 'description' => 'Basic upgrade path tests for a minimal profile install with a bare database and update_free_access set to TRUE.',
- 'group' => 'Upgrade path',
- );
- }
-
- /**
- * Overrides \Drupal\system\Tests\Upgrade\UpgradePathTestBase::setUp().
- */
- public function setUp() {
- parent::setUp();
-
- // Override $update_free_access in settings.php to allow the anonymous user
- // to run updates.
- $settings['settings'] = array(
- 'update_free_access' => (object) array(
- 'value' => TRUE,
- 'required' => TRUE,
- ),
- 'install_profile' => (object) array(
- 'value' => $this->profile,
- 'required' => TRUE,
- ),
- );
- $this->writeSettings($settings);
- }
-
- /**
- * Overrides \Drupal\system\Tests\Upgrade\UpgradePathTestBase::prepareD8Session().
- */
- protected function prepareD8Session() {
- // There is no active session, so nothing needs to be done here.
- }
-
- /**
- * Overrides \Drupal\system\Tests\Upgrade\UpgradePathTestBase::assertSessionKept().
- */
- protected function finishUpgradeSession() {
- // There is no active session, so nothing needs to be done here.
- }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/BareMinimalNoConfigUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/BareMinimalNoConfigUpgradePathTest.php
deleted file mode 100644
index e5858fc..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/BareMinimalNoConfigUpgradePathTest.php
+++ /dev/null
@@ -1,79 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\Tests\Upgrade\BareMinimalNoConfigUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-/**
- * Tests the database upgrade path without creating config directories.
- */
-class BareMinimalNoConfigUpgradePathTest extends BareMinimalUpgradePathTest {
-
- /**
- * The installation profile used in the upgrade test.
- */
- protected $profile = 'minimal';
-
- public static function getInfo() {
- return array(
- 'name' => 'Basic minimal profile upgrade, no config',
- 'description' => 'Basic upgrade path tests for a minimal profile install with a bare database and config directory not pre-created.',
- 'group' => 'Upgrade path',
- );
- }
-
- /**
- * Overrides \Drupal\system\Tests\Upgrade\UpgradePathTestBase::setUp().
- */
- public function setUp() {
- parent::setUp();
-
- // Override $conf_path and $config_directories in settings.php.
- $settings['conf_path'] = (object) array(
- 'value' => $this->public_files_directory,
- 'required' => TRUE,
- );
- $settings['config_directories'] = (object) array(
- 'value' => array(),
- 'required' => TRUE,
- );
- $settings['settings'] = array(
- 'install_profile' => (object) array(
- 'value' => $this->profile,
- 'required' => TRUE,
- ),
- );
- $this->writeSettings($settings);
- }
-
- /**
- * Overrides \Drupal\system\Tests\Upgrade\UpgradePathTestBase::refreshVariables().
- */
- protected function refreshVariables() {
- // Refresh the variables only if the site was already upgraded.
- if ($this->upgradedSite) {
- // update.php puts the new, randomized config directries in this file.
- include $this->public_files_directory . '/settings.php';
- $GLOBALS['config_directories'] = array();
- foreach ($config_directories as $type => $data) {
- // update.php runs as the child site, so writes the paths relative to
- // that "$conf_path/files", but here, we're running as the parent site,
- // so need to make the paths relative to our "conf_path()/files".
- //
- // Example:
- // - Parent site conf_path(): 'sites/default'
- // - Child site $conf_path: 'sites/default/files/simpletest/123456'
- // - Child site $data['path']: 'config_xyz'
- // - Desired result: 'simpletest/123456/files/config_xyz'
- //
- // @see config_get_config_directory()
- $GLOBALS['config_directories'][$type]['path'] = substr($conf_path, strlen(conf_path() . '/files/')) . '/files/' . $data['path'];
- }
- parent::refreshVariables();
- }
- }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/BareMinimalUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/BareMinimalUpgradePathTest.php
deleted file mode 100644
index 914b72d..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/BareMinimalUpgradePathTest.php
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\Tests\Upgrade\BareMinimalUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-use Drupal\Core\Session\UserSession;
-
-/**
- * Performs major version release upgrade tests on a bare database.
- *
- * Loads an installation of Drupal 7.x and runs the upgrade process on it.
- *
- * The install contains the minimal profile modules (without any generated
- * content) so that an upgrade from of a site under this profile may be tested.
- */
-class BareMinimalUpgradePathTest extends UpgradePathTestBase {
-
- public static function getInfo() {
- return array(
- 'name' => 'Basic minimal profile upgrade path, bare database',
- 'description' => 'Basic upgrade path tests for a minimal profile install with a bare database.',
- 'group' => 'Upgrade path',
- );
- }
-
- public function setUp() {
- // Path to the database dump files.
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.minimal.database.php.gz',
- );
- parent::setUp();
- }
-
- /**
- * Tests a successful major version release upgrade.
- */
- public function testBasicMinimalUpgrade() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- // Hit the frontpage.
- $this->drupalGet('');
- $this->assertResponse(200);
-
- // Verify that we are still logged in.
- $this->finishUpgradeSession();
- $user = new UserSession(array(
- 'uid' => 1,
- 'name' => 'admin',
- 'pass_raw' => 'drupal',
- ));
- $this->drupalLogin($user);
-
- // The previous login should've triggered a password rehash, so login one
- // more time to make sure the new hash is readable.
- $this->drupalLogout();
- $this->drupalLogin($user);
-
- // Test that the site name is correctly displayed.
- $this->assertText('drupal', 'The site name is correctly displayed.');
-
- // Verify that the main admin sections are available.
- $this->drupalGet('admin');
- $this->assertText(t('Content'));
- $this->assertText(t('Appearance'));
- $this->assertText(t('People'));
- $this->assertText(t('Configuration'));
- $this->assertText(t('Reports'));
- $this->assertText(t('Structure'));
- $this->assertText(t('Extend'));
-
- // Confirm that no {menu_links} entry exists for user/autocomplete.
- $result = db_query('SELECT COUNT(*) FROM {menu_links} WHERE link_path = :user_autocomplete', array(':user_autocomplete' => 'user/autocomplete'))->fetchField();
- $this->assertFalse($result, 'No {menu_links} entry exists for user/autocomplete');
-
- // Verify that all required modules are enabled.
- $enabled = $this->container->get('module_handler')->getModuleList();
- $required = array_filter(system_rebuild_module_data(), function ($data) {
- return !empty($data->info['required']);
- });
- $this->assertEqual(array_diff_key($required, $enabled), array());
-
- // Verify that image.module was correctly installed.
- $this->assertEqual('thumbnail', \Drupal::config('image.style.thumbnail')->get('name'));
-
- // Make sure that the default mail configuration has been converted.
- $this->assertEqual(array('default' => 'Drupal\Core\Mail\PhpMail'), \Drupal::config('system.mail')->get('interface'), 'Default mail configuration set.');
- }
-
- /**
- * Asserts that the session was kept during update. Also, log out.
- */
- protected function finishUpgradeSession() {
- $this->drupalGet('user');
- $this->clickLink(t('Edit'));
- $this->assertEqual($this->getUrl(), url('user/1/edit', array('absolute' => TRUE)), 'We are still logged in as admin at the end of the upgrade.');
- $this->drupalLogout();
- }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/BareStandardUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/BareStandardUpgradePathTest.php
deleted file mode 100644
index 37ad031..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/BareStandardUpgradePathTest.php
+++ /dev/null
@@ -1,90 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\system\Tests\Upgrade\BareStandardUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-use Drupal\Core\Session\UserSession;
-
-/**
- * Performs major version release upgrade tests on a bare database.
- *
- * Loads an installation of Drupal 7.x and runs the upgrade process on it.
- *
- * The install contains the standard profile (plus all optional) modules
- * without any content so that an update from any of the modules under this
- * profile installation can be wholly tested.
- */
-class BareStandardUpgradePathTest extends UpgradePathTestBase {
- public static function getInfo() {
- return array(
- 'name' => 'Basic standard + all profile upgrade path, bare database',
- 'description' => 'Basic upgrade path tests for a standard profile install with all enabled modules and a bare database.',
- 'group' => 'Upgrade path',
- );
- }
-
- public function setUp() {
- // Path to the database dump files.
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.standard_all.database.php.gz',
- );
- parent::setUp();
- }
-
- /**
- * Tests a successful major version release upgrade.
- */
- public function testBasicStandardUpgrade() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- // Hit the frontpage.
- $this->drupalGet('');
- $this->assertResponse(200);
-
- // Verify that we are still logged in.
- $this->drupalGet('user');
- $this->clickLink(t('Edit'));
- $this->assertEqual($this->getUrl(), url('user/1/edit', array('absolute' => TRUE)), 'We are still logged in as admin at the end of the upgrade.');
-
- // Logout and verify that we can login back in with our initial password.
- $this->drupalLogout();
- $user = new UserSession(array(
- 'uid' => 1,
- 'name' => 'admin',
- 'pass_raw' => 'drupal',
- ));
- $this->drupalLogin($user);
-
- // The previous login should've triggered a password rehash, so login one
- // more time to make sure the new hash is readable.
- $this->drupalLogout();
- $this->drupalLogin($user);
-
- // Test that the site name is correctly displayed.
- $this->assertText('drupal', 'The site name is correctly displayed.');
-
- // Verify that the main admin sections are available.
- $this->drupalGet('admin');
- $this->assertText(t('Content'));
- $this->assertText(t('Appearance'));
- $this->assertText(t('People'));
- $this->assertText(t('Configuration'));
- $this->assertText(t('Reports'));
- $this->assertText(t('Structure'));
- $this->assertText(t('Extend'));
-
- // Confirm that no {menu_links} entry exists for user/autocomplete.
- $result = db_query('SELECT COUNT(*) FROM {menu_links} WHERE link_path = :user_autocomplete', array(':user_autocomplete' => 'user/autocomplete'))->fetchField();
- $this->assertFalse($result, 'No {menu_links} entry exists for user/autocomplete');
-
- // Verify that the blog node type has been assigned to node module.
- $blog_type = node_type_load('blog');
- $this->assertEqual($blog_type->module, 'node', "Content type 'blog' has been reassigned from the blog module to the node module.");
- $this->assertEqual($blog_type->base, 'node_content', "The base string used to construct callbacks corresponding to content type 'Blog' has been reassigned to 'node_content'.");
-
- }
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/BlockUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/BlockUpgradePathTest.php
deleted file mode 100644
index e1bb4b1..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/BlockUpgradePathTest.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\system\Tests\Upgrade\BlockUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-/**
- * Tests upgrading a bare database.
- *
- * Loads a bare installation of Drupal 7 and runs the upgrade process on it.
- */
-class BlockUpgradePathTest extends UpgradePathTestBase {
-
- public static function getInfo() {
- return array(
- 'name' => 'Block upgrade test',
- 'description' => 'Upgrade tests with block data.',
- 'group' => 'Upgrade path',
- );
- }
-
- public function setUp() {
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.minimal.database.php.gz',
- );
- parent::setUp();
- }
-
- /**
- * Tests block title length after successful upgrade.
- */
- public function testBlockUpgradeTitleLength() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- // WebTestBase::drupalPlaceBlock() uses the API directly, which doesn't
- // output validation errors or success messages, so create the blocks from
- // the UI.
-
- // Add a block instance with a 255-character title.
- // Confirm that the custom block has been created, and title matches input.
- $settings = array(
- 'settings[label]' => $this->randomName(255),
- 'id' => strtolower($this->randomName(8)),
- 'region' => 'sidebar_first',
- );
- $this->drupalPostForm('admin/structure/block/add/system_powered_by_block/' . \Drupal::config('system.theme')->get('default'), $settings, t('Save block'));
- $this->assertText($settings['settings[label]'], 'Block with title longer than 64 characters successfully created.');
-
- // Try to add a block with a title over 255 characters.
- $settings = array(
- 'settings[label]' => $this->randomName(256),
- 'id' => strtolower($this->randomName(8)),
- 'region' => 'sidebar_first',
- );
- $this->drupalPostForm('admin/structure/block/add/system_powered_by_block/' . \Drupal::config('system.theme')->get('default'), $settings, t('Save block'));
-
- // Confirm that the custom block cannot be created with title longer than
- // the maximum number of characters.
- $this->assertText('Title cannot be longer than 255 characters');
- }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/CommentUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/CommentUpgradePathTest.php
deleted file mode 100644
index 1588d6d..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/CommentUpgradePathTest.php
+++ /dev/null
@@ -1,119 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\system\Tests\Upgrade\CommentUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-use Drupal\field\Field;
-
-/**
- * Tests upgrading a filled database with comment data.
- *
- * Loads a filled installation of Drupal 7 with comment data and runs the
- * upgrade process on it.
- */
-class CommentUpgradePathTest extends UpgradePathTestBase {
- public static function getInfo() {
- return array(
- 'name' => 'Comment upgrade test',
- 'description' => 'Upgrade tests with comment data.',
- 'group' => 'Upgrade path',
- );
- }
-
- public function setUp() {
- // Path to the database dump files.
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.filled.standard_all.database.php.gz',
- // Language dataset includes nodes with comments so can be reused.
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.language.database.php',
- // Comment dataset sets some settings to values other than the default.
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.comment.database.php',
- );
- parent::setUp();
- }
-
- /**
- * Tests a successful upgrade.
- */
- public function testCommentUpgrade() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- // Check that comments display on the node.
- $this->drupalGet('node/50');
- $this->assertText('Node title 50', 'Node 50 displayed after update.');
- $this->assertText('First test comment', 'Comment 1 displayed after update.');
- $this->assertText('Reply to first test comment', 'Comment 2 displayed after update.');
-
- $expected_settings = array(
- 'article' => array (
- 'default_mode' => 1,
- 'per_page' => 50,
- 'form_location' => 1,
- 'anonymous' => 0,
- 'subject' => 1,
- 'preview' => 1,
- ),
- 'blog' => array (
- 'default_mode' => 0,
- 'per_page' => 25,
- 'form_location' => 0,
- 'anonymous' => 1,
- 'subject' => 0,
- 'preview' => 0,
- ),
- 'book' => array (
- 'default_mode' => 1,
- 'per_page' => 50,
- 'form_location' => 1,
- 'anonymous' => 0,
- 'subject' => 1,
- 'preview' => 1,
- ),
- 'forum' => array (
- 'default_mode' => 1,
- 'per_page' => 50,
- 'form_location' => 1,
- 'anonymous' => 0,
- 'subject' => 1,
- 'preview' => 1,
- ),
- 'page' => array (
- 'default_mode' => 1,
- 'per_page' => 50,
- 'form_location' => 1,
- 'anonymous' => 0,
- 'subject' => 1,
- 'preview' => 1,
- ),
- // Poll module exists in Drupal 7 and hence will be present during an
- // upgrade.
- 'poll' => array (
- 'default_mode' => 1,
- 'per_page' => 50,
- 'form_location' => 1,
- 'anonymous' => 0,
- 'subject' => 1,
- 'preview' => 1,
- ),
- );
- // Check one instance exists for each node type.
- $types = node_type_get_types();
- $types = array_keys($types);
- sort($types);
- $this->assertIdentical(array_keys($expected_settings), $types, 'All node types are upgraded');
- foreach ($types as $type) {
- $instance = Field::fieldInfo()->getInstance('node', $type, 'comment_'. $type);
- $this->assertTrue($instance, format_string('Comment field found for the %type node type', array(
- '%type' => $type
- )));
- $this->assertIdentical($instance->settings, $expected_settings[$type], format_string('Comment field settings migrated for the %type node type', array(
- '%type' => $type,
- )));
- }
- }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/DateUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/DateUpgradePathTest.php
deleted file mode 100644
index 5e1dd58..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/DateUpgradePathTest.php
+++ /dev/null
@@ -1,100 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains Drupal\system\Tests\Upgrade\DateUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-/**
- * Test upgrade of date formats.
- */
-class DateUpgradePathTest extends UpgradePathTestBase {
- public static function getInfo() {
- return array(
- 'name' => 'Date upgrade test',
- 'description' => 'Upgrade tests for date formats.',
- 'group' => 'Upgrade path',
- );
- }
-
- public function setUp() {
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.standard_all.database.php.gz',
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.date.database.php',
- );
- parent::setUp();
- }
-
- /**
- * Tests that date formats have been upgraded.
- */
- public function testDateUpgrade() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- // Verify standard date formats.
- $expected_formats['short'] = array(
- 'name' => 'Short',
- 'pattern' => array(
- 'php' => 'm/d/Y - H:i',
- ),
- 'locked' => '1',
- );
- $expected_formats['medium'] = array(
- 'name' => 'Medium',
- 'pattern' => array(
- 'php' => 'D, m/d/Y - H:i',
- ),
- 'locked' => '1',
- );
- $expected_formats['long'] = array(
- 'name' => 'Long',
- 'pattern' => array(
- 'php' => 'l, j F, Y - H:i',
- ),
- 'locked' => '1',
- );
-
- // Verify custom date format.
- $expected_formats['test_custom'] = array(
- 'name' => 'Test Custom',
- 'pattern' => array(
- 'php' => 'd m Y',
- ),
- 'locked' => '0',
- );
-
- $actual_formats = entity_load_multiple('date_format', array_keys($expected_formats));
- foreach ($expected_formats as $type => $format) {
- $format_info = $actual_formats[$type];
- $this->assertEqual($format_info->label(), $format['name'], format_string('Config value for @type name is the same', array('@type' => $type)));
- $this->assertEqual($format_info->get('locked'), $format['locked'], format_string('Config value for @type locked is the same', array('@type' => $type)));
- $this->assertEqual($format_info->getPattern(), $format['pattern']['php'], format_string('Config value for @type PHP date pattern is the same', array('@type' => $type)));
-
- // Make sure that the variable was deleted.
- $this->assertNull(update_variable_get('date_format_' . $type), format_string('Date format variable for @type was deleted.', array('@type' => $type)));
- }
-
- $expected_de_formats = array(
- array(
- 'type' => 'long',
- 'format' => 'l, j. F, Y - H:i',
- ),
- array(
- 'type' => 'medium',
- 'format' => 'D, d/m/Y - H:i',
- ),
- array(
- 'type' => 'short',
- 'format' => 'd/m/Y - H:i',
- ),
- );
-
- foreach ($expected_de_formats as $locale_format) {
- $format = \Drupal::config('locale.config.de.system.date_format.' . $locale_format['type'])->get('pattern.php');
- $this->assertEqual($locale_format['format'], $format);
- }
- }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/ExistingModuleNameLengthUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/ExistingModuleNameLengthUpgradePathTest.php
deleted file mode 100644
index fc9d0e6..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/ExistingModuleNameLengthUpgradePathTest.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\Tests\Upgrade\ExistingModuleNameLengthUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-use Drupal\Core\Database\DatabaseExceptionWrapper;
-
-/**
- * Performs upgrade path tests for module name length related changes.
- */
-class ExistingModuleNameLengthUpgradePathTest extends UpgradePathTestBase {
-
- public static function getInfo() {
- return array(
- 'name' => 'Module name length upgrade test (existing module)',
- 'description' => 'Upgrade path test when there is an installed module with a too long name.',
- 'group' => 'Upgrade path',
- );
- }
-
- public function setUp() {
- // Path to the database dump files.
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.minimal.database.php.gz',
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.module_name_length.database.php',
- );
- parent::setUp();
- }
-
- /**
- * Checks that upgrading is not possible when there is a too long module name.
- */
- public function testUpgradeAborts() {
- // Load the first update screen.
- $this->getUpdatePhp();
- if (!$this->assertResponse(200)) {
- throw new \Exception('Initial GET to update.php did not return HTTP 200 status.');
- }
-
- $this->assertText('Module name too long');
- $this->assertNoFieldByXPath('//input[@type="submit"]', 'Not allowed to continue with the update process.');
- }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/FieldUIUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/FieldUIUpgradePathTest.php
deleted file mode 100644
index 4606d3b..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/FieldUIUpgradePathTest.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains Drupal\system\Tests\Upgrade\FieldUIUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-/**
- * Test upgrade of Field UI.
- */
-class FieldUIUpgradePathTest extends UpgradePathTestBase {
-
- protected $normal_role_id = 4;
- protected $normal_role_name = 'Normal role';
- protected $admin_role_id = 5;
- protected $admin_role_name = 'Admin role';
-
- public static function getInfo() {
- return array(
- 'name' => 'Field UI upgrade test',
- 'description' => 'Upgrade tests for Field UI.',
- 'group' => 'Upgrade path',
- );
- }
-
- public function setUp() {
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.filled.standard_all.database.php.gz',
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.field_ui.database.php',
- );
- parent::setUp();
- }
-
- /**
- * Tests Field UI permissions upgrade path.
- *
- * Test that after upgrade users who have the 'administer comments',
- * 'administer content types', 'administer users', and 'administer taxonomy'
- * permission still have access to the manage field and display screens of
- * those entities.
- */
- function testFieldUIPermissions() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- $permissions = array(
- 'administer comments' => array(
- 'administer comment fields',
- 'administer comment display',
- ),
- 'administer content types' => array(
- 'administer node fields',
- 'administer node display',
- ),
- 'administer users' => array(
- 'administer user fields',
- 'administer user display',
- ),
- 'administer taxonomy' => array(
- 'administer taxonomy_term fields',
- 'administer taxonomy_term display',
- ),
- );
-
- $role_permissions = user_role_permissions(array($this->normal_role_id, $this->admin_role_id));
- foreach ($permissions as $old_permission => $new_permissions) {
- $this->assertFalse(in_array($old_permission, $role_permissions[$this->normal_role_id]), format_string('%role_name does not have the old %permission permission', array('%role_name' => $this->normal_role_name, '%permission' => $old_permission)));
- $this->assertTrue(in_array($old_permission, $role_permissions[$this->admin_role_id]), format_string('%role_name still has the old %permission permission', array('%role_name' => $this->admin_role_name, '%permission' => $old_permission)));
- foreach ($new_permissions as $new_permission) {
- $this->assertFalse(in_array($new_permission, $role_permissions[$this->normal_role_id]), format_string('%role_name does not have the new %permission permission', array('%role_name' => $this->normal_role_name, '%permission' => $new_permission)));
- $this->assertTrue(in_array($new_permission, $role_permissions[$this->admin_role_id]), format_string('%role_name has the new %permission permission', array('%role_name' => $this->admin_role_name, '%permission' => $new_permission)));
- }
- }
- }
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/FieldUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/FieldUpgradePathTest.php
deleted file mode 100644
index 76c3b06..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/FieldUpgradePathTest.php
+++ /dev/null
@@ -1,294 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\Tests\Upgrade\FieldUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-use Drupal\Core\Entity\FieldableDatabaseStorageController;
-use Drupal\field\Entity\Field;
-
-/**
- * Tests upgrade of system variables.
- */
-class FieldUpgradePathTest extends UpgradePathTestBase {
-
- public static function getInfo() {
- return array(
- 'name' => 'Field upgrade test',
- 'description' => 'Tests upgrade of Field API.',
- 'group' => 'Upgrade path',
- );
- }
-
- public function setUp() {
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.standard_all.database.php.gz',
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.field.database.php',
- );
- parent::setUp();
- }
-
- /**
- * Tests upgrade of entity displays.
- */
- public function testEntityDisplayUpgrade() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- // Check that the configuration entries were created.
- $displays = array(
- 'default' => \Drupal::config('entity.display.node.article.default')->get(),
- 'teaser' => \Drupal::config('entity.display.node.article.teaser')->get(),
- );
- $this->assertTrue(!empty($displays['default']));
- $this->assertTrue(!empty($displays['teaser']));
-
- // Check that the 'body' field is configured as expected.
- $expected = array(
- 'default' => array(
- 'label' => 'hidden',
- 'type' => 'text_default',
- 'weight' => 0,
- 'settings' => array(),
- ),
- 'teaser' => array(
- 'label' => 'hidden',
- 'type' => 'text_summary_or_trimmed',
- 'weight' => 0,
- 'settings' => array(
- 'trim_length' => 600,
- ),
- ),
- );
- $this->assertEqual($displays['default']['content']['body'], $expected['default']);
- $this->assertEqual($displays['teaser']['content']['body'], $expected['teaser']);
-
- // Check that the display key in the instance data was removed.
- $body_instance = field_info_instance('node', 'body', 'article');
- $this->assertTrue(!isset($body_instance->display));
-
- // Check that deleted fields were not added to the display.
- $this->assertFalse(isset($displays['default']['content']['test_deleted_field']));
- $this->assertFalse(isset($displays['teaser']['content']['test_deleted_field']));
-
- // Check that the 'language' extra field is configured as expected.
- $expected = array(
- 'default' => array(
- 'weight' => -1,
- 'visible' => 1,
- ),
- 'teaser' => array(
- 'visible' => 0,
- ),
- );
- $this->assertEqual($displays['default']['content']['language'], $expected['default']);
- $this->assertEqual($displays['teaser']['content']['language'], $expected['teaser']);
- }
-
- /**
- * Tests upgrade of entity form displays.
- */
- public function testEntityFormDisplayUpgrade() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- // Check that the configuration entries were created.
- $form_display = \Drupal::config('entity.form_display.node.article.default')->get();
- $this->assertTrue(!empty($form_display));
-
- // Check that the 'body' field is configured as expected.
- $expected = array(
- 'type' => 'text_textarea_with_summary',
- 'weight' => -4,
- 'settings' => array(
- 'rows' => '20',
- 'summary_rows' => '5',
- ),
- );
- $this->assertEqual($form_display['content']['body'], $expected);
-
- // Check that the display key in the instance data was removed.
- $body_instance = field_info_instance('node', 'body', 'article');
- $this->assertTrue(!isset($body_instance->widget));
-
- // Check that deleted fields were not added to the display.
- $this->assertFalse(isset($form_display['content']['test_deleted_field']));
-
- // Check that the 'title' extra field is configured as expected.
- $expected = array(
- 'weight' => -5,
- 'visible' => 1,
- );
- $this->assertEqual($form_display['content']['title'], $expected);
- }
-
- /**
- * Tests migration of field and instance definitions to config.
- */
- function testFieldUpgradeToConfig() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- // Check that the configuration for the 'body' field is correct.
- $config = \Drupal::config('field.field.node.body')->get();
- // We cannot predict the value of the UUID, we just check it's present.
- $this->assertFalse(empty($config['uuid']));
- $field_uuid = $config['uuid'];
- unset($config['uuid']);
- $this->assertEqual($config, array(
- 'id' => 'node.body',
- 'name' => 'body',
- 'type' => 'text_with_summary',
- 'module' => 'text',
- 'active' => '1',
- 'entity_type' => 'node',
- 'settings' => array(),
- 'locked' => 0,
- 'cardinality' => 1,
- 'translatable' => 0,
- 'indexes' => array(
- 'format' => array('format')
- ),
- 'status' => 1,
- 'langcode' => 'und',
- ));
-
- // Check that the configuration for the instance on article and page nodes
- // is correct.
- foreach (array('article', 'page') as $node_type) {
- $config = \Drupal::config("field.instance.node.$node_type.body")->get();
- // We cannot predict the value of the UUID, we just check it's present.
- $this->assertFalse(empty($config['uuid']));
- unset($config['uuid']);
- $this->assertEqual($config, array(
- 'id' => "node.$node_type.body",
- 'field_uuid' => $field_uuid,
- 'field_type' => 'text_with_summary',
- 'entity_type' => 'node',
- 'bundle' => $node_type,
- 'label' => 'Body',
- 'description' => '',
- 'required' => FALSE,
- 'default_value' => array(),
- 'default_value_function' => '',
- 'settings' => array(
- 'display_summary' => TRUE,
- 'text_processing' => 1,
- // This setting has been removed in field_update_8005(). We keep it
- // here, commented out, to prove that the upgrade path is working.
- //'user_register_form' => FALSE,
- ),
- 'status' => 1,
- 'langcode' => 'und',
- ));
- }
-
- // Check that the field that was shared in two entity types got split into
- // two separate config entities.
- $config = \Drupal::config('field.field.node.test_shared_field')->get();
- // We cannot predict the value of the UUID, we just check it's present.
- $this->assertFalse(empty($config['uuid']));
- $field_uuid_node = $config['uuid'];
- unset($config['uuid']);
- $this->assertEqual($config, array(
- 'id' => 'node.test_shared_field',
- 'name' => 'test_shared_field',
- 'type' => 'text',
- 'module' => 'text',
- 'active' => '1',
- 'entity_type' => 'node',
- 'settings' => array(
- 'max_length' => '255',
- ),
- 'locked' => 0,
- 'cardinality' => 1,
- 'translatable' => 0,
- 'indexes' => array(
- 'format' => array('format')
- ),
- 'status' => 1,
- 'langcode' => 'und',
- ));
- $config = \Drupal::config('field.field.user.test_shared_field')->get();
- // We cannot predict the value of the UUID, we just check it's present.
- $this->assertFalse(empty($config['uuid']));
- $field_uuid_user = $config['uuid'];
- unset($config['uuid']);
- $this->assertEqual($config, array(
- 'id' => 'user.test_shared_field',
- 'name' => 'test_shared_field',
- 'type' => 'text',
- 'module' => 'text',
- 'active' => '1',
- 'entity_type' => 'user',
- 'settings' => array(
- 'max_length' => '255',
- ),
- 'locked' => 0,
- 'cardinality' => 1,
- 'translatable' => 0,
- 'indexes' => array(
- 'format' => array('format')
- ),
- 'status' => 1,
- 'langcode' => 'und',
- ));
-
- // Check that the corresponding instances point to the correct field UUIDs.
- $config = \Drupal::config('field.instance.node.article.test_shared_field')->get();
- $this->assertEqual($config['field_uuid'], $field_uuid_node);
- $config = \Drupal::config('field.instance.user.user.test_shared_field')->get();
- $this->assertEqual($config['field_uuid'], $field_uuid_user);
-
- // Check that field values in the pre-existing node are read correctly.
- $node = node_load(1);
- $this->assertEqual($node->body->value, 'Some value');
- $this->assertEqual($node->body->summary, 'Some summary');
- $this->assertEqual($node->body->format, 'filtered_html');
- $this->assertEqual($node->test_shared_field->value, 'Shared field: value for node 1');
- $this->assertEqual($node->test_shared_field->format, 'filtered_html');
- // Check that field values in the pre-existing user are read correctly.
- $account = user_load(1);
- $this->assertEqual($account->test_shared_field->value, 'Shared field: value for user 1');
- $this->assertEqual($account->test_shared_field->format, 'filtered_html');
-
- // Check that the definition of a deleted field is stored in state rather
- // than config.
- $this->assertFalse(\Drupal::config('field.field.test_deleted_field')->get());
- // The array is keyed by UUID. We cannot predict the UUID of the
- // 'test_deleted_field' field, but assume there was only one deleted field
- // in the test database.
- $deleted_fields = \Drupal::state()->get('field.field.deleted');
- $uuid_key = key($deleted_fields);
- $deleted_field = $deleted_fields[$uuid_key];
- $this->assertEqual($deleted_field['uuid'], $uuid_key);
- $this->assertEqual($deleted_field['id'], 'node.test_deleted_field');
-
- // Check that the definition of a deleted instance is stored in state rather
- // than config.
- $this->assertFalse(\Drupal::config('field.instance.node.article.test_deleted_field')->get());
- $deleted_instances = \Drupal::state()->get('field.instance.deleted');
- // Assume there was only one deleted instance in the test database.
- $uuid_key = key($deleted_instances);
- $deleted_instance = $deleted_instances[$uuid_key];
- $this->assertEqual($deleted_instance['uuid'], $uuid_key);
- $this->assertEqual($deleted_instance['id'], 'node.article.test_deleted_field');
- // The deleted field uuid and deleted instance field_uuid must match.
- $this->assertEqual($deleted_field['uuid'], $deleted_instance['field_uuid']);
-
- // Check that pre-existing deleted field table is renamed correctly.
- $field_entity = new Field($deleted_field);
- $table_name = FieldableDatabaseStorageController::_fieldTableName($field_entity);
- $this->assertEqual("field_deleted_data_" . substr(hash('sha256', $deleted_field['uuid']), 0, 10), $table_name);
- $this->assertTrue(db_table_exists($table_name));
-
- // Check that creation of a new node works as expected.
- $value = $this->randomName();
- $edit = array(
- 'title' => 'Node after CMI conversion',
- 'body[0][value]' => $value,
- );
- $this->drupalPostForm('node/add/article', $edit, 'Save and publish');
- $this->assertText($value);
- }
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/FilledMinimalUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/FilledMinimalUpgradePathTest.php
deleted file mode 100644
index 86d2b10..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/FilledMinimalUpgradePathTest.php
+++ /dev/null
@@ -1,83 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\system\Tests\Upgrade\FilledMinimalUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-use Drupal\Core\Session\UserSession;
-
-/**
- * Performs major version release upgrade tests on a populated database.
- *
- * Loads an installation of Drupal 7.x and runs the upgrade process on it.
- *
- * The install contains the minimal profile modules (along with generated
- * content) so that an update from of a site under this profile may be tested.
- */
-class FilledMinimalUpgradePathTest extends UpgradePathTestBase {
- public static function getInfo() {
- return array(
- 'name' => 'Basic minimal profile upgrade path, populated database',
- 'description' => 'Basic upgrade path tests for a minimal profile install with a populated database.',
- 'group' => 'Upgrade path',
- );
- }
-
- public function setUp() {
- // Path to the database dump files.
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.filled.minimal.database.php.gz',
- );
- parent::setUp();
- }
-
- /**
- * Tests a successful point release update.
- */
- public function testFilledMinimalUpgrade() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- // Hit the frontpage.
- $this->drupalGet('');
- $this->assertResponse(200);
-
- // Verify that we are still logged in.
- $this->drupalGet('user');
- $this->clickLink(t('Edit'));
- $this->assertEqual($this->getUrl(), url('user/1/edit', array('absolute' => TRUE)), 'We are still logged in as admin at the end of the upgrade.');
-
- // Logout and verify that we can login back in with our initial password.
- $this->drupalLogout();
- $user = new UserSession(array(
- 'uid' => 1,
- 'name' => 'admin',
- 'pass_raw' => 'drupal',
- ));
- $this->drupalLogin($user);
-
- // The previous login should've triggered a password rehash, so login one
- // more time to make sure the new hash is readable.
- $this->drupalLogout();
- $this->drupalLogin($user);
-
- // Test that the site name is correctly displayed.
- $this->assertText('drupal', 'The site name is correctly displayed.');
-
- // Verify that the main admin sections are available.
- $this->drupalGet('admin');
- $this->assertText(t('Content'));
- $this->assertText(t('Appearance'));
- $this->assertText(t('People'));
- $this->assertText(t('Configuration'));
- $this->assertText(t('Reports'));
- $this->assertText(t('Structure'));
- $this->assertText(t('Extend'));
-
- // Confirm that no {menu_links} entry exists for user/autocomplete.
- $result = db_query('SELECT COUNT(*) FROM {menu_links} WHERE link_path = :user_autocomplete', array(':user_autocomplete' => 'user/autocomplete'))->fetchField();
- $this->assertFalse($result, 'No {menu_links} entry exists for user/autocomplete');
- }
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/FilledStandardUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/FilledStandardUpgradePathTest.php
deleted file mode 100644
index 7457533..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/FilledStandardUpgradePathTest.php
+++ /dev/null
@@ -1,136 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\system\Tests\Upgrade\FilledStandardUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-use Drupal\Core\Session\UserSession;
-
-/**
- * Performs major version release upgrade tests on a populated database.
- *
- * Loads an installation of Drupal 7.x and runs the upgrade process on it.
- *
- * The install contains the standard profile (plus all optional) modules
- * with generated content so that an update from any of the modules under this
- * profile installation can be wholly tested.
- */
-class FilledStandardUpgradePathTest extends UpgradePathTestBase {
- public static function getInfo() {
- return array(
- 'name' => 'Basic standard + all profile upgrade path, populated database',
- 'description' => 'Basic upgrade path tests for a standard profile install with all enabled modules and a populated database.',
- 'group' => 'Upgrade path',
- );
- }
-
- public function setUp() {
- // Path to the database dump files.
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.filled.standard_all.database.php.gz',
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.user_data.database.php',
- );
- parent::setUp();
- }
-
- /**
- * Tests a successful point release update.
- */
- public function testFilledStandardUpgrade() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- // Hit the frontpage.
- $this->drupalGet('');
- $this->assertResponse(200);
-
- // Verify that the former Navigation system menu block appears as Tools.
- // @todo Blocks are not being upgraded.
- // $this->assertText(t('Tools'));
-
- // Verify that the Account menu still appears as secondary links source.
- $this->assertText(t('My account'));
- $this->assertText(t('Log out'));
-
- // Verify the the Main menu still appears as primary links source.
- $this->assertLink(t('Home'));
-
- // Verify that we are still logged in.
- $this->drupalGet('user');
- $this->clickLink(t('Edit'));
- $this->assertEqual($this->getUrl(), url('user/1/edit', array('absolute' => TRUE)), 'We are still logged in as admin at the end of the upgrade.');
-
- // Logout and verify that we can login back in with our initial password.
- $this->drupalLogout();
- $user = new UserSession(array(
- 'uid' => 1,
- 'name' => 'admin',
- 'pass_raw' => 'drupal',
- ));
- $this->drupalLogin($user);
-
- // The previous login should've triggered a password rehash, so login one
- // more time to make sure the new hash is readable.
- $this->drupalLogout();
- $this->drupalLogin($user);
-
- // Test that the site name is correctly displayed.
- $this->assertText('drupal', 'The site name is correctly displayed.');
-
- // Verify that the main admin sections are available.
- $this->drupalGet('admin');
- $this->assertText(t('Content'));
- $this->assertText(t('Appearance'));
- $this->assertText(t('People'));
- $this->assertText(t('Configuration'));
- $this->assertText(t('Reports'));
- $this->assertText(t('Structure'));
- $this->assertText(t('Extend'));
-
- // Confirm that no {menu_links} entry exists for user/autocomplete.
- $result = db_query('SELECT COUNT(*) FROM {menu_links} WHERE link_path = :user_autocomplete', array(':user_autocomplete' => 'user/autocomplete'))->fetchField();
- $this->assertFalse($result, 'No {menu_links} entry exists for user/autocomplete');
-
- // Verify that the blog node type has been assigned to node module.
- $node_type = entity_load('node_type', 'blog');
- $this->assertFalse($node_type->isLocked(), "Content type 'blog' has been reassigned from the blog module to the node module.");
- $node_type = entity_load('node_type', 'forum');
- $this->assertTrue($node_type->isLocked(), "The base string used to construct callbacks corresponding to content type 'Forum' has been reassigned to forum module.");
-
- // Each entity type has a 'full' view mode, ensure it was migrated.
- $all_view_modes = entity_get_view_modes();
- $this->assertTrue(!empty($all_view_modes), 'The view modes have been migrated.');
- foreach ($all_view_modes as $entity_view_modes) {
- $this->assertTrue(isset($entity_view_modes['full']));
- }
-
- // Ensure that taxonomy terms have a 'changed' timestamp.
- $term = entity_load('taxonomy_term', 1);
- $this->assertNotEqual($term->getChangedTime(), 0);
-
- // Check that user data has been migrated correctly.
- $query = db_query('SELECT * FROM {users_data}');
-
- $userdata = array();
- $i = 0;
- foreach ($query as $row) {
- $i++;
- $userdata[$row->uid][$row->module][$row->name] = $row;
- }
- // Check that the correct amount of rows exist.
- $this->assertEqual($i, 5);
- // Check that the data has been converted correctly.
- $this->assertEqual(unserialize($userdata[1]['contact']['enabled']->value), 1);
- $this->assertEqual($userdata[1]['contact']['enabled']->serialized, 1);
- $this->assertEqual(unserialize($userdata[2]['contact']['enabled']->value), 0);
- $this->assertEqual(unserialize($userdata[1]['overlay']['enabled']->value), 1);
- $this->assertEqual(unserialize($userdata[2]['overlay']['enabled']->value), 1);
- $this->assertEqual(unserialize($userdata[1]['overlay']['message_dismissed']->value), 1);
- $this->assertFalse(isset($userdata[2]['overlay']['message_dismissed']));
-
- // Make sure that only the garbage is remaining in the helper table.
- $this->assertEqual(db_query('SELECT COUNT(*) FROM {_d7_users_data}')->fetchField(), 2);
- }
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/FilterFormatUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/FilterFormatUpgradePathTest.php
deleted file mode 100644
index 9c472ff..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/FilterFormatUpgradePathTest.php
+++ /dev/null
@@ -1,93 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\Tests\Upgrade\FilterFormatUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-/**
- * Tests upgrading a bare database with user filter format data.
- *
- * Loads a bare installation of Drupal 7 with filter format data and runs the
- * upgrade process on it. Tests for the conversion filter formats into
- * configurables.
- */
-class FilterFormatUpgradePathTest extends UpgradePathTestBase {
-
- public static function getInfo() {
- return array(
- 'name' => 'Filter Formats upgrade test',
- 'description' => 'Upgrade tests with filter formats data.',
- 'group' => 'Upgrade path',
- );
- }
-
- public function setUp() {
- $path = drupal_get_path('module', 'system');
- $this->databaseDumpFiles = array(
- $path . '/tests/upgrade/drupal-7.bare.standard_all.database.php.gz',
- $path . '/tests/upgrade/drupal-7.roles.database.php',
- $path . '/tests/upgrade/drupal-7.filter_formats.database.php',
- );
- parent::setUp();
- }
-
- /**
- * Tests expected filter formats entities after a successful upgrade.
- */
- public function testFilterFormatUpgrade() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- // Checks that all the formats were upgraded
- $one = entity_load('filter_format', 'format_one');
- $this->assertTrue(!empty($one), 'Filter Format one was successfully upgraded');
- $two = entity_load('filter_format', 'format_two');
- $this->assertTrue(!empty($two), 'Filter Format two was successfully upgraded');
-
- // Filter format 'Three' is disabled.
- $three_entity = entity_load('filter_format', 'format_three');
- $this->assertFalse($three_entity->status(), 'Filter Format three was successfully upgraded and it is disabled');
-
- // Check the access to the text formats.
-
- // Check that the anonymous user role ID has been converted from "1" to
- // "anonymous" and text formats permissions were updated.
- $this->drupalGet('admin/people/permissions');
- $this->assertFieldChecked('edit-anonymous-use-text-format-format-one', 'Use text format format_one permission for "anonymous" is set correctly.');
- $this->assertNoFieldChecked('edit-anonymous-use-text-format-format-two', 'Use text format format_two permission for "anonymous" is set correctly.');
-
- // Check that the anonymous user role ID has been converted from "2" to
- // "authenticated" and text formats permissions were updated.
- $this->assertNoFieldChecked('edit-authenticated-use-text-format-format-one', 'Use text format format_one permission for "authenticated" is set correctly.');
- $this->assertFieldChecked('edit-authenticated-use-text-format-format-two', 'Use text format format_two permission for "authenticated" is set correctly.');
-
- // Check that the permission for "gärtner" still exists and text formats
- // permissions were updated.
- $this->assertFieldChecked('edit-4-use-text-format-format-one', 'Use text format format_one permission for role is set correctly.');
- $this->assertNoFieldChecked('edit-4-use-text-format-format-two', 'Use text format format_two permission for role is set correctly.');
-
- // Check that role 5 cannot access to the defined text formats
- $this->assertNoFieldChecked('edit-5-use-text-format-format-one', 'Use text format format_one permission for role is set correctly.');
- $this->assertNoFieldChecked('edit-5-use-text-format-format-two', 'Use text format format_two permission for role is set correctly.');
-
- // Check that the format has the missing filter.
- $two = entity_load('filter_format', 'format_two');
- $this->assertTrue($two->filters()->has('missing_filter'));
-
- // Try to use a filter format with a missing filter, this should not throw
- // an exception.
- $empty_markup = check_markup($this->randomName(), 'format_two');
- $this->assertIdentical($empty_markup, '', 'The filtered text is empty while a filter is missing.');
-
- // Editing and saving the format should drop the missing filter.
- $this->drupalGet('admin/config/content/formats/manage/format_two');
- $this->assertRaw(t('The %filter filter is missing, and will be removed once this format is saved.', array('%filter' => 'missing_filter')));
- $this->drupalPostForm(NULL, array(), t('Save configuration'));
- filter_formats_reset();
- $two = entity_load('filter_format', 'format_two');
- $this->assertFalse($two->filters()->has('missing_filter'));
- }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/ForumUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/ForumUpgradePathTest.php
deleted file mode 100644
index 5edc67c..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/ForumUpgradePathTest.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\Tests\Upgrade\ForumUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-/**
- * Tests upgrading a filled database with forum data.
- *
- * Loads a filled installation of Drupal 7 with forums and containers and runs
- * the upgrade process on it.
- */
-class ForumUpgradePathTest extends UpgradePathTestBase {
-
- public static function getInfo() {
- return array(
- 'name' => 'Forum upgrade test',
- 'description' => 'Upgrade tests with forum 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.forum.database.php',
- );
- parent::setUp();
- }
-
- /**
- * Tests expected forum and container conversions after a successful upgrade.
- */
- public function testForumUpgrade() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- // Make sure the field is created.
- $vocabulary = $this->container->get('config.factory')->get('forum.settings')->get('vocabulary');
- $field = field_info_instance('taxonomy_term', 'forum_container', $vocabulary);
- $this->assertTrue((bool) $field, 'Field was found');
-
- // Check that the values of forum_container are correct.
- $containers = entity_load_multiple_by_properties('taxonomy_term', array('name' => 'Container'));
- $container = reset($containers);
- $this->assertTrue((bool) $container->forum_container->value);
-
- $forums = entity_load_multiple_by_properties('taxonomy_term', array('name' => 'Forum'));
- $forum = reset($forums);
- $this->assertFalse((bool) $forum->forum_container->value);
- }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/ImageUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/ImageUpgradePathTest.php
deleted file mode 100644
index 7d742a7..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/ImageUpgradePathTest.php
+++ /dev/null
@@ -1,185 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\system\Tests\Upgrade\ImageUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-use Drupal\Component\Utility\String;
-
-/**
- * Test upgrade of overridden and custom image styles.
- */
-class ImageUpgradePathTest extends UpgradePathTestBase {
- public static function getInfo() {
- return array(
- 'name' => 'Image upgrade test',
- 'description' => 'Upgrade tests for overridden and custom image styles.',
- 'group' => 'Upgrade path',
- );
- }
-
- public function setUp() {
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.standard_all.database.php.gz',
- drupal_get_path('module', 'system') . '/tests/upgrade/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.');
-
- // A custom user image style.
- $expected_styles['test-custom'] = array(
- 'name' => 'test-custom',
- 'label' => 'Test custom',
- 'status' => '1',
- 'langcode' => 'en',
- 'effects' => array(
- 'image_rotate' => array(
- 'id' => 'image_rotate',
- 'data' => array(
- 'degrees' => '90',
- 'bgcolor' => '#FFFFFF',
- 'random' => '1',
- ),
- 'weight' => '1',
- ),
- 'image_desaturate' => array(
- 'id' => 'image_desaturate',
- 'data' => array(),
- 'weight' => '2',
- ),
- ),
- );
- // An image style shipped with Drupal 7 but overwritten by the user.
- $expected_styles['thumbnail'] = array(
- 'name' => 'thumbnail',
- 'label' => 'Thumbnail (100x100)',
- 'status' => '1',
- 'langcode' => 'en',
- 'effects' => array (
- 'image_scale' => array(
- 'id' => 'image_scale',
- 'data' => array (
- 'width' => '177',
- 'height' => '177',
- 'upscale' => '0',
- ),
- 'weight' => '0',
- ),
- ),
- );
- // A non-overwritten image style. Has to be imported in Drupal 8 as well.
- $expected_styles['large'] = array(
- 'name' => 'large',
- 'label' => 'Large (480x480)',
- 'status' => '1',
- 'langcode' => 'en',
- 'effects' => array (
- 'image_scale' => array(
- 'id' => 'image_scale',
- 'data' => array (
- 'width' => '480',
- 'height' => '480',
- 'upscale' => '0',
- ),
- 'weight' => '0',
- ),
- ),
- );
- $config_factory = $this->container->get('config.factory');
- foreach ($expected_styles as $name => $style) {
- $configured_style = $config_factory->get('image.style.' . $name)->get();
-
- // Maybe the image style hasn't been imported?
- $imported = !empty($configured_style);
- $this->assertTrue($imported, String::format('%name has been imported', array('%name' => $style['label'])));
- if (!$imported) {
- continue;
- }
-
- // Replace placeholder with image effect name keys with UUID's generated
- // during by the image style upgrade functions.
- foreach ($configured_style['effects'] as $uuid => $effect) {
- // Copy placeholder data.
- $style['effects'][$uuid] = $style['effects'][$effect['id']];
- // Set the missing uuid key as this is unknown because it is a UUID.
- $style['effects'][$uuid]['uuid'] = $uuid;
- // Remove the placeholder data.
- unset($style['effects'][$effect['id']]);
- }
- // Make sure UUID assigned to new style.
- $this->assertTrue($configured_style['uuid'], 'UUID assigned to converted style.');
- // Copy generated UUID to compared style.
- $style['uuid'] = $configured_style['uuid'];
- $this->assertEqual($this->sortByKey($style), $this->sortByKey($configured_style));
- }
- }
-
- /**
- * Sorts all keys in configuration data.
- *
- * Since we can not be sure of the order of the UUID's generated by
- * _image_update_get_style_with_effects() we need to sort the data in order
- * to compare it with data saved in the config system.
- *
- * @param array $data
- * An associative array to sort recursively by key name.
- *
- * @return array
- * A sorted array.
- */
- public function sortByKey(array $data) {
- ksort($data);
- foreach ($data as &$value) {
- if (is_array($value)) {
- $value = $this->sortByKey($value);
- }
- }
- return $data;
- }
-
- /**
- * Tests if the field and instance setting 'default_image' has been
- * successfully converted from an integer to an associative array.
- */
- public function testImageFieldDefaultImageUpgrade() {
- // Perform upgrade.
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- // While this test is testing the upgrade path against a Drupal 7 'standard'
- // profile installation we assume that node bundle 'article', having the
- // 'field_image' image field, is installed too.
- $cases = array('field.field.node.field_image', 'field.instance.node.article.field_image');
- foreach ($cases as $case) {
- $default_image = \Drupal::config($case)->get('settings.default_image');
-
- // Check is was converted to an array.
- $this->assertTrue(is_array($default_image));
-
- // Check if 'default_image' contains a key named 'fid'. It might be an
- // integer or NULL.
- $this->assertTrue(array_key_exists('fid', $default_image));
-
- // Check if 'alt' key exists and is a string.
- $this->assertTrue(isset($default_image['alt']) && is_string($default_image['alt']));
-
- // Check if 'title' key exists and is a string.
- $this->assertTrue(isset($default_image['title']) && is_string($default_image['title']));
-
- // Check if 'width' key exists. It might be an integer or NULL.
- $this->assertTrue(array_key_exists('width', $default_image));
-
- // Check if 'height' key exists. It might be an integer or NULL.
- $this->assertTrue(array_key_exists('height', $default_image));
- }
- }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/LanguageUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/LanguageUpgradePathTest.php
deleted file mode 100644
index df27013..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/LanguageUpgradePathTest.php
+++ /dev/null
@@ -1,196 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\system\Tests\Upgrade\LanguageUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-use Drupal\Core\Database\DatabaseException;
-
-use Drupal\Core\Language\Language;
-
-/**
- * Tests upgrading a filled database with language data.
- *
- * Loads a filled installation of Drupal 7 with language data and runs the
- * upgrade process on it.
- */
-class LanguageUpgradePathTest extends UpgradePathTestBase {
- public static function getInfo() {
- return array(
- 'name' => 'Language upgrade test',
- 'description' => 'Upgrade tests with language data.',
- 'group' => 'Upgrade path',
- );
- }
-
- public function setUp() {
- // Path to the database dump files.
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.filled.standard_all.database.php.gz',
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.language.database.php',
- );
- parent::setUp();
- }
-
- /**
- * Tests a successful upgrade.
- */
- public function testLanguageUpgrade() {
- db_update('users')->fields(array('language' => 'ca'))->condition('uid', '1')->execute();
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- // Check that the configuration for the 'Catalan' language is correct.
- $config = $this->container->get('config.factory')->get('language.entity.ca')->get();
- // We cannot predict the value of the UUID, we just check it's present.
- $this->assertFalse(empty($config['uuid']));
- unset($config['uuid']);
- $this->assertEqual($config, array(
- 'id' => 'ca',
- 'label' => 'Catalan',
- 'direction' => 0,
- 'weight' => 0,
- 'locked' => 0,
- 'langcode' => 'en',
- ));
-
- // Ensure Catalan was properly upgraded to be the new default language.
- $this->assertTrue(language_default()->id == 'ca', 'Catalan is the default language');
- $languages = language_list(Language::STATE_ALL);
- foreach ($languages as $language) {
- $this->assertTrue($language->default == ($language->id == 'ca'), format_string('@language default property properly set', array('@language' => $language->name)));
- }
-
- // Check that both comments display on the node.
- $this->drupalGet('node/50');
- $this->assertText('Node title 50', 'Node 50 displayed after update.');
- $this->assertText('First test comment', 'Comment 1 displayed after update.');
- $this->assertText('Reply to first test comment', 'Comment 2 displayed after update.');
-
- // Directly check the comment language property on the first comment.
- $comment = db_query('SELECT * FROM {comment} WHERE cid = :cid', array(':cid' => 1))->fetchObject();
- $this->assertTrue($comment->langcode == 'und', 'Comment 1 language code found.');
-
- // Ensure that the language switcher has been correctly upgraded. We need to
- // assert the expected HTML id because the block might appear even if the
- // language negotiation settings are not properly upgraded.
- // @todo Blocks are not being upgraded.
- // $this->assertTrue($this->xpath('//div[@id="block-language-language-interface"]'), 'The language switcher block is being correctly showed.');
-
- // Test that the 'language' property was properly renamed to 'langcode'.
- $language_none_nid = 50;
- $spanish_nid = 51;
- // Check directly for the node langcode.
- $this->assertEqual(node_load($language_none_nid)->language()->id, Language::LANGCODE_NOT_SPECIFIED, "'language' property was renamed to 'langcode' for Language::LANGCODE_NOT_SPECIFIED node.");
- $this->assertEqual(node_load($spanish_nid)->language()->id, 'ca', "'language' property was renamed to 'langcode' for Catalan node.");
-
- // Check for node content type settings upgrade.
- $this->drupalGet('node/add/article');
- $this->assertField('langcode', 'There is a language selector.');
- $this->drupalGet('node/add/page');
- $this->assertNoField('langcode', 'There is no language selector.');
-
- // Check that the user language value was retained in both langcode and
- // preferred_langcode.
- $user = db_query('SELECT * FROM {users} WHERE uid = :uid', array(':uid' => 1))->fetchObject();
- $this->assertEqual($user->langcode, 'ca');
- $this->assertEqual($user->preferred_langcode, 'ca');
-
- // A langcode property was added to vocabularies and terms. Check that
- // existing vocabularies and terms got assigned the site default language.
- $vocabulary = entity_load('taxonomy_vocabulary', 'tags');
- $this->assertEqual($vocabulary->langcode, 'ca');
- $term = db_query('SELECT * FROM {taxonomy_term_data} WHERE tid = :tid', array(':tid' => 1))->fetchObject();
- $this->assertEqual($term->langcode, 'ca');
-
- // A langcode property was added to files. Check that existing files got
- // assigned Language::LANGCODE_NOT_SPECIFIED.
- $file = db_query('SELECT * FROM {file_managed} WHERE fid = :fid', array(':fid' => 1))->fetchObject();
- $this->assertEqual($file->langcode, Language::LANGCODE_NOT_SPECIFIED);
-
- // Check if language negotiation weights were renamed properly. This is a
- // reproduction of the previous weights from the dump.
- $expected_weights = array(
- 'language-url' => '-8',
- 'language-session' => '-6',
- 'language-user' => '-4',
- 'language-browser' => '-2',
- 'language-selected' => '10',
- );
- // Check that locale_language_providers_weight_language is correctly
- // renamed.
- $current_weights = update_variable_get('language_negotiation_methods_weight_language_interface', array());
- $this->assertTrue(serialize($expected_weights) == serialize($current_weights), 'Language negotiation method weights upgraded.');
- $this->assertTrue(isset($current_weights['language-selected']), 'Language-selected is present.');
- $this->assertFalse(isset($current_weights['language-default']), 'Language-default is not present.');
-
- // @todo We only need language.inc here because LANGUAGE_NEGOTIATION_SELECTED
- // is defined there. Remove this line once that has been converted to a class
- // constant.
- require_once DRUPAL_ROOT . '/core/includes/language.inc';
-
- // Check that negotiation callback was added to language_negotiation_language_interface.
- $language_negotiation_language_interface = update_variable_get('language_negotiation_language_interface', NULL);
- $this->assertTrue(isset($language_negotiation_language_interface[LANGUAGE_NEGOTIATION_SELECTED]['callbacks']['negotiation']), 'Negotiation callback was added to language_negotiation_language_interface.');
-
- // Look up migrated plural string.
- $source_string = db_query('SELECT * FROM {locales_source} WHERE lid = 22')->fetchObject();
- $this->assertEqual($source_string->source, implode(LOCALE_PLURAL_DELIMITER, array('1 byte', '@count bytes')));
-
- $translation_string = db_query("SELECT * FROM {locales_target} WHERE lid = 22 AND language = 'hr'")->fetchObject();
- $this->assertEqual($translation_string->translation, implode(LOCALE_PLURAL_DELIMITER, array('@count bajt', '@count bajta', '@count bajtova')));
- $this->assertTrue(!isset($translation_string->plural), 'Chained plural indicator removed.');
- $this->assertTrue(!isset($translation_string->plid), 'Chained plural indicator removed.');
-
- $source_string = db_query('SELECT * FROM {locales_source} WHERE lid IN (23, 24)')->fetchObject();
- $this->assertTrue(empty($source_string), 'Individual plural variant source removed');
- $translation_string = db_query("SELECT * FROM {locales_target} WHERE lid IN (23, 24)")->fetchObject();
- $this->assertTrue(empty($translation_string), 'Individual plural variant translation removed');
-
- $translation_string = db_query("SELECT * FROM {locales_target} WHERE lid = 22 AND language = 'ca'")->fetchObject();
- $this->assertEqual($translation_string->translation, implode(LOCALE_PLURAL_DELIMITER, array('1 byte', '@count bytes')));
-
- // Ensure that re-indexing search for a specific language does not fail. It
- // does not matter if the sid exists on not. This tests whether or not
- // search_update_8001() has added the langcode fields.
- try {
- search_reindex(1, 'node', FALSE, 'ca');
- $this->pass("Calling search_reindex succeeds after upgrade.");
- }
- catch (DatabaseException $e) {
- $this->fail("Calling search_reindex fails after upgrade.");
- }
- }
-
- /**
- * Tests language domain upgrade path.
- */
- public function testLanguageUrlUpgrade() {
- $language_domain = 'ca.example.com';
- db_update('languages')->fields(array('domain' => 'http://' . $language_domain . ':8888'))->condition('language', 'ca')->execute();
- $this->variable_set('locale_language_negotiation_url_part', 1);
-
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- language_negotiation_include();
- $domains = language_negotiation_url_domains();
- $this->assertTrue($domains['ca'] == $language_domain, 'Language domain for Catalan properly upgraded.');
- }
-
- /**
- * Tests upgrading translations without plurals.
- */
- public function testLanguageNoPluralsUpgrade() {
- // Remove all plural translations from the database.
- db_delete('locales_target')->condition('plural', 0, '<>')->execute();
-
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- // Check if locale_update_8005() is succesfully completed by checking
- // whether index 'plural' has been removed.
- $this->assertFalse(db_index_exists('locales_target', 'plural'), 'Translations without plurals upgraded.');
- }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/MailUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/MailUpgradePathTest.php
deleted file mode 100644
index 417f41e..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/MailUpgradePathTest.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\Tests\Upgrade\MailUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-/**
- * Tests upgrade of mail backend system variables.
- */
-class MailUpgradePathTest extends UpgradePathTestBase {
-
- public static function getInfo() {
- return array(
- 'name' => 'Mail upgrade test',
- 'description' => 'Tests upgrade of Mail backend configuration.',
- 'group' => 'Upgrade path',
- );
- }
-
- public function setUp() {
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.standard_all.database.php.gz',
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.system.database.php',
- );
- parent::setUp();
- }
-
- /**
- * Tests that mail backends are upgraded to their Drupal 8 equivalents.
- */
- public function testMailSystemUpgrade() {
- $this->performUpgrade(TRUE);
-
- // Get the new mailer definitions.
- $mail_system = \Drupal::config('system.mail')->get('interface');
-
- // Check that the default mailer has been changed to a PSR-0 definition.
- $this->assertEqual($mail_system['default'], 'Drupal\Core\Mail\PhpMail', 'Default mailer upgraded to Drupal 8 syntax.');
-
- // Check that a custom mailer has been preserved through the upgrade.
- $this->assertEqual($mail_system['maillog'], 'MaillogMailSystem', 'Custom mail backend preserved during upgrade.');
- }
-
- /**
- * Overrides UpgradePathTestBase::checkCompletionPage().
- */
- protected function checkCompletionPage() {
- // Ensure the user is informed about mail backends that need updating.
- $this->assertText('The following mail backends need to be re-configured: MaillogMailSystem.', 'User notified about outdated mail backends.');
- }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/ModuleNameLengthUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/ModuleNameLengthUpgradePathTest.php
deleted file mode 100644
index 9525d6f..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/ModuleNameLengthUpgradePathTest.php
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\Tests\Upgrade\ModuleNameLengthUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-use Drupal\Core\Database\DatabaseExceptionWrapper;
-
-/**
- * Performs upgrade path tests for module name length related changes.
- */
-class ModuleNameLengthUpgradePathTest extends UpgradePathTestBase {
-
- public static function getInfo() {
- return array(
- 'name' => 'Module name length upgrade test',
- 'description' => 'Upgrade path tests for module name length related changes.',
- 'group' => 'Upgrade path',
- );
- }
-
- public function setUp() {
- // Path to the database dump files.
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.minimal.database.php.gz',
- );
- parent::setUp();
- }
-
- /**
- * Performs upgrade path tests for module name length related changes.
- */
- public function testModuleNameLengths() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- // Make sure that the module colums where shortened.
- try {
- db_insert('file_usage')
- ->fields(array(
- 'fid' => 2,
- 'module' => str_repeat('b', 51),
- 'type' => $this->randomName(),
- 'id' => $this->randomName(),
- 'count' => 1,
- ))
- ->execute();
- $this->fail('Length of {file_usage}.module successfully updated.');
- }
- catch (DatabaseExceptionWrapper $e) {
- $this->pass('Length of {file_usage}.module successfully updated.');
- }
- }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/ModulesDisabledUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/ModulesDisabledUpgradePathTest.php
deleted file mode 100644
index 0db46df..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/ModulesDisabledUpgradePathTest.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\system\Tests\Upgrade\ModulesDisabledUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-/**
- * Tests upgrading with all non-required modules installed but disabled.
- *
- * Loads a filled installation of Drupal 7 with disabled modules and runs the
- * upgrade process on it.
- */
-class ModulesDisabledUpgradePathTest extends UpgradePathTestBase {
- public static function getInfo() {
- return array(
- 'name' => 'Modules disabled upgrade test',
- 'description' => 'Upgrade path test for disabled modules.',
- 'group' => 'Upgrade path',
- );
- }
-
- public function setUp() {
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.filled.standard_all.database.php.gz',
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.all-disabled.database.php',
- );
- parent::setUp();
- }
-
- /**
- * Tests an upgrade with all non-required modules installed but disabled.
- */
- public function testDisabledUpgrade() {
- $modules = db_query('SELECT name, info FROM {system} WHERE type = :module AND status = 0 AND schema_version <> :schema_uninstalled', array(
- ':module' => 'module',
- ':schema_uninstalled' => SCHEMA_UNINSTALLED,
- ))->fetchAllKeyed(0, 1);
- array_walk($modules, function (&$value, $key) {
- $info = unserialize($value);
- $value = $info['name'];
- });
- // Load the first update screen.
- $this->getUpdatePhp();
- if (!$this->assertResponse(200)) {
- throw new \Exception('Initial GET to update.php did not return HTTP 200 status.');
- }
- $this->assertNoFieldByXPath('//input[@type="submit"]', NULL, 'No continue button found on update.php.');
- $this->assertText('Drupal 8 no longer supports disabled modules. Please either enable or uninstall them before upgrading.');
- $this->assertText(implode(', ', $modules));
- }
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/ShortcutUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/ShortcutUpgradePathTest.php
deleted file mode 100644
index 87f7f84..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/ShortcutUpgradePathTest.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\Tests\Upgrade\ShortcutUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-use Drupal\system\Tests\Upgrade\UpgradePathTestBase;
-
-/**
- * Tests upgrade of shortcut.
- */
-class ShortcutUpgradePathTest extends UpgradePathTestBase {
-
- public static function getInfo() {
- return array(
- 'name' => 'Shortcut upgrade test',
- 'description' => 'Tests upgrade of shortcut to the configuration system.',
- 'group' => 'Upgrade path',
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function setUp() {
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.standard_all.database.php.gz',
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.shortcut.database.php',
- );
- parent::setUp();
- }
-
- /**
- * Tests upgrade of {shortcut_set} table to configuration entities.
- */
- public function testContactUpgrade() {
- $this->assertTrue(db_table_exists('shortcut_set'), 'Table {shortcut_set} exists.');
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
- $this->assertFalse(db_table_exists('shortcut_set'), 'Table {shortcut_set} has been deleted.');
-
- // Ensure that the Drupal 7 default set has been created.
- $set = entity_load('shortcut_set', 'default');
- $this->assertTrue($set->uuid(), 'Converted set has a UUID');
- $this->assertEqual($set->label(), 'Default');
-
- // Test that the custom set has been updated.
- $set = entity_load('shortcut_set', 'shortcut-set-2');
- $this->assertTrue($set->uuid(), 'Converted set has a UUID');
- $this->assertEqual($set->label(), 'Custom shortcut set');
- }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/StateSystemUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/StateSystemUpgradePathTest.php
deleted file mode 100644
index b9a97a5..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/StateSystemUpgradePathTest.php
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\system\Tests\Upgrade\StateSystemUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-/**
- * Tests upgrade of system variables.
- */
-class StateSystemUpgradePathTest extends UpgradePathTestBase {
- public static function getInfo() {
- return array(
- 'name' => 'State system upgrade test',
- 'description' => 'Tests upgrade of system variables to the state system.',
- 'group' => 'Upgrade path',
- );
- }
-
- public function setUp() {
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.standard_all.database.php.gz',
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.state.system.database.php',
- );
- parent::setUp();
- }
-
- /**
- * Tests upgrade of system variables to state system.
- */
- public function testSystemVariableUpgrade() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- $expected_state = array();
-
- $expected_state['node.node_access_needs_rebuild'] = array(
- 'value' => TRUE,
- 'variable_name' => 'node_access_needs_rebuild',
- );
- $expected_state['node.cron_last'] = array(
- 'value' => 1304208001,
- 'variable_name' => 'node_cron_last',
- );
- $expected_state['statistics.day_timestamp'] = array(
- 'value' => 1352070595,
- 'variable_name' => 'statistics_day_timestamp',
- );
- $expected_state['statistics.node_counter_scale'] = array(
- 'value' => 1.0 / 2000,
- 'variable_name' => 'node_cron_views_scale',
- );
- $expected_state['system.cron_last'] = array(
- 'value' => 1304208002,
- 'variable_name' => 'cron_last',
- );
- $expected_state['system.cron_key'] = array(
- 'value' => 'kdm95qppDDlyZrcUOx453YwQqDA4DNmxi4VQcxzFU9M',
- 'variable_name' => 'cron_key',
- );
- $expected_state['system.private_key'] = array(
- 'value' => 'G38mKqASKus8VGMkMzVuXImYbzspCQ1iRT2iEZpMYmQ',
- 'variable_name' => 'drupal_private_key',
- );
- $expected_state['tracker.index_nid'] = array(
- 'value' => 0,
- 'variable_name' => 'tracker_index_nid',
- );
- $expected_state['update.last_check'] = array(
- 'value' => 1304208000,
- 'variable_name' => 'update_last_check',
- );
- $expected_state['update.last_email_notification'] = array(
- 'value' => 1304208000,
- 'variable_name' => 'update_last_email_notification',
- );
- $expected_state['comment.node_comment_statistics_scale'] = array(
- 'value' => 1.0 / 1000,
- 'variable_name' => 'node_cron_comments_scale',
- );
-
- foreach ($expected_state as $name => $data) {
- $this->assertIdentical(\Drupal::state()->get($name), $data['value']);
- $deleted = !db_query('SELECT value FROM {variable} WHERE name = :name', array(':name' => $data['variable_name']))->fetchField();
- $this->assertTrue($deleted, format_string('Variable !name has been deleted.', array('!name' => $data['variable_name'])));
- }
- }
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/SystemUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/SystemUpgradePathTest.php
deleted file mode 100644
index 6b0ad23..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/SystemUpgradePathTest.php
+++ /dev/null
@@ -1,195 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\system\Tests\Upgrade\SystemUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-/**
- * Tests upgrade of system variables.
- */
-class SystemUpgradePathTest extends UpgradePathTestBase {
- public static function getInfo() {
- return array(
- 'name' => 'System config upgrade test',
- 'description' => 'Tests upgrade of system variables to the configuration system.',
- 'group' => 'Upgrade path',
- );
- }
-
- public function setUp() {
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.standard_all.database.php.gz',
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.system.database.php',
- );
- parent::setUp();
- }
-
- /**
- * Tests upgrade of variables to config.
- */
- public function testVariableUpgrade() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- // Verify that variables were properly upgraded.
- $expected_config['system.cron'] = array(
- 'threshold.autorun' => '86400',
- 'threshold.requirements_warning' => '86400',
- 'threshold.requirements_error' => '172800',
- );
-
- $expected_config['system.logging'] = array(
- 'error_level' => 'some',
- );
-
- $expected_config['system.maintenance'] = array(
- 'message' => 'Testing config upgrade',
- );
-
- $expected_config['system.performance'] = array(
- 'cache.page.use_internal' => '1',
- 'cache.page.max_age' => '1800',
- 'response.gzip' => '1',
- 'js.preprocess' => '1',
- 'css.preprocess' => '1',
- 'fast_404' => array(
- 'enabled' => '1',
- 'paths' => '/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|aspi|pdf)$/i',
- 'exclude_paths' => '/\/(?:styles|imagecache)\//',
- 'html' => '<!DOCTYPE html><html><head><title>Page Not Found</title></head><body><h1>Page Not Found</h1><p>The requested URL "@path" was not found on this server.</p></body></html>',
- ),
- );
-
- $expected_config['system.rss'] = array(
- 'channel.description' => 'Testing config upgrade',
- 'items.limit' => '20',
- 'items.view_mode' => 'teaser',
- );
-
- $expected_config['system.site'] = array(
- 'name' => 'Testing config upgrade',
- // The upgrade from site_mail to system.site:mail is not testable as
- // simpletest overrides this configuration with simpletest@example.com.
- // 'mail' => 'config@example.com',
- 'slogan' => 'CMI makes Drupal 8 drush cex -y',
- 'page.403' => '403',
- 'page.404' => '404',
- 'page.front' => 'node',
- );
-
- $expected_config['user.settings'] = array(
- 'cancel_method' => 'user_cancel_reassign',
- );
-
- $expected_config['system.filter'] = array(
- 'protocols.0' => 'http',
- 'protocols.1' => 'https',
- 'protocols.2' => 'ftp',
- 'protocols.3' => 'mailto',
- );
-
- $expected_config['taxonomy.settings'] = array(
- 'override_selector' => '1',
- 'terms_per_page_admin' => '32',
- 'maintain_index_table' => '0',
- );
-
- $expected_config['filter.settings'] = array(
- 'fallback_format' => 'plain_text'
- );
-
- $expected_config['action.settings'] = array(
- 'recursion_limit' => 42,
- );
-
- // Color module for theme bartik, optional screenshot.
- $expected_config['color.bartik'] = array(
- 'palette' => array(
- 'top' => '#8eccf2',
- 'bottom' => '#48a9e4',
- 'bg' => '#ffffff',
- 'sidebar' => '#f6f6f2',
- 'sidebarborders' => '#f9f9f9',
- 'footer' => '#db2a2a',
- 'titleslogan' => '#fffeff',
- 'text' => '#fb8484',
- 'link' => '#3587b7',
- ),
- 'logo' => 'public://color/bartik-09696463/logo.png',
- 'stylesheets' => 'public://color/bartik-09696463/colors.css',
- 'files' => array(
- 'public://color/bartik-09696463/logo.png', 'public://color/bartik-09696463/colors.css'
- ),
- );
- // Second try with faked seven upgrade, optional screenshot.
- $expected_config['color.seven'] = array(
- 'palette' => array(
- 'top' => '#8eccf2',
- 'bottom' => '#48a9e4',
- 'bg' => '#ffffff',
- 'sidebar' => '#f6f6f2',
- 'sidebarborders' => '#f9f9f9',
- 'footer' => '#db2a2a',
- 'titleslogan' => '#fffeff',
- 'text' => '#fb8484',
- 'link' => '#3587b7',
- ),
- 'logo' => 'public://color/seven-09696463/logo.png',
- 'stylesheets' => 'public://color/seven-09696463/colors.css',
- 'files' => array(
- 'public://color/seven-09696463/logo.png', 'public://color/seven-09696463/colors.css'
- ),
- 'screenshot' => 'public://color/seven-09696463/dummy-screenshot.png',
- );
-
- $expected_config['book.settings'] = array(
- 'allowed_types' => array(
- 'book',
- // Content type does not have to exist.
- 'test',
- ),
- 'block' => array(
- 'navigation' => array(
- 'mode' => 'all pages'
- )
- ),
- 'child_type' => 'book',
- );
-
- $expected_config['aggregator.settings'] = array(
- 'fetcher' => 'test_fetcher',
- 'parser' => 'test_parser',
- 'processors' => array('test_processor'),
- 'items.allowed_html' => '<a>',
- 'items.teaser_length' => 6000,
- 'items.expire' => 10,
- 'source.list_max' => 5,
- );
-
- foreach ($expected_config as $file => $values) {
- $config = \Drupal::config($file);
- $this->verbose(print_r($config->get(), TRUE));
- foreach ($values as $name => $value) {
- $stored = $config->get($name);
- // Make sure we have a string representation to show.
- $stored_txt = !is_string($stored) ? json_encode($stored) : $stored;
- $value_txt = !is_string($value) ? json_encode($value) : $value;
- $this->assertEqual($value, $stored, format_string('Expected value for %name found: %stored (previously: %value).', array('%name' => $name, '%stored' => $stored_txt, '%value' => $value_txt)));
- }
- }
- }
-
- /**
- * Check whether views got enabled.
- */
- public function testFrontpageUpgrade() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- $this->assertTrue($this->container->get('module_handler')->moduleExists('views'), 'Views is enabled after the upgrade.');
- $view = $this->container->get('entity.manager')->getStorageController('view')->load('frontpage');
- $this->assertTrue($view->status(), 'The frontpage view is enabled after the upgrade.');
- }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php
deleted file mode 100644
index d72ed54..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php
+++ /dev/null
@@ -1,387 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\system\Tests\Upgrade\UpgradePathTestBase.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-use Drupal\Component\Utility\Crypt;
-use Drupal\Core\Database\Database;
-use Drupal\Core\DependencyInjection\ContainerBuilder;
-use Drupal\Core\DrupalKernel;
-use Drupal\Core\Session\UserSession;
-use Drupal\simpletest\WebTestBase;
-use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
-use Symfony\Component\HttpFoundation\Request;
-
-/**
- * Perform end-to-end tests of the upgrade path.
- */
-abstract class UpgradePathTestBase extends WebTestBase {
-
- /**
- * @var array
- */
- protected $configDirectories;
-
- /**
- * The file path(s) to the dumped database(s) to load into the child site.
- *
- * @var array
- */
- var $databaseDumpFiles = array();
-
- /**
- * Flag that indicates whether the child site has been upgraded.
- */
- var $upgradedSite = FALSE;
-
- /**
- * Array of errors triggered during the upgrade process.
- */
- var $upgradeErrors = array();
-
- /**
- * Flag to indicate whether there are pending updates or not.
- */
- var $pendingUpdates = TRUE;
-
- /**
- * Prepares the appropriate session for the release of Drupal being upgraded.
- */
- protected function prepareD8Session() {
- // We need an IP when storing sessions
- // so add a dummy request in the container.
- $request = Request::create('http://example.com/');
- $request->server->set('REMOTE_ADDR', '3.3.3.3');
- $this->container->set('request', $request);
-
- // Generate and set a D7-compatible session cookie.
- $this->curlInitialize();
- $sid = Crypt::hashBase64(uniqid(mt_rand(), TRUE) . Crypt::randomBytes(55));
- $this->curlCookies[] = rawurlencode(session_name()) . '=' . rawurlencode($sid);
-
- // Force our way into the session of the child site.
- drupal_save_session(TRUE);
- _drupal_session_write($sid, '');
- drupal_save_session(FALSE);
- }
-
- /**
- * Checks that zlib is enabled in order to run the upgrade tests.
- */
- protected function checkRequirements() {
- if (!function_exists('gzopen')) {
- return array(
- 'Missing zlib requirement for upgrade tests.',
- );
- }
- return parent::checkRequirements();
- }
-
- /**
- * Overrides Drupal\simpletest\WebTestBase::setUp() for upgrade testing.
- *
- * @see \Drupal\simpletest\WebTestBase::prepareDatabasePrefix()
- * @see \Drupal\simpletest\WebTestBase::changeDatabasePrefix()
- * @see \Drupal\simpletest\WebTestBase::prepareEnvironment()
- */
- protected function setUp() {
- global $user, $conf;
-
- // Load the Update API.
- require_once DRUPAL_ROOT . '/core/includes/update.inc';
-
- // Load Session API.
- require_once DRUPAL_ROOT . '/core/includes/session.inc';
- drupal_session_initialize();
-
- // Reset flags.
- $this->upgradedSite = FALSE;
- $this->upgradeErrors = array();
-
- // Create the database prefix for this test.
- $this->prepareDatabasePrefix();
-
- // Prepare the environment for running tests.
- $this->prepareEnvironment();
- if (!$this->setupEnvironment) {
- return FALSE;
- }
-
- // Reset all statics and variables to perform tests in a clean environment.
- $conf = array();
- drupal_static_reset();
-
-
- // Build a minimal, partially mocked environment for unit tests.
- $this->rebuildContainer();
- // Make sure it survives kernel rebuilds.
- $conf['container_service_providers']['TestServiceProvider'] = 'Drupal\simpletest\TestServiceProvider';
-
- // Change the database prefix.
- // All static variables need to be reset before the database prefix is
- // changed, since Drupal\Core\Utility\CacheArray implementations attempt to
- // write back to persistent caches when they are destructed.
- $this->changeDatabasePrefix();
- if (!$this->setupDatabasePrefix) {
- return FALSE;
- }
-
- // Load the database from the portable PHP dump.
- // The files may be gzipped.
- foreach ($this->databaseDumpFiles as $file) {
- if (substr($file, -3) == '.gz') {
- $file = "compress.zlib://$file";
- }
- require $file;
- }
-
- // Set path variables.
- $this->variable_set('file_public_path', $this->public_files_directory);
- $this->variable_set('file_private_path', $this->private_files_directory);
- $this->variable_set('file_temporary_path', $this->temp_files_directory);
-
- $this->pass('Finished loading the dump.');
-
- // Override $update_free_access in settings.php to allow the anonymous user
- // to run updates.
- $install_profile = unserialize(db_query('SELECT value FROM {variable} WHERE name = :name', array(':name' => 'install_profile'))->fetchField());
- $settings = array(
- 'settings' => array(
- 'install_profile' => (object) array(
- 'value' => $install_profile,
- 'required' => TRUE,
- ),
- ),
- );
- $this->writeSettings($settings);
- $this->settingsSet('install_profile', $install_profile);
- $this->profile = $install_profile;
-
- // Ensure that the session is not written to the new environment and replace
- // the global $user session with uid 1 from the new test site.
- drupal_save_session(FALSE);
- // Load values for uid 1.
- $values = db_query('SELECT * FROM {users} WHERE uid = :uid', array(':uid' => 1))->fetchAssoc();
- // Load rolest.
- $values['roles'] = array_merge(array(DRUPAL_AUTHENTICATED_RID), db_query('SELECT rid FROM {users_roles} WHERE uid = :uid', array(':uid' => 1))->fetchCol());
- // Create a new user session object.
- $user = new UserSession($values);
-
- // Generate and set a D8-compatible session cookie.
- $this->prepareD8Session();
-
- // Restore necessary variables.
- $this->variable_set('site_mail', 'simpletest@example.com');
-
- drupal_set_time_limit($this->timeLimit);
- $this->setup = TRUE;
- }
-
- /**
- * Overrides \Drupal\simpletest\TestBase::prepareConfigDirectories().
- */
- protected function prepareConfigDirectories() {
- // The configuration directories are prepared as part of the first access to
- // update.php.
- }
-
- /**
- * Specialized variable_set() that works even if the child site is not upgraded.
- *
- * @param $name
- * The name of the variable to set.
- * @param $value
- * The value to set. This can be any PHP data type; these functions take care
- * of serialization as necessary.
- *
- * @todo Update for D8 configuration system.
- */
- protected function variable_set($name, $value) {
- db_delete('variable')
- ->condition('name', $name)
- ->execute();
- db_insert('variable')
- ->fields(array(
- 'name' => $name,
- 'value' => serialize($value),
- ))
- ->execute();
-
- try {
- cache()->delete('variables');
- cache('bootstrap')->delete('variables');
- }
- // Since cache_bootstrap won't exist in a Drupal 6 site, ignore the
- // exception if the above fails.
- catch (\Exception $e) {}
- }
-
- /**
- * Specialized refreshVariables().
- */
- protected function refreshVariables() {
- // Refresh the variables only if the site was already upgraded.
- if ($this->upgradedSite) {
- global $conf;
- cache('bootstrap')->delete('variables');
- $conf = variable_initialize();
- $container = drupal_container();
- if ($container->has('config.factory')) {
- $container->get('config.factory')->reset();
- }
- }
- }
-
- /**
- * Perform the upgrade.
- *
- * @param $register_errors
- * Register the errors during the upgrade process as failures.
- * @return
- * TRUE if the upgrade succeeded, FALSE otherwise.
- */
- protected function performUpgrade($register_errors = TRUE) {
-
- // Load the first update screen.
- $this->getUpdatePhp();
- if (!$this->assertResponse(200)) {
- throw new \Exception('Initial GET to update.php did not return HTTP 200 status.');
- }
-
- // Ensure that the first update screen appeared correctly.
- if (!$this->assertFieldByXPath('//input[@type="submit"]')) {
- throw new \Exception('An error was encountered during the first access to update.php.');
- }
-
- // Initialize config directories and rebuild the service container after
- // creating them in the first step.
- parent::prepareConfigDirectories();
- $this->rebuildContainer();
-
- // Continue.
- $this->drupalPostForm(NULL, array(), t('Continue'));
- if (!$this->assertResponse(200)) {
- throw new \Exception('POST to continue update.php did not return HTTP 200 status.');
- }
-
- // The test should pass if there are no pending updates.
- $content = $this->drupalGetContent();
- if (strpos($content, t('No pending updates.')) !== FALSE) {
- $this->pass('No pending updates and therefore no upgrade process to test.');
- $this->pendingUpdates = FALSE;
- return TRUE;
- }
-
- // Go!
- $this->drupalPostForm(NULL, array(), t('Apply pending updates'));
- if (!$this->assertResponse(200)) {
- throw new \Exception('POST to update.php to apply pending updates did not return HTTP 200 status.');
- }
-
- if (!$this->assertNoText(t('An unrecoverable error has occurred.'))) {
- // Error occured during update process.
- throw new \Exception('POST to update.php to apply pending updates detected an unrecoverable error.');
- }
-
- // Check for errors during the update process.
- foreach ($this->xpath('//li[@class=:class]', array(':class' => 'failure')) as $element) {
- $message = strip_tags($element->asXML());
- $this->upgradeErrors[] = $message;
- if ($register_errors) {
- $this->fail($message);
- }
- }
- if (!empty($this->upgradeErrors)) {
- // Upgrade failed, the installation might be in an inconsistent state,
- // don't process.
- throw new \Exception('Errors during update process.');
- }
-
- // Allow tests to check the completion page.
- $this->checkCompletionPage();
-
- // Check if there still are pending updates.
- $this->getUpdatePhp();
- $this->drupalPostForm(NULL, array(), t('Continue'));
- if (!$this->assertText(t('No pending updates.'), 'No pending updates at the end of the update process.')) {
- throw new \Exception('update.php still shows pending updates after execution.');
- }
-
- // Upgrade succeed, rebuild the environment so that we can call the API
- // of the child site directly from this request.
- $this->upgradedSite = TRUE;
-
- // Force a variable refresh as we only just enabled it.
- $this->refreshVariables();
-
- // Reload module list for modules that are enabled in the test database
- // but not on the test client.
- \Drupal::moduleHandler()->resetImplementations();
- \Drupal::moduleHandler()->reload();
-
- // Rebuild the container and all caches.
- $this->rebuildContainer();
- $this->resetAll();
-
- return TRUE;
- }
-
- /**
- * Overrides some core services for the upgrade tests.
- */
- public function containerBuild(ContainerBuilder $container) {
- // Keep the container object around for tests.
- $this->container = $container;
-
- $container
- ->register('config.storage', 'Drupal\Core\Config\FileStorage')
- ->addArgument($this->configDirectories[CONFIG_ACTIVE_DIRECTORY]);
-
- if ($this->container->hasDefinition('path_processor_alias')) {
- // Prevent the alias-based path processor, which requires a url_alias db
- // table, from being registered to the path processor manager. We do this
- // by removing the tags that the compiler pass looks for. This means the
- // url generator can safely be used within upgrade path tests.
- $definition = $this->container->getDefinition('path_processor_alias');
- $definition->clearTag('path_processor_inbound')->clearTag('path_processor_outbound');
- }
- }
-
- /**
- * Gets update.php without calling url().
- *
- * Required since WebTestBase::drupalGet() calls t(), which calls into
- * system_list(), from the parent site/test runner, before update.php is even
- * executed.
- *
- * @see WebTestBase::drupalGet()
- */
- protected function getUpdatePhp() {
- $this->rebuildContainer();
- $path = $GLOBALS['base_url'] . '/core/update.php';
- $out = $this->curlExec(array(CURLOPT_HTTPGET => TRUE, CURLOPT_URL => $path, CURLOPT_NOBODY => FALSE));
- // Ensure that any changes to variables in the other thread are picked up.
- $this->refreshVariables();
-
- // Replace original page output with new output from redirected page(s).
- if ($new = $this->checkForMetaRefresh()) {
- $out = $new;
- }
- $this->verbose('GET request to: ' . $path .
- '<hr />Ending URL: ' . $this->getUrl() .
- '<hr />' . $out);
- return $out;
- }
-
- /**
- * Checks the update.php completion page.
- *
- * Invoked by UpgradePathTestBase::performUpgrade() to allow upgrade tests to
- * check messages and other output on the final confirmation page.
- */
- protected function checkCompletionPage() { }
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/UserPermissionUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/UserPermissionUpgradePathTest.php
deleted file mode 100644
index ecb8b3a..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/UserPermissionUpgradePathTest.php
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\system\Tests\Upgrade\UserPermissionUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-use Drupal\Core\Session\UserSession;
-
-/**
- * Tests upgrading a bare database with user role data.
- *
- * Loads a bare installation of Drupal 7 with role data and runs the
- * upgrade process on it. Tests for the upgrade of user permissions.
- */
-class UserPermissionUpgradePathTest extends UpgradePathTestBase {
- public static function getInfo() {
- return array(
- 'name' => 'User permission upgrade test',
- 'description' => 'Upgrade tests for user permissions.',
- 'group' => 'Upgrade path',
- );
- }
-
- public function setUp() {
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.standard_all.database.php.gz',
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.user_permission.database.php',
- );
- parent::setUp();
- }
-
- /**
- * Tests user-related permissions after a successful upgrade.
- */
- public function testUserPermissionUpgrade() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- $this->drupalGet('');
- $this->assertResponse(200);
-
- // Verify that we are still logged in.
- $this->drupalGet('user');
- $this->clickLink(t('Edit'));
- $this->assertEqual($this->getUrl(), url('user/1/edit', array('absolute' => TRUE)), 'We are still logged in as admin at the end of the upgrade.');
-
- // Login as another 'administrator' role user whose uid != 1
- $this->drupalLogout();
- $user = new UserSession(array(
- 'uid' => 2,
- 'name' => 'user1',
- 'pass_raw' => 'user1',
- ));
- $this->drupalLogin($user);
-
- // Check that user with permission 'administer users' also gets
- // 'administer account settings' access.
- $this->drupalGet('admin/config/people/accounts');
- $this->assertResponse(200, '"Administer account settings" page was found.');
- }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/UserPictureUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/UserPictureUpgradePathTest.php
deleted file mode 100644
index 85822dc..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/UserPictureUpgradePathTest.php
+++ /dev/null
@@ -1,80 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\system\Tests\Upgrade\UserPictureUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-use Drupal\Core\Language\Language;
-
-/**
- * Tests upgrading a filled database with user picture data.
- *
- * Loads a filled installation of Drupal 7 with user picture data and runs the
- * upgrade process on it.
- */
-class UserPictureUpgradePathTest extends UpgradePathTestBase {
-
- public static function getInfo() {
- return array(
- 'name' => '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');
- // We explicitly avoid using the getFieldSetting() method here, since it
- // merges field and instance settings.
- $file = entity_load('file', $instance->settings['default_image']['fid']);
- $this->assertTrue($file, 'Default user picture has been migrated.');
- $this->assertEqual($file->getFileUri(), 'public://user_pictures_dir/druplicon.png', 'File id matches the uri expected.');
- $this->assertEqual($file->getFilename(), 'druplicon.png');
- $this->assertEqual($file->langcode->value, Language::LANGCODE_NOT_SPECIFIED);
- $this->assertEqual($file->getMimeType(), 'image/png');
- $this->assertFalse(empty($file->uuid->value));
-
- // Check file usage for the default image.
- $usage = file_usage()->listUsage($file);
- $field = field_info_field('user', 'user_picture');
- $this->assertTrue(isset($usage['image']['default_image'][$field->uuid()]));
-
- $this->assertEqual($instance->getFieldSetting('max_resolution'), '800x800', 'User picture maximum resolution has been migrated.');
- $this->assertEqual($instance->getFieldSetting('max_filesize'), '700 KB', 'User picture maximum filesize has been migrated.');
- $this->assertEqual($instance->getFieldDescription(), 'These are user picture guidelines.', 'User picture guidelines are now the user picture field description.');
- $this->assertEqual($instance->getFieldSetting('file_directory'), 'user_pictures_dir', 'User picture directory path has been migrated.');
-
- $display_options = entity_get_display('user', 'user', 'default')->getComponent('user_picture');
- $this->assertEqual($display_options['settings']['image_style'], 'thumbnail', 'User picture image style setting has been migrated.');
-
- // Verify compact view mode default settings.
- $this->drupalGet('admin/config/people/accounts/display/compact');
- $this->assertFieldByName('fields[member_for][type]', 'hidden');
-
- // Check the user picture and file usage record.
- $user = user_load(1);
- $file = $user->user_picture->entity;
- $this->assertEqual('public://user_pictures_dir/faked_image.png', $file->getFileUri());
- $usage = file_usage()->listUsage($file);
- $this->assertEqual(1, $usage['file']['user'][1]);
- }
-
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/UserRoleUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/UserRoleUpgradePathTest.php
deleted file mode 100644
index a58da9d..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/UserRoleUpgradePathTest.php
+++ /dev/null
@@ -1,93 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\system\Tests\Upgrade\UserRoleUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-/**
- * Tests upgrading a bare database with user role data.
- *
- * Loads a bare installation of Drupal 7 with role data and runs the
- * upgrade process on it. Tests for the conversion of serial role IDs to role
- * machine names.
- */
-class UserRoleUpgradePathTest extends UpgradePathTestBase {
- public static function getInfo() {
- return array(
- 'name' => 'Role upgrade test',
- 'description' => 'Upgrade tests with role data.',
- 'group' => 'Upgrade path',
- );
- }
-
- public function setUp() {
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.standard_all.database.php.gz',
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.roles.database.php',
- );
- parent::setUp();
- }
-
- /**
- * Tests expected role ID conversions after a successful upgrade.
- */
- public function testRoleUpgrade() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- // Check that "gärtner" has been converted to "4" and that the role
- // edit page for it exists.
- $this->drupalGet('admin/people/roles/manage/4');
- $this->assertResponse(200, 'Role edit page for "gärtner" was found.');
- $this->assertField('label', 'Role edit page for "gärtner" was found.');
- $this->assertRaw('gärtner', 'Role edit page for "gärtner" was found.');
-
- // Check that the anonymous user role ID has been converted from "1" to
- // "anonymous".
- $this->drupalGet('admin/people/permissions/' . DRUPAL_ANONYMOUS_RID);
- $this->assertResponse(200, 'Permission edit page for "anonymous" was found.');
-
- // Check that the authenticated user role ID has been converted from "2" to
- // "authenticated".
- $this->drupalGet('admin/people/permissions/' . DRUPAL_AUTHENTICATED_RID);
- $this->assertResponse(200, 'Permission edit page for "authenticated" was found.');
-
- // Check that the permission for "gärtner" still exists.
- $this->drupalGet('admin/people/permissions/4');
- $this->assertFieldChecked('edit-4-edit-own-comments', 'Edit own comments permission for "gärtner" is set correctly.');
-
- // Check that the role visibility setting for the who's online block still
- // exists.
- $this->drupalGet('admin/structure/block/add/user_online_block/bartik');
-
- // @todo Blocks are not being upgraded.
- // $this->assertFieldChecked('edit-visibility-role-roles-5', "Who's online block visibility setting is correctly set for the long role name.");
-
- // Check that the role name is still displayed as expected.
- $this->assertText('gärtner', 'Role name is displayed on block visibility settings.');
- $this->assertText('very long role name that has exactly sixty-four characters in it', 'Role name is displayed on block visibility settings.');
- $this->assertText('very_long role name that has exactly sixty-four characters in it', 'Role name is displayed on block visibility settings.');
-
- // The administrative user role must still be assigned to the
- // "administrator" role (rid 3).
- $this->drupalGet('admin/config/people/accounts');
- $this->assertFieldByName('user_admin_role', 3);
- }
-
- /**
- * Tests that roles were converted to config.
- */
- public function testRoleUpgradeToConfig() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- // Check that the 'anonymous' role has been converted to config.
- $anonymous = entity_load('user_role', DRUPAL_ANONYMOUS_RID);
- $this->assertNotEqual(FALSE, $anonymous, "The 'anonymous' role has been converted to config.");
-
- // Check that the 'authenticated' role has been converted to config.
- $authenticated = entity_load('user_role', DRUPAL_AUTHENTICATED_RID);
- $this->assertNotEqual(FALSE, $authenticated, "The 'authenticated' role has been converted to config.");
- }
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/UuidUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/UuidUpgradePathTest.php
deleted file mode 100644
index 3299d22..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/UuidUpgradePathTest.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\system\Tests\Upgrade\UuidUpgradePathTest.
- */
-
-namespace Drupal\system\Tests\Upgrade;
-
-/**
- * Performs major version release upgrade tests on a populated database.
- *
- * Loads an installation of Drupal 7.x and runs the upgrade process on it.
- *
- * The install contains the minimal profile modules (along with generated
- * content) so that an update from of a site under this profile may be tested.
- */
-class UuidUpgradePathTest extends UpgradePathTestBase {
- public static function getInfo() {
- return array(
- 'name' => 'UUID upgrade test',
- 'description' => 'Upgrade tests for a node and user data.',
- 'group' => 'Upgrade path',
- );
- }
-
- public function setUp() {
- // Path to the database dump files.
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.filled.standard_all.database.php.gz',
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.language.database.php',
- );
- parent::setUp();
- }
-
- /**
- * Tests a successful point release update.
- */
- public function testUuidUpgrade() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- // Confirm that all {node} entries has uuid.
- $result = db_query('SELECT COUNT(*) FROM {comment} WHERE uuid IS NULL')->fetchField();
- $this->assertFalse($result, 'All comments has uuid assigned');
-
- // Confirm that all {node} entries has uuid.
- $result = db_query('SELECT COUNT(*) FROM {file_managed} WHERE uuid IS NULL')->fetchField();
- $this->assertFalse($result, 'All files has uuid assigned');
-
- // Confirm that all {node} entries has uuid.
- $result = db_query('SELECT COUNT(*) FROM {node} WHERE uuid IS NULL')->fetchField();
- $this->assertFalse($result, 'All nodes has uuid assigned');
-
- // Confirm that all {node} entries has uuid.
- $result = db_query('SELECT COUNT(*) FROM {taxonomy_term_data} WHERE uuid IS NULL')->fetchField();
- $this->assertFalse($result, 'All taxonomy terms has uuid assigned');
-
- // Confirm that all {user} entries has uuid.
- $result = db_query('SELECT COUNT(*) FROM {users} WHERE uuid IS NULL')->fetchField();
- $this->assertFalse($result, 'All users has uuid assigned');
- }
-}
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyUpgradePathTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyUpgradePathTest.php
deleted file mode 100644
index b288636..0000000
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyUpgradePathTest.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\taxonomy\Tests\TaxonomyUpgradePathTest.
- */
-
-namespace Drupal\taxonomy\Tests;
-
-use Drupal\system\Tests\Upgrade\UpgradePathTestBase;
-
-/**
- * Tests upgrade of taxonomy variables.
- */
-class TaxonomyUpgradePathTest extends UpgradePathTestBase {
-
- public static function getInfo() {
- return array(
- 'name' => 'Taxonomy upgrade test',
- 'description' => 'Tests upgrade of Taxonomy module.',
- 'group' => 'Upgrade path',
- );
- }
-
- public function setUp() {
- $this->databaseDumpFiles = array(
- drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.standard_all.database.php.gz',
- drupal_get_path('module', 'taxonomy') . '/tests/upgrade/drupal-7.taxonomy.database.php',
- );
- parent::setUp();
- }
-
- /**
- * Tests upgrade of taxonomy_term_reference field default values.
- */
- public function testEntityDisplayUpgrade() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
- // Check that the configuration entries were created.
- $config_entity = \Drupal::config('field.instance.node.article.field_tags')->get();
- $this->assertTrue(!empty($config_entity), 'Config entity has been created');
- $this->assertTrue(!empty($config_entity['default_value'][0]['target_uuid']), 'Default value contains target_uuid property');
-
- // Load taxonomy term to check UUID conversion.
- $taxonomy_term = entity_load('taxonomy_term', 2);
-
- // Check that default_value has been converted to Drupal 8 structure.
- $this->assertEqual($taxonomy_term->uuid(), $config_entity['default_value'][0]['target_uuid'], 'Default value contains the right target_uuid');
- $this->assertEqual('', $config_entity['default_value'][0]['revision_id'], 'Default value contains the right revision_id');
- }
-
-}