rest-export-with-authentication-correction.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * @file
  4. * Test fixture for \Drupal\rest\Tests\Update\RestExportAuthCorrectionUpdateTest.
  5. */
  6. use Drupal\Core\Database\Database;
  7. use Drupal\Core\Serialization\Yaml;
  8. $connection = Database::getConnection();
  9. // Set the schema version.
  10. $connection->insert('key_value')
  11. ->fields([
  12. 'collection' => 'system.schema',
  13. 'name' => 'rest',
  14. 'value' => 'i:8000;',
  15. ])
  16. ->execute();
  17. // Update core.extension.
  18. $extensions = $connection->select('config')
  19. ->fields('config', ['data'])
  20. ->condition('collection', '')
  21. ->condition('name', 'core.extension')
  22. ->execute()
  23. ->fetchField();
  24. $extensions = unserialize($extensions);
  25. $extensions['module']['rest'] = 0;
  26. $extensions['module']['serialization'] = 0;
  27. $extensions['module']['basic_auth'] = 0;
  28. $connection->update('config')
  29. ->fields([
  30. 'data' => serialize($extensions),
  31. ])
  32. ->condition('collection', '')
  33. ->condition('name', 'core.extension')
  34. ->execute();
  35. $connection->insert('config')
  36. ->fields([
  37. 'name' => 'rest.settings',
  38. 'data' => serialize([
  39. 'link_domain' => '~',
  40. ]),
  41. 'collection' => '',
  42. ])
  43. ->execute();
  44. $connection->insert('config')
  45. ->fields([
  46. 'name' => 'views.view.rest_export_with_authorization_correction',
  47. ])
  48. ->execute();
  49. $connection->merge('config')
  50. ->condition('name', 'views.view.rest_export_with_authorization_correction')
  51. ->condition('collection', '')
  52. ->fields([
  53. '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'))),
  54. ])
  55. ->execute();