@@ -17,6 +17,7 @@ class BufferFlushPassTest extends TestCase
17
17
{
18
18
/**
19
19
* @param Reference[] $services
20
+ *
20
21
* @return string[]
21
22
*/
22
23
private function servicesToName (array $ services ): array
@@ -26,6 +27,20 @@ private function servicesToName(array $services): array
26
27
}, $ services );
27
28
}
28
29
30
+ /**
31
+ * @param Definition $definition
32
+ *
33
+ * @return string[]
34
+ */
35
+ private function argumentToName (Definition $ definition ): array
36
+ {
37
+ $ argument = $ definition ->getArgument (0 );
38
+ $ this ->assertIsArray ($ argument );
39
+ $ this ->assertInstanceOf (Reference::class, $ argument [0 ]);
40
+
41
+ return $ this ->servicesToName ($ argument );
42
+ }
43
+
29
44
/**
30
45
* Tests that the flusher will only container references to handler that wrap sentry.
31
46
*
@@ -41,7 +56,7 @@ public function testProcessWithMultipleHandlers()
41
56
42
57
(new BufferFlushPass ())->process ($ container );
43
58
$ definition = $ container ->getDefinition ('sentry.buffer_flusher ' );
44
- $ serviceIds = $ this ->servicesToName ($ definition-> getArgument ( 0 ) );
59
+ $ serviceIds = $ this ->argumentToName ($ definition );
45
60
$ this ->assertEquals (['sentry.test.handler ' ], $ serviceIds );
46
61
}
47
62
@@ -78,7 +93,7 @@ public function testProcessWithMultipleSentryHandlers()
78
93
79
94
(new BufferFlushPass ())->process ($ container );
80
95
$ definition = $ container ->getDefinition ('sentry.buffer_flusher ' );
81
- $ serviceIds = $ this ->servicesToName ($ definition-> getArgument ( 0 ) );
96
+ $ serviceIds = $ this ->argumentToName ($ definition );
82
97
$ this ->assertEquals (['sentry.test.handler ' , 'sentry.other.test.handler ' ], $ serviceIds );
83
98
}
84
99
@@ -98,7 +113,7 @@ public function testProcessWithFakeSentryHandlers()
98
113
99
114
(new BufferFlushPass ())->process ($ container );
100
115
$ definition = $ container ->getDefinition ('sentry.buffer_flusher ' );
101
- $ serviceIds = $ this ->servicesToName ($ definition-> getArgument ( 0 ) );
116
+ $ serviceIds = $ this ->argumentToName ($ definition );
102
117
$ this ->assertEquals (['sentry.test.handler ' ], $ serviceIds );
103
118
}
104
119
}
0 commit comments