Skip to content
Extraits de code Groupes Projets
Valider f39d3ccc rédigé par Thomas Steur's avatar Thomas Steur
Parcourir les fichiers

refs #4610 fix tests

parent e7b54d9a
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -209,6 +209,7 @@ class CliMulti {
{
$this->processes[] = new Process($cmdId);
$url = $this->appendTestmodeParamToUrlIfNeeded($url);
$query = Url::getQueryFromUrl($url, array('pid' => $cmdId));
$command = $this->buildCommand($query, $output->getPathToFile());
......@@ -232,4 +233,17 @@ class CliMulti {
$output->write($message);
}
}
private function appendTestmodeParamToUrlIfNeeded($url)
{
$isTestMode = $url && false !== strpos($url, 'tests/PHPUnit/proxy');
if ($isTestMode && false === strpos($url, '?')) {
$url .= "?testmode=1";
} elseif ($isTestMode) {
$url .= "&testmode=1";
}
return $url;
}
}
......@@ -36,6 +36,9 @@ class RequestCommand extends ConsoleCommand
if ($this->isTestModeEnabled()) {
Config::getInstance()->setTestEnvironment();
$indexFile = '/tests/PHPUnit/proxy/index.php';
} else {
$indexFile = '/index.php';
}
if (!empty($_GET['pid'])) {
......@@ -50,7 +53,7 @@ class RequestCommand extends ConsoleCommand
Common::$isCliMode = false;
require_once PIWIK_INCLUDE_PATH . "/index.php";
require_once PIWIK_INCLUDE_PATH . $indexFile;
if (!empty($process)) {
$process->finishProcess();
......
......@@ -850,7 +850,7 @@ Notes:
}
// ensure there is a trailing slash
if ($piwikUrl[strlen($piwikUrl) - 1] != '/') {
if ($piwikUrl[strlen($piwikUrl) - 1] != '/' && !Common::stringEndsWith($piwikUrl, 'index.php')) {
$piwikUrl .= '/';
}
}
......@@ -860,7 +860,12 @@ Notes:
if (Config::getInstance()->General['force_ssl'] == 1) {
$piwikUrl = str_replace('http://', 'https://', $piwikUrl);
}
$this->piwikUrl = $piwikUrl . "index.php";
if (!Common::stringEndsWith($piwikUrl, 'index.php')) {
$piwikUrl .= 'index.php';
}
$this->piwikUrl = $piwikUrl;
}
/**
......@@ -1086,5 +1091,6 @@ Notes:
$this->logFatalError("archive.php expects the argument --url to be set to your Piwik URL, for example: --url=http://example.org/piwik/ "
. "\n--help for more information", $backtrace = false);
}
}
......@@ -732,8 +732,10 @@ class Tracker
if (is_null($args)) {
$args = $_GET + $_POST;
}
if (is_null($requestMethod)) {
if (is_null($requestMethod) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
$requestMethod = $_SERVER['REQUEST_METHOD'];
} else if (is_null($requestMethod)) {
$requestMethod = 'GET';
}
// Do not run scheduled tasks during tests
......
......@@ -82,7 +82,6 @@ class Test_Piwik_Integration_ArchiveCronTest extends IntegrationTestCase
foreach ($this->getApiForTesting() as $testInfo) {
list($api, $params) = $testInfo;
if (!isset($params['testSuffix'])) {
......
......@@ -2,9 +2,16 @@
// Good old test proxy endpoints have some commons
define('PIWIK_INCLUDE_PATH', realpath(dirname(__FILE__)) . '/../../../');
define('PIWIK_USER_PATH', PIWIK_INCLUDE_PATH);
define('PIWIK_PRINT_ERROR_BACKTRACE', true);
if (!defined('PIWIK_INCLUDE_PATH')) {
define('PIWIK_INCLUDE_PATH', realpath(dirname(__FILE__)) . '/../../../');
}
if (!defined('PIWIK_USER_PATH')) {
define('PIWIK_USER_PATH', PIWIK_INCLUDE_PATH);
}
if (!defined('PIWIK_PRINT_ERROR_BACKTRACE')) {
define('PIWIK_PRINT_ERROR_BACKTRACE', true);
}
require_once PIWIK_INCLUDE_PATH . '/core/Loader.php';
require_once PIWIK_INCLUDE_PATH . '/core/EventDispatcher.php';
......
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