File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -110,9 +110,9 @@ class SentryOptionsContext implements EventListenerInterface
110110
111111 public function setServerContext(Event $event): void
112112 {
113- /** @var \CakeSentry\Http\SentryClient $subject */
114- $subject = $event->getSubject();
115- $options = $subject->getHub()-> getClient()->getOptions();
113+ /** @var \Sentry\State\HubInterface $subject */
114+ $hub = $event->getSubject();
115+ $options = $subject->getClient()->getOptions();
116116
117117 $options->setEnvironment('test_app');
118118 $options->setRelease('3.0.0@dev');
Original file line number Diff line number Diff line change 88use Cake \Event \Event ;
99use Cake \Event \EventManager ;
1010use Cake \Utility \Hash ;
11+ use Sentry \SentrySdk ;
1112use function Sentry \init ;
1213
1314class CakeSentryInit
@@ -41,7 +42,7 @@ public static function init(): void
4142 $ config = self ::getConfig ('sentry ' );
4243 if ($ config !== null && Hash::check ($ config , 'dsn ' )) {
4344 init ($ config );
44- $ event = new Event ('CakeSentry.Client.afterSetup ' );
45+ $ event = new Event ('CakeSentry.Client.afterSetup ' , SentrySdk:: getCurrentHub () );
4546 EventManager::instance ()->dispatch ($ event );
4647 }
4748 }
Original file line number Diff line number Diff line change @@ -108,7 +108,8 @@ public function testSetupClientDispatchAfterSetup(): void
108108 $ called = false ;
109109 EventManager::instance ()->on (
110110 'CakeSentry.Client.afterSetup ' ,
111- function () use (&$ called ) {
111+ function (Event $ event ) use (&$ called ) {
112+ $ this ->assertInstanceOf (Hub::class, $ event ->getSubject ());
112113 $ called = true ;
113114 },
114115 );
You can’t perform that action at this time.
0 commit comments