Skip to content
Extraits de code Groupes Projets
Valider af74cb78 rédigé par diosmosis's avatar diosmosis
Parcourir les fichiers

By default, use real Access instance in test DI config. In UI tests, default to using mock access.

parent c499a3f3
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -42,7 +42,7 @@ return array( ...@@ -42,7 +42,7 @@ return array(
array('Access.createAccessSingleton', function ($access) { array('Access.createAccessSingleton', function ($access) {
$testingEnvironment = new TestingEnvironment(); $testingEnvironment = new TestingEnvironment();
if (!$testingEnvironment->testUseRegularAuth) { if ($testingEnvironment->testUseMockAuth) {
$access = new Piwik_MockAccess($access); $access = new Piwik_MockAccess($access);
\Piwik\Access::setSingletonInstance($access); \Piwik\Access::setSingletonInstance($access);
} }
......
...@@ -14,7 +14,7 @@ describe("Installation", function () { ...@@ -14,7 +14,7 @@ describe("Installation", function () {
this.fixture = null; this.fixture = null;
before(function () { before(function () {
testEnvironment.testUseRegularAuth = 1; testEnvironment.testUseMockAuth = 0;
testEnvironment.configFileLocal = path.join(PIWIK_INCLUDE_PATH, "/tmp/test.config.ini.php"); testEnvironment.configFileLocal = path.join(PIWIK_INCLUDE_PATH, "/tmp/test.config.ini.php");
testEnvironment.dontUseTestConfig = true; testEnvironment.dontUseTestConfig = true;
testEnvironment.tablesPrefix = 'piwik_'; testEnvironment.tablesPrefix = 'piwik_';
...@@ -29,7 +29,7 @@ describe("Installation", function () { ...@@ -29,7 +29,7 @@ describe("Installation", function () {
delete testEnvironment.configFileLocal; delete testEnvironment.configFileLocal;
delete testEnvironment.dontUseTestConfig; delete testEnvironment.dontUseTestConfig;
delete testEnvironment.tablesPrefix; delete testEnvironment.tablesPrefix;
delete testEnvironment.testUseRegularAuth; delete testEnvironment.testUseMockAuth;
testEnvironment.save(); testEnvironment.save();
}); });
......
...@@ -14,13 +14,13 @@ describe("Login", function () { ...@@ -14,13 +14,13 @@ describe("Login", function () {
formlessLoginUrl = "?module=Login&action=logme&login=oliverqueen&password=" + md5Pass; formlessLoginUrl = "?module=Login&action=logme&login=oliverqueen&password=" + md5Pass;
before(function () { before(function () {
testEnvironment.testUseRegularAuth = 1; testEnvironment.testUseMockAuth = 0;
testEnvironment.queryParamOverride = {date: "2012-01-01", period: "year"}; testEnvironment.queryParamOverride = {date: "2012-01-01", period: "year"};
testEnvironment.save(); testEnvironment.save();
}); });
after(function () { after(function () {
testEnvironment.testUseRegularAuth = 0; testEnvironment.testUseMockAuth = 1;
delete testEnvironment.queryParamOverride; delete testEnvironment.queryParamOverride;
testEnvironment.save(); testEnvironment.save();
}); });
......
/*! /*!
* Piwik - free/libre analytics platform * Piwik - free/libre analytics platform
* *
* Overlay screenshot tests. * Overlay screenshot tests.
......
...@@ -31,13 +31,13 @@ describe("UIIntegrationTest", function () { // TODO: Rename to Piwik? ...@@ -31,13 +31,13 @@ describe("UIIntegrationTest", function () { // TODO: Rename to Piwik?
beforeEach(function () { beforeEach(function () {
delete testEnvironment.configOverride; delete testEnvironment.configOverride;
testEnvironment.testUseRegularAuth = 0; testEnvironment.testUseMockAuth = 1;
testEnvironment.save(); testEnvironment.save();
}); });
after(function () { after(function () {
delete testEnvironment.queryParamOverride; delete testEnvironment.queryParamOverride;
testEnvironment.testUseRegularAuth = 0; testEnvironment.testUseMockAuth = 1;
testEnvironment.save(); testEnvironment.save();
}); });
...@@ -593,7 +593,7 @@ describe("UIIntegrationTest", function () { // TODO: Rename to Piwik? ...@@ -593,7 +593,7 @@ describe("UIIntegrationTest", function () { // TODO: Rename to Piwik?
// opt out page // opt out page
it('should load the opt out page correctly', function (done) { it('should load the opt out page correctly', function (done) {
expect.screenshot('opt_out').to.be.capture(function (page) { expect.screenshot('opt_out').to.be.capture(function (page) {
testEnvironment.testUseRegularAuth = 1; testEnvironment.testUseMockAuth = 0;
testEnvironment.save(); testEnvironment.save();
page.load("?module=CoreAdminHome&action=optOut&language=en"); page.load("?module=CoreAdminHome&action=optOut&language=en");
......
...@@ -22,6 +22,7 @@ TestingEnvironment.prototype.reload = function () { ...@@ -22,6 +22,7 @@ TestingEnvironment.prototype.reload = function () {
this['useOverrideCss'] = true; this['useOverrideCss'] = true;
this['useOverrideJs'] = true; this['useOverrideJs'] = true;
this['loadRealTranslations'] = true; // UI tests should test w/ real translations, not translation keys this['loadRealTranslations'] = true; // UI tests should test w/ real translations, not translation keys
this['testUseMockAuth'] = true;
if (fs.exists(testingEnvironmentOverridePath)) { if (fs.exists(testingEnvironmentOverridePath)) {
var data = JSON.parse(fs.read(testingEnvironmentOverridePath)); var data = JSON.parse(fs.read(testingEnvironmentOverridePath));
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter