File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Laravel \Octane \Listeners ;
4+
5+ use Illuminate \Foundation \Application ;
6+ use Illuminate \Http \Request ;
7+ use Laravel \Octane \Tests \TestCase ;
8+
9+ class FlushLogContextTest extends TestCase
10+ {
11+ public function test_shared_context_is_flushed ()
12+ {
13+ if (version_compare (Application::VERSION , '9.0.0 ' , '< ' )) {
14+ $ this ->markTestSkipped ('Shared context is only supported in Laravel 9+ ' );
15+ }
16+
17+ [$ app , $ worker , $ client ] = $ this ->createOctaneContext ([
18+ Request::create ('/ ' , 'GET ' ),
19+ ]);
20+ $ app ['router ' ]->middleware ('web ' )->get ('/ ' , function () {
21+ // ..
22+ });
23+ $ log = $ app ['log ' ];
24+ $ log ->shareContext (['shared ' => 'context ' ]);
25+
26+ $ this ->assertSame (['shared ' => 'context ' ], $ log ->sharedContext ());
27+
28+ $ worker ->run ();
29+
30+ $ this ->assertSame ([], $ log ->sharedContext ());
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments