From d9aef0c397045484a3848106b57de99f7cdeddbe Mon Sep 17 00:00:00 2001
From: Thomas Steur <thomas.steur@googlemail.com>
Date: Wed, 29 Oct 2014 04:39:11 +0100
Subject: [PATCH] a simple parser to get the configured username and password
 if possible

---
 tests/PHPUnit/UI                              |  2 +-
 .../support/test-environment.js               | 29 +++++++++++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/tests/PHPUnit/UI b/tests/PHPUnit/UI
index 5ae55908f0..9783942469 160000
--- a/tests/PHPUnit/UI
+++ b/tests/PHPUnit/UI
@@ -1 +1 @@
-Subproject commit 5ae55908f0aa5112ec9bf4e2913c3a9fc680cfd7
+Subproject commit 978394246973b7ad97ae41df6b83cb3ab08a7b93
diff --git a/tests/lib/screenshot-testing/support/test-environment.js b/tests/lib/screenshot-testing/support/test-environment.js
index 7c0911d5cc..d7d837bec3 100644
--- a/tests/lib/screenshot-testing/support/test-environment.js
+++ b/tests/lib/screenshot-testing/support/test-environment.js
@@ -163,6 +163,35 @@ TestingEnvironment.prototype.setupFixture = function (fixtureClass, done) {
     });
 };
 
+TestingEnvironment.prototype.readDbInfoFromConfig = function () {
+
+    var username = 'root';
+    var password = '';
+
+    var pathConfigIni = path.join(PIWIK_INCLUDE_PATH, "/config/config.ini.php");
+
+    var configFile = fs.read(pathConfigIni);
+
+    if (configFile) {
+        var match = ('' + configFile).match(/password\s?=\s?"(.*)"/);
+
+        if (match && match.length) {
+            password = match[1];
+        }
+
+        match = ('' + configFile).match(/username\s?=\s?"(.*)"/);
+
+        if (match && match.length) {
+            username = match[1];
+        }
+    }
+
+    return {
+        username: username,
+        password: password
+    }
+};
+
 TestingEnvironment.prototype.teardownFixture = function (fixtureClass, done) {
     if (options['persist-fixture-data']
         || !fixtureClass
-- 
GitLab