1 | <?php |
||
16 | class ConfigContext extends RawDrupalContext implements TranslatableContext { |
||
17 | |||
18 | /** |
||
19 | * {@inheritDoc} |
||
20 | */ |
||
21 | public static function getTranslationResources() { |
||
22 | return glob(__DIR__ . '/../../../../i18n/*.xliff'); |
||
23 | } |
||
24 | |||
25 | /** |
||
26 | * Keep track of any config that was changed so they can easily be reverted. |
||
27 | * |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $config = array(); |
||
31 | |||
32 | /** |
||
33 | * Revert any changed config. |
||
34 | * |
||
35 | * @AfterScenario |
||
36 | */ |
||
37 | public function cleanConfig() { |
||
38 | // Revert config that was changed. |
||
39 | foreach ($this->config as $name => $key_value) { |
||
40 | foreach ($key_value as $key => $value) { |
||
41 | $this->getDriver()->configSet($name, $key, $value); |
||
42 | } |
||
43 | } |
||
44 | $this->config = array(); |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Sets basic configuration item. |
||
49 | * |
||
50 | * @param string $name |
||
51 | * The name of the configuration object. |
||
52 | * @param string $key |
||
53 | * Identifier to store value in configuration. |
||
54 | * @param mixed $value |
||
55 | * Value to associate with identifier. |
||
56 | * |
||
57 | * @Given I set the configuration item :name with key :key to :value |
||
58 | */ |
||
59 | public function setBasicConfig($name, $key, $value) { |
||
62 | |||
63 | /** |
||
64 | * Sets complex configuration. |
||
65 | * |
||
66 | * @param string $name |
||
67 | * The name of the configuration object. |
||
68 | * @param string $key |
||
69 | * Identifier to store value in configuration. |
||
70 | * @param TableNode $config_table |
||
71 | * The table listing configuration keys and values. |
||
72 | * |
||
73 | * @Given I set the configuration item :name with key :key with values: |
||
74 | * |
||
75 | * Provide configuration data in the following format: |
||
76 | * | key | value | |
||
77 | * | foo | bar | |
||
78 | */ |
||
79 | public function setComplexConfig($name, $key, TableNode $config_table) { |
||
90 | |||
91 | /** |
||
92 | * Sets a value in a configuration object. |
||
93 | * |
||
94 | * @param string $name |
||
95 | * The name of the configuration object. |
||
96 | * @param string $key |
||
97 | * Identifier to store value in configuration. |
||
98 | * @param mixed $value |
||
99 | * Value to associate with identifier. |
||
100 | */ |
||
101 | public function setConfig($name, $key, $value) { |
||
106 | |||
107 | } |