@@ -263,19 +263,39 @@ public function testIgnoreErrorsIntegrationIsNotAddedTwiceIfAlreadyConfigured():
263263 $ this ->assertSame (1 , $ ignoreErrorsIntegrationsCount );
264264 }
265265
266- public function testEmptyDsnIsPropagatedToOptions (): void
266+ /**
267+ * @dataProvider dsnOptionIsSetOnClientOptionsDataProvider
268+ *
269+ * @param mixed $expectedResult
270+ */
271+ public function testDsnOptionIsSetOnClientOptions (string $ fixtureFile , $ expectedResult ): void
267272 {
268- $ this ->assertDsnPropagation ( ' dsn_empty_string ' , '' );
269- }
273+ $ container = $ this ->createContainerFromFixture ( $ fixtureFile );
274+ $ optionsDefinition = $ container -> getDefinition ( ' sentry.client.options ' );
270275
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 ' ]);
274278 }
275279
276- public function testNullDsnIsPropagatedToOptions (): void
280+ /**
281+ * @return \Generator<mixed>
282+ */
283+ public function dsnOptionIsSetOnClientOptionsDataProvider (): \Generator
277284 {
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+ ];
279299 }
280300
281301 private function createContainerFromFixture (string $ fixtureFile ): ContainerBuilder
@@ -307,17 +327,4 @@ private function assertDefinitionMethodCallAt(array $methodCall, string $method,
307327 $ this ->assertSame ($ method , $ methodCall [0 ]);
308328 $ this ->assertEquals ($ arguments , $ methodCall [1 ]);
309329 }
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- }
323330}
0 commit comments