From 1f055da2183f38bbdee8826d6f3e7aa1c31091c9 Mon Sep 17 00:00:00 2001 From: Inverle Date: Wed, 30 Sep 2026 21:50:47 +0200 Subject: [PATCH] Avoid writing to log files during unit tests (#9373) * Avoid writing to log files during unit tests * Translate PHPDoc of `record()` * Move environment variable into `phpunit.xml` and use tabs for indents --- lib/Minz/Log.php | 14 +++++++------- phpunit.xml | 19 +++++++++++-------- tests/lib/Minz/LogTest.php | 2 +- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/lib/Minz/Log.php b/lib/Minz/Log.php index 39b210051..1736e9fbe 100644 --- a/lib/Minz/Log.php +++ b/lib/Minz/Log.php @@ -24,14 +24,14 @@ class Minz_Log { ]; /** - * Enregistre un message dans un fichier de log spécifique - * Message non loggué si + * Records a message in a specific log file + * The message is not logged if * - environment = SILENT - * - level est moins sévère que le seuil déterminé par `log_level`, - * ou par défaut par `environment` (PRODUCTION ne garde que warning et error) - * @param string $information message d'erreur / information à enregistrer - * @param int $level niveau d'erreur https://www.php.net/function.syslog - * @param string $file_name fichier de log + * - level is less severe than the threshold determined by `log_level`, + * or, by default, by `environment` (PRODUCTION keeps only warnings and errors) + * @param string $information error message / information to record + * @param int $level error level https://www.php.net/function.syslog + * @param string $file_name log file * @throws Minz_PermissionDeniedException */ public static function record(string $information, int $level, ?string $file_name = null): void { diff --git a/phpunit.xml b/phpunit.xml index 33ba741db..dce206dfa 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,12 +1,15 @@ - - - ./tests - - + + + + + + ./tests + + diff --git a/tests/lib/Minz/LogTest.php b/tests/lib/Minz/LogTest.php index c93766767..946c46375 100644 --- a/tests/lib/Minz/LogTest.php +++ b/tests/lib/Minz/LogTest.php @@ -13,7 +13,7 @@ class LogTest extends TestCase { #[\Override] protected function tearDown(): void { - putenv('FRESHRSS_ENV'); + putenv('FRESHRSS_ENV=silent'); @unlink($this->logFile); }