File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -144,6 +144,12 @@ public static function flush(): void
144144 {
145145 Logs::getInstance ()->flush ();
146146 TraceMetrics::getInstance ()->flush ();
147+
148+ $ client = self ::getCurrentHub ()->getClient ();
149+
150+ if ($ client !== null ) {
151+ $ client ->flush ();
152+ }
147153 }
148154
149155 private static function getRuntimeContextManager (): RuntimeContextManager
Original file line number Diff line number Diff line change @@ -129,6 +129,20 @@ public function testEndContextFlushesClientTransportWithOptionalTimeout(): void
129129 SentrySdk::endContext (12 );
130130 }
131131
132+ public function testFlushFlushesClientTransport (): void
133+ {
134+ /** @var ClientInterface&MockObject $client */
135+ $ client = $ this ->createMock (ClientInterface::class);
136+ $ client ->expects ($ this ->once ())
137+ ->method ('flush ' )
138+ ->with (null )
139+ ->willReturn (new Result (ResultStatus::success ()));
140+
141+ SentrySdk::init ()->bindClient ($ client );
142+
143+ SentrySdk::flush ();
144+ }
145+
132146 public function testWithContextReturnsCallbackResultAndRestoresGlobalHub (): void
133147 {
134148 SentrySdk::init ();
You can’t perform that action at this time.
0 commit comments