Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / modules / migrate_drupal_ui / tests / src / Functional / d7 / MigrateUpgrade7NoMultilingualTest.php
1 <?php
2
3 namespace Drupal\Tests\migrate_drupal_ui\Functional\d7;
4
5 use Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeExecuteTestBase;
6
7 /**
8  * Tests Drupal 6 upgrade without translations.
9  *
10  * The test method is provided by the MigrateUpgradeTestBase class.
11  *
12  * @group migrate_drupal_ui
13  */
14 class MigrateUpgrade7NoMultilingualTest extends MigrateUpgradeExecuteTestBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public static $modules = [
20     'file',
21     'language',
22     'content_translation',
23     'config_translation',
24     'migrate_drupal_ui',
25     'telephone',
26     'aggregator',
27     'book',
28     'forum',
29     'statistics',
30   ];
31
32   /**
33    * {@inheritdoc}
34    */
35   protected function setUp() {
36     parent::setUp();
37     $this->loadFixture(drupal_get_path('module', 'migrate_drupal') . '/tests/fixtures/drupal7.php');
38   }
39
40   /**
41    * {@inheritdoc}
42    */
43   protected function getSourceBasePath() {
44     return __DIR__ . '/files';
45   }
46
47   /**
48    * {@inheritdoc}
49    */
50   protected function getEntityCounts() {
51     return [
52       'aggregator_item' => 11,
53       'aggregator_feed' => 1,
54       'block' => 25,
55       'block_content' => 1,
56       'block_content_type' => 1,
57       'comment' => 2,
58       // The 'standard' profile provides the 'comment' comment type, and the
59       // migration creates 6 comment types, one per node type.
60       'comment_type' => 7,
61       // Module 'language' comes with 'en', 'und', 'zxx'. Migration adds 'is'.
62       'configurable_language' => 4,
63       'contact_form' => 3,
64       'editor' => 2,
65       'field_config' => 68,
66       'field_storage_config' => 50,
67       'file' => 3,
68       'filter_format' => 7,
69       'image_style' => 6,
70       'language_content_settings' => 2,
71       'migration' => 73,
72       'node' => 5,
73       'node_type' => 6,
74       'rdf_mapping' => 8,
75       'search_page' => 2,
76       'shortcut' => 6,
77       'shortcut_set' => 2,
78       'action' => 17,
79       'menu' => 6,
80       'taxonomy_term' => 18,
81       'taxonomy_vocabulary' => 4,
82       'tour' => 4,
83       'user' => 4,
84       'user_role' => 3,
85       'menu_link_content' => 10,
86       'view' => 16,
87       'date_format' => 11,
88       'entity_form_display' => 17,
89       'entity_form_mode' => 1,
90       'entity_view_display' => 28,
91       'entity_view_mode' => 14,
92       'base_field_override' => 9,
93     ];
94   }
95
96   /**
97    * {@inheritdoc}
98    */
99   protected function getEntityCountsIncremental() {
100     $counts = $this->getEntityCounts();
101     $counts['block_content'] = 2;
102     $counts['comment'] = 3;
103     $counts['file'] = 4;
104     $counts['menu_link_content'] = 11;
105     $counts['node'] = 6;
106     $counts['taxonomy_term'] = 19;
107     $counts['user'] = 5;
108     return $counts;
109   }
110
111   /**
112    * {@inheritdoc}
113    */
114   protected function getAvailablePaths() {
115     return [
116       'aggregator',
117       'block',
118       'book',
119       'color',
120       'comment',
121       'contact',
122       'date',
123       'dblog',
124       'email',
125       'entityreference',
126       'field',
127       'field_sql_storage',
128       'file',
129       'filter',
130       'forum',
131       'image',
132       'language',
133       'link',
134       'list',
135       'locale',
136       'menu',
137       'node',
138       'number',
139       'options',
140       'path',
141       'phone',
142       'rdf',
143       'search',
144       'shortcut',
145       'statistics',
146       'system',
147       'taxonomy',
148       'text',
149       'user',
150       // Include modules that do not have an upgrade path and are enabled in the
151       // source database, defined in the $noUpgradePath property
152       // in MigrateUpgradeForm.
153       'blog',
154       'contextual',
155       'date_api',
156       'entity',
157       'field_ui',
158       'help',
159       'php',
160       'simpletest',
161       'toolbar',
162       'translation',
163       'trigger',
164     ];
165   }
166
167   /**
168    * {@inheritdoc}
169    */
170   protected function getMissingPaths() {
171     return [
172       // These modules are in the missing path list because they are installed
173       // on the source site but they are not installed on the destination site.
174       'syslog',
175       'tracker',
176       'update',
177     ];
178   }
179
180   /**
181    * {@inheritdoc}
182    */
183   public function testMigrateUpgradeExecute() {
184     $connection_options = $this->sourceDatabase->getConnectionOptions();
185     $this->drupalGet('/upgrade');
186     $session = $this->assertSession();
187     $session->responseContains('Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal 8.');
188
189     $button = $session->buttonExists('Continue');
190     $button->click();
191     $session->pageTextContains('Provide credentials for the database of the Drupal site you want to upgrade.');
192
193     $driver = $connection_options['driver'];
194     $connection_options['prefix'] = $connection_options['prefix']['default'];
195
196     // Use the driver connection form to get the correct options out of the
197     // database settings. This supports all of the databases we test against.
198     $drivers = drupal_get_database_types();
199     $form = $drivers[$driver]->getFormOptions($connection_options);
200     $connection_options = array_intersect_key($connection_options, $form + $form['advanced_options']);
201     $version = $this->getLegacyDrupalVersion($this->sourceDatabase);
202     $edit = [
203       $driver => $connection_options,
204       'version' => $version,
205     ];
206     if (count($drivers) !== 1) {
207       $edit['driver'] = $driver;
208     }
209     $edits = $this->translatePostValues($edit);
210     $this->drupalPostForm(NULL, $edits, t('Review upgrade'));
211     $session->pageTextContains("Install migrate_drupal_multilingual to run migration 'd7_system_maintenance_translation'.");
212   }
213
214 }