@@ -19,7 +19,7 @@ public function testDataProviderIsMappingTheRightNumberOfOptions(): void
19
19
$ providerData = $ this ->optionValuesProvider ();
20
20
$ supportedOptions = \array_unique (\array_column ($ providerData , 0 ));
21
21
22
- $ expectedCount = self :: SUPPORTED_SENTRY_OPTIONS_COUNT ;
22
+ $ expectedCount = $ this -> getSupportedOptionsCount () ;
23
23
24
24
if (PrettyVersions::getVersion ('sentry/sentry ' )->getPrettyVersion () !== '2.0.0 ' ) {
25
25
++$ expectedCount ;
@@ -38,7 +38,7 @@ public function testInvalidDataProviderIsMappingTheRightNumberOfOptions(): void
38
38
$ supportedOptions = \array_unique (\array_column ($ providerData , 0 ));
39
39
40
40
$ this ->assertCount (
41
- self :: SUPPORTED_SENTRY_OPTIONS_COUNT ,
41
+ $ this -> getSupportedOptionsCount () ,
42
42
$ supportedOptions ,
43
43
'Provider for invalid configuration options mismatch: ' . PHP_EOL . print_r ($ supportedOptions , true )
44
44
);
@@ -76,6 +76,10 @@ public function testConfigurationDefaults(): void
76
76
$ expectedDefaults ['options ' ]['in_app_exclude ' ][1 ] = '%kernel.project_dir%/vendor ' ;
77
77
}
78
78
79
+ if ($ this ->classSerializersAreSupported ()) {
80
+ $ expectedDefaults ['options ' ]['class_serializers ' ] = [];
81
+ }
82
+
79
83
$ this ->assertEquals ($ expectedDefaults , $ processed );
80
84
$ this ->assertArrayNotHasKey ('server_name ' , $ processed ['options ' ], 'server_name has to be fetched at runtime, not before (see #181) ' );
81
85
}
@@ -127,6 +131,10 @@ public function optionValuesProvider(): array
127
131
$ options [] = ['capture_silenced_errors ' , true ];
128
132
}
129
133
134
+ if ($ this ->classSerializersAreSupported ()) {
135
+ $ options [] = ['class_serializers ' , ['count ' ]];
136
+ }
137
+
130
138
return $ options ;
131
139
}
132
140
@@ -154,6 +162,10 @@ public function invalidValuesProvider(): array
154
162
['before_send ' , [$ this , 'is not a callable ' ]],
155
163
['before_send ' , false ],
156
164
['before_send ' , -1 ],
165
+ ['class_serializers ' , 'this is not a callable ' ],
166
+ ['class_serializers ' , [$ this , 'is not a callable ' ]],
167
+ ['class_serializers ' , false ],
168
+ ['class_serializers ' , -1 ],
157
169
['context_lines ' , -1 ],
158
170
['context_lines ' , 99999 ],
159
171
['context_lines ' , 'string ' ],
@@ -192,4 +204,24 @@ private function processConfiguration(array $values): array
192
204
193
205
return $ processor ->processConfiguration (new Configuration (), ['sentry ' => $ values ]);
194
206
}
207
+
208
+ private function classSerializersAreSupported (): bool
209
+ {
210
+ try {
211
+ new Options (['class_serializers ' => []]);
212
+
213
+ return true ;
214
+ } catch (\Throwable $ throwable ) {
215
+ return false ;
216
+ }
217
+ }
218
+
219
+ private function getSupportedOptionsCount (): int
220
+ {
221
+ if ($ this ->classSerializersAreSupported ()) {
222
+ return self ::SUPPORTED_SENTRY_OPTIONS_COUNT + 1 ;
223
+ }
224
+
225
+ return self ::SUPPORTED_SENTRY_OPTIONS_COUNT ;
226
+ }
195
227
}
0 commit comments