@@ -263,19 +263,39 @@ public function testIgnoreErrorsIntegrationIsNotAddedTwiceIfAlreadyConfigured():
263
263
$ this ->assertSame (1 , $ ignoreErrorsIntegrationsCount );
264
264
}
265
265
266
- public function testEmptyDsnIsPropagatedToOptions (): void
266
+ /**
267
+ * @dataProvider dsnOptionIsSetOnClientOptionsDataProvider
268
+ *
269
+ * @param mixed $expectedResult
270
+ */
271
+ public function testDsnOptionIsSetOnClientOptions (string $ fixtureFile , $ expectedResult ): void
267
272
{
268
- $ this ->assertDsnPropagation ( ' dsn_empty_string ' , '' );
269
- }
273
+ $ container = $ this ->createContainerFromFixture ( $ fixtureFile );
274
+ $ optionsDefinition = $ container -> getDefinition ( ' sentry.client.options ' );
270
275
271
- public function testFalseDsnIsPropagatedToOptions (): void
272
- {
273
- $ this ->assertDsnPropagation ('dsn_false ' , false );
276
+ $ this ->assertSame (Options::class, $ optionsDefinition ->getClass ());
277
+ $ this ->assertSame ($ expectedResult , $ optionsDefinition ->getArgument (0 )['dsn ' ]);
274
278
}
275
279
276
- public function testNullDsnIsPropagatedToOptions (): void
280
+ /**
281
+ * @return \Generator<mixed>
282
+ */
283
+ public function dsnOptionIsSetOnClientOptionsDataProvider (): \Generator
277
284
{
278
- $ this ->assertDsnPropagation ('dsn_null ' , null );
285
+ yield [
286
+ 'dsn_empty_string ' ,
287
+ '' ,
288
+ ];
289
+
290
+ yield [
291
+ 'dsn_false ' ,
292
+ false ,
293
+ ];
294
+
295
+ yield [
296
+ 'dsn_null ' ,
297
+ null ,
298
+ ];
279
299
}
280
300
281
301
private function createContainerFromFixture (string $ fixtureFile ): ContainerBuilder
@@ -307,17 +327,4 @@ private function assertDefinitionMethodCallAt(array $methodCall, string $method,
307
327
$ this ->assertSame ($ method , $ methodCall [0 ]);
308
328
$ this ->assertEquals ($ arguments , $ methodCall [1 ]);
309
329
}
310
-
311
- /**
312
- * @param mixed $result
313
- */
314
- private function assertDsnPropagation (string $ fixtureFile , $ result ): void
315
- {
316
- $ container = $ this ->createContainerFromFixture ($ fixtureFile );
317
- $ optionsDefinition = $ container ->getDefinition ('sentry.client.options ' );
318
-
319
- $ this ->assertSame (Options::class, $ optionsDefinition ->getClass ());
320
- $ this ->assertTrue (\array_key_exists ('dsn ' , $ optionsDefinition ->getArgument (0 )));
321
- $ this ->assertSame ($ result , $ optionsDefinition ->getArgument (0 )['dsn ' ]);
322
- }
323
330
}
0 commit comments