88use Sentry \ClientInterface ;
99use Sentry \NoOpClient ;
1010use Sentry \Options ;
11- use Sentry \State \Hub ;
1211use Sentry \State \Scope ;
1312use Sentry \Tracing \DynamicSamplingContext ;
1413use Sentry \Tracing \PropagationContext ;
@@ -91,16 +90,14 @@ public function testFromTransaction(): void
9190 'environment ' => 'test ' ,
9291 ]));
9392
94- $ hub = new Hub ($ client );
95-
9693 $ transactionContext = new TransactionContext ();
9794 $ transactionContext ->setName ('foo ' );
9895
99- $ transaction = new Transaction ($ transactionContext, $ hub );
96+ $ transaction = new Transaction ($ transactionContext );
10097 $ transaction ->getMetadata ()->setSamplingRate (1.0 );
10198 $ transaction ->getMetadata ()->setSampleRand (0.5 );
10299
103- $ samplingContext = DynamicSamplingContext::fromTransaction ($ transaction , $ hub );
100+ $ samplingContext = DynamicSamplingContext::fromTransaction ($ transaction , $ client );
104101
105102 $ this ->assertSame ((string ) $ transaction ->getTraceId (), $ samplingContext ->get ('trace_id ' ));
106103 $ this ->assertSame ((string ) $ transaction ->getMetaData ()->getSamplingRate (), $ samplingContext ->get ('sample_rate ' ));
@@ -114,15 +111,13 @@ public function testFromTransaction(): void
114111
115112 public function testFromTransactionSourceUrl (): void
116113 {
117- $ hub = new Hub (new NoOpClient ());
118-
119114 $ transactionContext = new TransactionContext ();
120115 $ transactionContext ->setName ('/foo/bar/123 ' );
121116 $ transactionContext ->setSource (TransactionSource::url ());
122117
123- $ transaction = new Transaction ($ transactionContext, $ hub );
118+ $ transaction = new Transaction ($ transactionContext );
124119
125- $ samplingContext = DynamicSamplingContext::fromTransaction ($ transaction , $ hub );
120+ $ samplingContext = DynamicSamplingContext::fromTransaction ($ transaction , new NoOpClient () );
126121
127122 $ this ->assertNull ($ samplingContext ->get ('transaction ' ));
128123 }
@@ -189,9 +184,8 @@ public function testFromTransactionUsesConfiguredOrgIdOverDsnOrgId(): void
189184 'org_id ' => 2 ,
190185 ]));
191186
192- $ hub = new Hub ($ client );
193- $ transaction = new Transaction (new TransactionContext (), $ hub );
194- $ samplingContext = DynamicSamplingContext::fromTransaction ($ transaction , $ hub );
187+ $ transaction = new Transaction (new TransactionContext ());
188+ $ samplingContext = DynamicSamplingContext::fromTransaction ($ transaction , $ client );
195189
196190 $ this ->assertSame ('2 ' , $ samplingContext ->get ('org_id ' ));
197191 }
@@ -205,9 +199,8 @@ public function testFromTransactionFallsBackToDsnOrgId(): void
205199 'dsn ' => 'http://public@o1.example.com/1 ' ,
206200 ]));
207201
208- $ hub = new Hub ($ client );
209- $ transaction = new Transaction (new TransactionContext (), $ hub );
210- $ samplingContext = DynamicSamplingContext::fromTransaction ($ transaction , $ hub );
202+ $ transaction = new Transaction (new TransactionContext ());
203+ $ samplingContext = DynamicSamplingContext::fromTransaction ($ transaction , $ client );
211204
212205 $ this ->assertSame ('1 ' , $ samplingContext ->get ('org_id ' ));
213206 }
0 commit comments