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

hide the geoip error logs in phpunit output

parent 851109cc
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -518,8 +518,10 @@ class GeoIPAutoUpdater extends ScheduledTask
* Databases are renamed to ${original}.broken .
*
* Note: method is protected for testability.
*
* @param $logErrors - only used to hide error logs during tests
*/
protected function performRedundantDbChecks()
protected function performRedundantDbChecks($logErrors = true)
{
$databaseTypes = array_keys(GeoIp::$dbNames);
......@@ -538,8 +540,11 @@ class GeoIPAutoUpdater extends ScheduledTask
self::getTestLocationCatchPhpErrors($provider);
if (self::$unzipPhpError !== null) {
list($errno, $errstr, $errfile, $errline) = self::$unzipPhpError;
Log::error("GeoIPAutoUpdater: Encountered PHP error when performing redundant tests on GeoIP "
. "%s database: %s: %s on line %s of %s.", $type, $errno, $errstr, $errline, $errfile);
if($logErrors) {
Log::error("GeoIPAutoUpdater: Encountered PHP error when performing redundant tests on GeoIP "
. "%s database: %s: %s on line %s of %s.", $type, $errno, $errstr, $errline, $errfile);
}
// get the current filename for the DB and an available new one to rename it to
list($oldPath, $newPath) = $this->getOldAndNewPathsForBrokenDb($customNames[$type]);
......
......@@ -8,6 +8,7 @@
namespace Piwik\Plugins\UserCountry\tests\Unit;
use Piwik\Log;
use Piwik\Plugins\UserCountry\GeoIPAutoUpdater;
use Piwik\Plugins\UserCountry\LocationProvider\GeoIp;
use Piwik\Plugins\UserCountry;
......@@ -173,9 +174,10 @@ class Piwik_UserCountry_GeoIPAutoUpdater_publictest extends GeoIPAutoUpdater
// empty
}
public function performRedundantDbChecks()
// during tests do not call the Log::error or they will be displayed in the output
public function performRedundantDbChecks($logErrors = false)
{
parent::performRedundantDbChecks();
parent::performRedundantDbChecks($logErrors);
}
public function downloadFile($type, $url)
......
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