Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/screenshot-testing/support/test-environment.js')
-rw-r--r--tests/lib/screenshot-testing/support/test-environment.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/lib/screenshot-testing/support/test-environment.js b/tests/lib/screenshot-testing/support/test-environment.js
index 700493f933..01914c8c24 100644
--- a/tests/lib/screenshot-testing/support/test-environment.js
+++ b/tests/lib/screenshot-testing/support/test-environment.js
@@ -25,6 +25,7 @@ TestingEnvironment.prototype.reload = function () {
this['useOverrideJs'] = true;
this['loadRealTranslations'] = true; // UI tests should test w/ real translations, not translation keys
this['testUseMockAuth'] = true;
+ this['configOverride'] = {};
if (fs.exists(testingEnvironmentOverridePath)) {
var data = JSON.parse(fs.read(testingEnvironmentOverridePath));
@@ -34,6 +35,33 @@ TestingEnvironment.prototype.reload = function () {
}
};
+/**
+ * Overrides a config entry.
+ *
+ * You can use this method either to set one specific config value `overrideConfig(group, name, value)`
+ * or you can set a whole group of values `overrideConfig(group, valueObject)`.
+ */
+TestingEnvironment.prototype.overrideConfig = function (group, name, value) {
+ if (!name) {
+ return;
+ }
+
+ if (!this['configOverride']) {
+ this['configOverride'] = {};
+ }
+
+ if ((typeof value) === 'undefined') {
+ this['configOverride'][group] = name;
+ return;
+ }
+
+ if (!this['configOverride'][group]) {
+ this['configOverride'][group] = {};
+ }
+
+ this['configOverride'][group][name] = value;
+};
+
TestingEnvironment.prototype.save = function () {
var copy = {};
for (var key in this) {