diff options
author | mattab <matthieu.aubry@gmail.com> | 2014-11-17 07:59:49 +0300 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2014-11-17 07:59:49 +0300 |
commit | e7b839d0a9bda32aed4977a4b0461d0b8d23d4cf (patch) | |
tree | 43afc93cc4ce23e507dfb797ae74760169321af9 /plugins | |
parent | 851109cc5607e115e92f2e03ddecc64545d49735 (diff) |
hide the geoip error logs in phpunit output
Diffstat (limited to 'plugins')
-rwxr-xr-x | plugins/UserCountry/GeoIPAutoUpdater.php | 11 | ||||
-rw-r--r-- | plugins/UserCountry/tests/Unit/UserCountryTest.php | 6 |
2 files changed, 12 insertions, 5 deletions
diff --git a/plugins/UserCountry/GeoIPAutoUpdater.php b/plugins/UserCountry/GeoIPAutoUpdater.php index 64b69be435..b76f347413 100755 --- a/plugins/UserCountry/GeoIPAutoUpdater.php +++ b/plugins/UserCountry/GeoIPAutoUpdater.php @@ -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]); diff --git a/plugins/UserCountry/tests/Unit/UserCountryTest.php b/plugins/UserCountry/tests/Unit/UserCountryTest.php index 540be65d70..5a6e453e3a 100644 --- a/plugins/UserCountry/tests/Unit/UserCountryTest.php +++ b/plugins/UserCountry/tests/Unit/UserCountryTest.php @@ -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) |