Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / system / tests / src / Kernel / Migrate / d7 / MigrateSystemConfigurationTest.php
1 <?php
2
3 namespace Drupal\Tests\system\Kernel\Migrate\d7;
4
5 use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
6
7 /**
8  * Migrates various configuration objects owned by the System module.
9  *
10  * @group migrate_drupal_7
11  */
12 class MigrateSystemConfigurationTest extends MigrateDrupal7TestBase {
13
14   public static $modules = ['action', 'file', 'system'];
15
16   protected $expectedConfig = [
17     'system.authorize' => [
18       'filetransfer_default' => 'ftp',
19     ],
20     'system.cron' => [
21       'threshold' => [
22         // autorun is not handled by the migration.
23         // 'autorun' => 0,
24         'requirements_warning' => 172800,
25         'requirements_error' => 1209600,
26       ],
27       'logging' => 1,
28     ],
29     'system.date' => [
30       'country' => [
31         'default' => 'US',
32       ],
33       'first_day' => 1,
34       'timezone' => [
35         'default' => 'America/Chicago',
36         'user' => [
37           'configurable' => TRUE,
38           'warn' => TRUE,
39           // DRUPAL_USER_TIMEZONE_SELECT (D7 API)
40           'default' => 2,
41         ],
42       ],
43     ],
44     'system.file' => [
45       'allow_insecure_uploads' => TRUE,
46       // default_scheme is not handled by the migration.
47       'default_scheme' => 'public',
48       'path' => [
49         'temporary' => '/tmp',
50       ],
51       // temporary_maximum_age is not handled by the migration.
52       'temporary_maximum_age' => 21600,
53     ],
54     'system.image.gd' => [
55       'jpeg_quality' => 80,
56     ],
57     'system.image' => [
58       'toolkit' => 'gd',
59     ],
60     'system.logging' => [
61       'error_level' => 'some',
62     ],
63     'system.mail' => [
64       'interface' => [
65         'default' => 'php_mail',
66       ],
67     ],
68     'system.maintenance' => [
69       'message' => 'This is a custom maintenance mode message.',
70       // langcode is not handled by the migration.
71       'langcode' => 'en',
72     ],
73     'system.performance' => [
74       'cache' => [
75         'page' => [
76           'max_age' => 300,
77         ],
78       ],
79       'css' => [
80         'preprocess' => TRUE,
81         // gzip is not handled by the migration.
82         'gzip' => TRUE,
83       ],
84       // fast_404 is not handled by the migration.
85       'fast_404' => [
86         'enabled' => TRUE,
87         'paths' => '/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/i',
88         'exclude_paths' => '/\/(?:styles|imagecache)\//',
89         'html' => '<!DOCTYPE html><html><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL "@path" was not found on this server.</p></body></html>',
90       ],
91       'js' => [
92         'preprocess' => FALSE,
93         // gzip is not handled by the migration.
94         'gzip' => TRUE,
95       ],
96       // stale_file_threshold is not handled by the migration.
97       'stale_file_threshold' => 2592000,
98     ],
99     'system.rss' => [
100       'channel' => [
101         'description' => '',
102       ],
103       'items' => [
104         'limit' => 27,
105         'view_mode' => 'fulltext',
106       ],
107       'langcode' => 'en',
108     ],
109     'system.site' => [
110       // uuid is not handled by the migration.
111       'uuid' => '',
112       'name' => 'The Site Name',
113       'mail' => 'joseph@flattandsons.com',
114       'slogan' => 'The Slogan',
115       'page' => [
116         '403' => '/node',
117         '404' => '/node',
118         'front' => '/node',
119       ],
120       'admin_compact_mode' => TRUE,
121       'weight_select_max' => 40,
122       // langcode and default_langcode are not handled by the migration.
123       'langcode' => 'en',
124       'default_langcode' => 'en',
125     ],
126   ];
127
128   /**
129    * {@inheritdoc}
130    */
131   protected function setUp() {
132     parent::setUp();
133
134     $migrations = [
135       'd7_system_authorize',
136       'd7_system_cron',
137       'd7_system_date',
138       'd7_system_file',
139       'system_image_gd',
140       'system_image',
141       'system_logging',
142       'd7_system_mail',
143       'system_maintenance',
144       'd7_system_performance',
145       'system_rss',
146       'system_site',
147     ];
148     $this->executeMigrations($migrations);
149   }
150
151   /**
152    * Tests that all expected configuration gets migrated.
153    */
154   public function testConfigurationMigration() {
155     foreach ($this->expectedConfig as $config_id => $values) {
156       if ($config_id == 'system.mail') {
157         $actual = \Drupal::config($config_id)->getRawData();
158       }
159       else {
160         $actual = \Drupal::config($config_id)->get();
161       }
162       unset($actual['_core']);
163       $this->assertSame($actual, $values, $config_id . ' matches expected values.');
164     }
165   }
166
167 }