Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / config / tests / config_override_test / src / ConfigOverrider.php
1 <?php
2
3 namespace Drupal\config_override_test;
4
5 use Drupal\Core\Cache\CacheableMetadata;
6 use Drupal\Core\Config\ConfigFactoryOverrideInterface;
7
8 /**
9  * Tests module overrides for configuration.
10  */
11 class ConfigOverrider implements ConfigFactoryOverrideInterface {
12
13   /**
14    * {@inheritdoc}
15    */
16   public function loadOverrides($names) {
17     $overrides = [];
18     if (!empty($GLOBALS['config_test_run_module_overrides'])) {
19       if (in_array('system.site', $names)) {
20         $overrides = $overrides + ['system.site' => ['name' => 'ZOMG overridden site name']];
21       }
22       if (in_array('config_override_test.new', $names)) {
23         $overrides = $overrides + ['config_override_test.new' => ['module' => 'override']];
24       }
25     }
26     return $overrides;
27   }
28
29   /**
30    * {@inheritdoc}
31    */
32   public function getCacheSuffix() {
33     return 'ConfigOverrider';
34   }
35
36   /**
37    * {@inheritdoc}
38    */
39   public function createConfigObject($name, $collection = StorageInterface::DEFAULT_COLLECTION) {
40     return NULL;
41   }
42
43   /**
44    * {@inheritdoc}
45    */
46   public function getCacheableMetadata($name) {
47     return new CacheableMetadata();
48   }
49
50 }