Mercurial > hg > isophonics-drupal-site
comparison core/modules/system/tests/fixtures/update/drupal-8.block-test-enabled.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 /** | |
4 * @file | |
5 * Partial database to mimic the installation of the block_test module. | |
6 */ | |
7 | |
8 use Drupal\Core\Database\Database; | |
9 use Symfony\Component\Yaml\Yaml; | |
10 | |
11 $connection = Database::getConnection(); | |
12 | |
13 // Set the schema version. | |
14 $connection->insert('key_value') | |
15 ->fields([ | |
16 'collection' => 'system.schema', | |
17 'name' => 'block_test', | |
18 'value' => 'i:8000;', | |
19 ]) | |
20 ->execute(); | |
21 | |
22 // Update core.extension. | |
23 $extensions = $connection->select('config') | |
24 ->fields('config', ['data']) | |
25 ->condition('collection', '') | |
26 ->condition('name', 'core.extension') | |
27 ->execute() | |
28 ->fetchField(); | |
29 $extensions = unserialize($extensions); | |
30 $extensions['module']['block_test'] = 8000; | |
31 $connection->update('config') | |
32 ->fields([ | |
33 'data' => serialize($extensions), | |
34 ]) | |
35 ->condition('collection', '') | |
36 ->condition('name', 'core.extension') | |
37 ->execute(); | |
38 | |
39 // Install the block configuration. | |
40 $config = file_get_contents(__DIR__ . '/../../../../block/tests/modules/block_test/config/install/block.block.test_block.yml'); | |
41 $config = Yaml::parse($config); | |
42 $connection->insert('config') | |
43 ->fields(['data', 'name', 'collection']) | |
44 ->values([ | |
45 'name' => 'block.block.test_block', | |
46 'data' => serialize($config), | |
47 'collection' => '', | |
48 ]) | |
49 ->execute(); |