comparison core/modules/system/tests/fixtures/update/drupal-8.test-config-init.php @ 4:a9cd425dd02b

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:11:55 +0000
parents
children
comparison
equal deleted inserted replaced
3:307d7a7fd348 4:a9cd425dd02b
1 <?php
2 // @codingStandardsIgnoreFile
3
4 use Drupal\Core\Database\Database;
5
6 $connection = Database::getConnection();
7
8 // Manually configure the test mail collector implementation to prevent
9 // tests from sending out emails and collect them in state instead.
10 // While this should be enforced via settings.php prior to installation,
11 // some tests expect to be able to test mail system implementations.
12 $config = $connection->select('config')
13 ->fields('config', ['data'])
14 ->condition('collection', '')
15 ->condition('name', 'system.mail')
16 ->execute()
17 ->fetchField();
18 $config = unserialize($config);
19 $config['interface']['default'] = 'test_mail_collector';
20 $connection->update('config')
21 ->fields([
22 'data' => serialize($config),
23 'collection' => '',
24 'name' => 'system.mail',
25 ])
26 ->condition('collection', '')
27 ->condition('name', 'system.mail')
28 ->execute();
29
30 // By default, verbosely display all errors and disable all production
31 // environment optimizations for all tests to avoid needless overhead and
32 // ensure a sane default experience for test authors.
33 // @see https://www.drupal.org/node/2259167
34 $config = $connection->select('config')
35 ->fields('config', ['data'])
36 ->condition('collection', '')
37 ->condition('name', 'system.logging')
38 ->execute()
39 ->fetchField();
40 $config = unserialize($config);
41 $config['error_level'] = 'verbose';
42 $connection->update('config')
43 ->fields([
44 'data' => serialize($config),
45 'collection' => '',
46 'name' => 'system.logging',
47 ])
48 ->condition('collection', '')
49 ->condition('name', 'system.logging')
50 ->execute();
51
52 $config = $connection->select('config')
53 ->fields('config', ['data'])
54 ->condition('collection', '')
55 ->condition('name', 'system.performance')
56 ->execute()
57 ->fetchField();
58 $config = unserialize($config);
59 $config['css']['preprocess'] = FALSE;
60 $config['js']['preprocess'] = FALSE;
61 $connection->update('config')
62 ->fields([
63 'data' => serialize($config),
64 'collection' => '',
65 'name' => 'system.performance',
66 ])
67 ->condition('collection', '')
68 ->condition('name', 'system.performance')
69 ->execute();
70
71 // Set an explicit time zone to not rely on the system one, which may vary
72 // from setup to setup. The Australia/Sydney time zone is chosen so all
73 // tests are run using an edge case scenario (UTC10 and DST). This choice
74 // is made to prevent time zone related regressions and reduce the
75 // fragility of the testing system in general.
76 $config = $connection->select('config')
77 ->fields('config', ['data'])
78 ->condition('collection', '')
79 ->condition('name', 'system.date')
80 ->execute()
81 ->fetchField();
82 $config = unserialize($config);
83 $config['timezone']['default'] = 'Australia/Sydney';
84 $connection->update('config')
85 ->fields([
86 'data' => serialize($config),
87 'collection' => '',
88 'name' => 'system.date',
89 ])
90 ->condition('collection', '')
91 ->condition('name', 'system.date')
92 ->execute();