mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-10-28 05:58:40 -04:00
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
This commit is contained in:
1 parent
05bfbb9f33
commit
1f055da218
3 files changed
+19
-16
No files matched your search
+7
-7
@@ -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 {
|
||||
|
||||
+11
-8
@@ -1,12 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit
|
||||
bootstrap="./tests/bootstrap.php"
|
||||
displayDetailsOnAllIssues="true"
|
||||
failOnAllIssues="true"
|
||||
bootstrap="./tests/bootstrap.php"
|
||||
displayDetailsOnAllIssues="true"
|
||||
failOnAllIssues="true"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="default">
|
||||
<directory>./tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<php>
|
||||
<env name="FRESHRSS_ENV" value="silent" force="true"/> <!-- To avoid writing into log files -->
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="default">
|
||||
<directory>./tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
||||
@@ -13,7 +13,7 @@ class LogTest extends TestCase {
|
||||
|
||||
#[\Override]
|
||||
protected function tearDown(): void {
|
||||
putenv('FRESHRSS_ENV');
|
||||
putenv('FRESHRSS_ENV=silent');
|
||||
@unlink($this->logFile);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user