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

Refs #10331 #10283

parent 474fe969
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -9,6 +9,7 @@
namespace Piwik\Application\Kernel;
use Piwik\Common;
use Piwik\Exception\NotYetInstalledException;
use Piwik\Filechecks;
use Piwik\Piwik;
use Piwik\SettingsPiwik;
......@@ -50,7 +51,7 @@ class EnvironmentValidator
if(SettingsServer::isTrackerApiRequest()) {
// if Piwik is not installed yet, the piwik.php should do nothing and not return an error
throw new \Exception("As Piwik is not installed yet, the Tracking API will now exit without error.");
throw new NotYetInstalledException("As Piwik is not installed yet, the Tracking API cannot proceed and will exit without error.");
}
if(Common::isPhpCliMode()) {
......
......@@ -52,7 +52,11 @@ require_once PIWIK_INCLUDE_PATH . '/core/Cookie.php';
SettingsServer::setIsTrackerApiRequest();
$environment = new \Piwik\Application\Environment('tracker');
$environment->init();
try {
$environment->init();
} catch(\Piwik\Exception\NotYetInstalledException $e) {
die($e->getMessage());
}
Tracker::loadTrackerEnvironment();
......
......@@ -56,7 +56,7 @@ class EnvironmentValidationTest extends SystemTestCase
$this->simulateAbsentConfigFile('config.ini.php');
$output = $this->triggerPiwikFrom('tracker');
$this->assertContains('As Piwik is not installed yet, the Tracking API will now exit without error', $output);
$this->assertContains('As Piwik is not installed yet, the Tracking API cannot proceed and will exit without error.', $output);
}
public function test_NoLocalConfigFile_TriggersError_inConsole()
......@@ -191,17 +191,24 @@ class EnvironmentValidationTest extends SystemTestCase
private function sendRequestToTracker()
{
return $this->curl(Fixture::getRootUrl() . 'tests/PHPUnit/proxy/piwik.php?idsite=1&rec=1&action_name=something');
list($response, $info) = $this->curl(Fixture::getRootUrl() . 'tests/PHPUnit/proxy/piwik.php?idsite=1&rec=1&action_name=something');
// Check Tracker requests return 200
$this->assertEquals(200, $info["http_code"], 'Ok response');
return $response;
}
private function sendRequestToWeb()
{
return $this->curl(Fixture::getRootUrl() . 'tests/PHPUnit/proxy/index.php');
list($response, $info) = $this->curl(Fixture::getRootUrl() . 'tests/PHPUnit/proxy/index.php');
return $response;
}
private function sendArchiveWebRequest()
{
return $this->curl(Fixture::getRootUrl() . 'tests/PHPUnit/proxy/archive.php?token_auth=' . Fixture::getTokenAuth());
list($response, $info) = $this->curl(Fixture::getRootUrl() . 'tests/PHPUnit/proxy/archive.php?token_auth=' . Fixture::getTokenAuth());
return $response;
}
private function startConsoleProcess()
......@@ -226,8 +233,10 @@ class EnvironmentValidationTest extends SystemTestCase
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$response = substr($response, $headerSize);
$responseInfo = curl_getinfo($ch);
curl_close($ch);
return $response;
return array($response, $responseInfo);
}
}
\ No newline at end of file
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