6cbd04e8b03ec0177c04436551803a295c08abb7
[yaffs-website] / web / core / modules / rest / tests / fixtures / update / rest-export-with-authentication-correction.php
1 <?php
2
3 /**
4  * @file
5  * Test fixture for \Drupal\rest\Tests\Update\RestExportAuthCorrectionUpdateTest.
6  */
7
8 use Drupal\Core\Database\Database;
9 use Drupal\Core\Serialization\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' => 'rest',
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']['rest'] = 0;
31 $extensions['module']['serialization'] = 0;
32 $extensions['module']['basic_auth'] = 0;
33 $connection->update('config')
34   ->fields([
35     'data' => serialize($extensions),
36   ])
37   ->condition('collection', '')
38   ->condition('name', 'core.extension')
39   ->execute();
40
41 $connection->insert('config')
42   ->fields([
43     'name' => 'rest.settings',
44     'data' => serialize([
45       'link_domain' => '~',
46     ]),
47     'collection' => '',
48   ])
49   ->execute();
50
51 $connection->insert('config')
52   ->fields([
53     'name' => 'views.view.rest_export_with_authorization_correction',
54   ])
55   ->execute();
56
57 $connection->merge('config')
58   ->condition('name', 'views.view.rest_export_with_authorization_correction')
59   ->condition('collection', '')
60   ->fields([
61     'data' => serialize(Yaml::decode(file_get_contents('core/modules/views/tests/modules/views_test_config/test_views/views.view.rest_export_with_authorization_correction.yml'))),
62   ])
63   ->execute();