mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-05 12:47:39 +02:00
Fix tests, invalid UTF-8 is now returning �s instead of being converted to possibly valid ISO-8559-15
This commit is contained in:
@@ -176,6 +176,6 @@ class LogstashFormatterTest extends TestCase
|
|||||||
$this->assertEquals('ERROR', $message['level']);
|
$this->assertEquals('ERROR', $message['level']);
|
||||||
$this->assertEquals('test', $message['type']);
|
$this->assertEquals('test', $message['type']);
|
||||||
$this->assertEquals('hostname', $message['host']);
|
$this->assertEquals('hostname', $message['host']);
|
||||||
$this->assertEquals('ÖWN; FBCR/OrangeEspaña; Versão/4.0; Färist', $message['extra']['user_agent']);
|
$this->assertEquals('<EFBFBD>WN; FBCR/OrangeEspa<EFBFBD>a; Vers<EFBFBD>o/4.0; F<EFBFBD>rist', $message['extra']['user_agent']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -270,7 +270,7 @@ class NormalizerFormatterTest extends TestCase
|
|||||||
$this->assertEquals('Over 1000 items (2000 total), aborting normalization', $res['context'][0]['...']);
|
$this->assertEquals('Over 1000 items (2000 total), aborting normalization', $res['context'][0]['...']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testThrowsOnInvalidEncoding()
|
public function testIgnoresInvalidEncoding()
|
||||||
{
|
{
|
||||||
$formatter = new NormalizerFormatter();
|
$formatter = new NormalizerFormatter();
|
||||||
$reflMethod = new \ReflectionMethod($formatter, 'toJson');
|
$reflMethod = new \ReflectionMethod($formatter, 'toJson');
|
||||||
@@ -280,9 +280,7 @@ class NormalizerFormatterTest extends TestCase
|
|||||||
$record = new \stdClass;
|
$record = new \stdClass;
|
||||||
$record->message = "\xB1\x31";
|
$record->message = "\xB1\x31";
|
||||||
|
|
||||||
$this->expectException(\RuntimeException::class);
|
$this->assertsame('{"message":"<22>1"}', $reflMethod->invoke($formatter, $record));
|
||||||
|
|
||||||
$reflMethod->invoke($formatter, $record);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testConvertsInvalidEncodingAsLatin9()
|
public function testConvertsInvalidEncodingAsLatin9()
|
||||||
@@ -293,7 +291,7 @@ class NormalizerFormatterTest extends TestCase
|
|||||||
|
|
||||||
$res = $reflMethod->invoke($formatter, ['message' => "\xA4\xA6\xA8\xB4\xB8\xBC\xBD\xBE"]);
|
$res = $reflMethod->invoke($formatter, ['message' => "\xA4\xA6\xA8\xB4\xB8\xBC\xBD\xBE"]);
|
||||||
|
|
||||||
$this->assertSame('{"message":"€ŠšŽžŒœŸ"}', $res);
|
$this->assertSame('{"message":"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"}', $res);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMaxNormalizeDepth()
|
public function testMaxNormalizeDepth()
|
||||||
|
@@ -137,7 +137,7 @@ class RotatingFileHandlerTest extends TestCase
|
|||||||
$handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2);
|
$handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2);
|
||||||
if (!$valid) {
|
if (!$valid) {
|
||||||
$this->expectException(InvalidArgumentException::class);
|
$this->expectException(InvalidArgumentException::class);
|
||||||
$this->expectExceptionMessageRegExp('~^Invalid date format~');
|
$this->expectExceptionMessageMatches('~^Invalid date format~');
|
||||||
}
|
}
|
||||||
$handler->setFilenameFormat('{filename}-{date}', $dateFormat);
|
$handler->setFilenameFormat('{filename}-{date}', $dateFormat);
|
||||||
$this->assertTrue(true);
|
$this->assertTrue(true);
|
||||||
@@ -178,7 +178,7 @@ class RotatingFileHandlerTest extends TestCase
|
|||||||
$handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2);
|
$handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2);
|
||||||
if (!$valid) {
|
if (!$valid) {
|
||||||
$this->expectException(InvalidArgumentException::class);
|
$this->expectException(InvalidArgumentException::class);
|
||||||
$this->expectExceptionMessageRegExp('~^Invalid filename format~');
|
$this->expectExceptionMessageMatches('~^Invalid filename format~');
|
||||||
}
|
}
|
||||||
|
|
||||||
$handler->setFilenameFormat($filenameFormat, RotatingFileHandler::FILE_PER_DAY);
|
$handler->setFilenameFormat($filenameFormat, RotatingFileHandler::FILE_PER_DAY);
|
||||||
|
Reference in New Issue
Block a user