1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-18 19:01:31 +02:00

Move expectException before the line where exception is thrown

This commit is contained in:
Mario Blažek
2019-08-13 15:34:48 +02:00
parent 37900f9268
commit d317cb97d3
13 changed files with 62 additions and 45 deletions

View File

@@ -86,14 +86,14 @@ class GelfMessageFormatterTest extends TestCase
*/
public function testFormatInvalidFails()
{
$this->expectException(\InvalidArgumentException::class);
$formatter = new GelfMessageFormatter();
$record = [
'level' => Logger::ERROR,
'level_name' => 'ERROR',
];
$this->expectException(\InvalidArgumentException::class);
$formatter->format($record);
}

View File

@@ -260,8 +260,6 @@ class NormalizerFormatterTest extends TestCase
public function testThrowsOnInvalidEncoding()
{
$this->expectException(\RuntimeException::class);
$formatter = new NormalizerFormatter();
$reflMethod = new \ReflectionMethod($formatter, 'toJson');
$reflMethod->setAccessible(true);
@@ -269,6 +267,9 @@ class NormalizerFormatterTest extends TestCase
// send an invalid unicode sequence as a object that can't be cleaned
$record = new \stdClass;
$record->message = "\xB1\x31";
$this->expectException(\RuntimeException::class);
$reflMethod->invoke($formatter, $record);
}