Skip to content

Commit 9b0a166

Browse files
authored
Add test for withoutContext (#39094)
1 parent 8f3d280 commit 9b0a166

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/Log/LogLoggerTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@ public function testContextIsAddedToAllSubsequentLogs()
3636
$writer->error('foo');
3737
}
3838

39+
public function testContextIsFlushed()
40+
{
41+
$writer = new Logger($monolog = m::mock(Monolog::class));
42+
$writer->withContext(['bar' => 'baz']);
43+
$writer->withoutContext();
44+
45+
$monolog->expects('error')->with('foo', []);
46+
47+
$writer->error('foo');
48+
}
49+
3950
public function testLoggerFiresEventsDispatcher()
4051
{
4152
$writer = new Logger($monolog = m::mock(Monolog::class), $events = new Dispatcher);

0 commit comments

Comments
 (0)