@@ -22,7 +22,7 @@ class GoFeatureFlagProviderTest extends TestCase
22
22
{
23
23
private EvaluationContext $ defaultEvaluationContext ;
24
24
25
- public function test_should_throw_if_invalid_endpoint ()
25
+ public function test_should_throw_if_invalid_endpoint (): void
26
26
{
27
27
$ this ->expectException (InvalidConfigException::class);
28
28
new GoFeatureFlagProvider (
@@ -32,15 +32,15 @@ public function test_should_throw_if_invalid_endpoint()
32
32
33
33
// Configuration validation tests
34
34
35
- public function test_should_not_throw_if_valid_endpoint ()
35
+ public function test_should_not_throw_if_valid_endpoint (): void
36
36
{
37
37
$ provider = new GoFeatureFlagProvider (
38
38
new Config ('https://gofeatureflag.org ' )
39
39
);
40
40
$ this ->assertInstanceOf (GoFeatureFlagProvider::class, $ provider );
41
41
}
42
42
43
- public function test_should_raise_if_endpoint_is_not_http ()
43
+ public function test_should_raise_if_endpoint_is_not_http (): void
44
44
{
45
45
$ this ->expectException (InvalidConfigException::class);
46
46
$ provider = new GoFeatureFlagProvider (
@@ -49,15 +49,15 @@ public function test_should_raise_if_endpoint_is_not_http()
49
49
$ this ->assertInstanceOf (GoFeatureFlagProvider::class, $ provider );
50
50
}
51
51
52
- public function test_empty_endpoint_should_throw ()
52
+ public function test_empty_endpoint_should_throw (): void
53
53
{
54
54
$ this ->expectException (InvalidConfigException::class);
55
55
new GoFeatureFlagProvider (
56
56
new Config ('' )
57
57
);
58
58
}
59
59
60
- public function test_metadata_name_is_defined ()
60
+ public function test_metadata_name_is_defined (): void
61
61
{
62
62
$ config = new Config ('http://localhost:1031 ' );
63
63
$ provider = new GoFeatureFlagProvider ($ config );
@@ -68,7 +68,7 @@ public function test_metadata_name_is_defined()
68
68
69
69
// Metadata tests
70
70
71
- public function test_should_return_the_value_of_the_flag_as_int ()
71
+ public function test_should_return_the_value_of_the_flag_as_int (): void
72
72
{
73
73
$ mockClient = $ this ->createMock (Client::class);
74
74
$ mockResponse = new Response (200 , [], json_encode ([
@@ -98,7 +98,7 @@ public function test_should_return_the_value_of_the_flag_as_int()
98
98
assertEquals ('integer_key ' , $ got ->getFlagKey ());
99
99
}
100
100
101
- private function mockHttpClient ($ provider , $ mockClient )
101
+ private function mockHttpClient ($ provider , $ mockClient ): void
102
102
{
103
103
$ providerReflection = new \ReflectionClass ($ provider );
104
104
$ ofrepApiProperty = $ providerReflection ->getProperty ('ofrepApi ' );
@@ -111,7 +111,7 @@ private function mockHttpClient($provider, $mockClient)
111
111
$ clientProperty ->setValue ($ ofrepApi , $ mockClient );
112
112
}
113
113
114
- public function test_should_return_the_value_of_the_flag_as_float ()
114
+ public function test_should_return_the_value_of_the_flag_as_float (): void
115
115
{
116
116
$ mockClient = $ this ->createMock (Client::class);
117
117
$ mockResponse = new Response (200 , [], json_encode ([
@@ -141,7 +141,7 @@ public function test_should_return_the_value_of_the_flag_as_float()
141
141
assertEquals ('flag-key ' , $ got ->getFlagKey ());
142
142
}
143
143
144
- public function test_should_return_the_value_of_the_flag_as_string ()
144
+ public function test_should_return_the_value_of_the_flag_as_string (): void
145
145
{
146
146
$ mockClient = $ this ->createMock (Client::class);
147
147
$ mockResponse = new Response (200 , [], json_encode ([
@@ -171,7 +171,7 @@ public function test_should_return_the_value_of_the_flag_as_string()
171
171
assertEquals ('flag-key ' , $ got ->getFlagKey ());
172
172
}
173
173
174
- public function test_should_return_the_value_of_the_flag_as_bool ()
174
+ public function test_should_return_the_value_of_the_flag_as_bool (): void
175
175
{
176
176
$ mockClient = $ this ->createMock (Client::class);
177
177
$ mockResponse = new Response (200 , [], json_encode ([
@@ -201,7 +201,7 @@ public function test_should_return_the_value_of_the_flag_as_bool()
201
201
assertEquals ('flag-key ' , $ got ->getFlagKey ());
202
202
}
203
203
204
- public function test_should_return_the_value_of_the_flag_as_object ()
204
+ public function test_should_return_the_value_of_the_flag_as_object (): void
205
205
{
206
206
$ mockClient = $ this ->createMock (Client::class);
207
207
$ mockResponse = new Response (200 , [], json_encode ([
@@ -231,7 +231,7 @@ public function test_should_return_the_value_of_the_flag_as_object()
231
231
assertEquals ('flag-key ' , $ got ->getFlagKey ());
232
232
}
233
233
234
- public function test_should_return_the_default_value_if_flag_is_not_the_right_type ()
234
+ public function test_should_return_the_default_value_if_flag_is_not_the_right_type (): void
235
235
{
236
236
$ mockClient = $ this ->createMock (Client::class);
237
237
$ mockResponse = new Response (200 , [], json_encode ([
@@ -262,7 +262,7 @@ public function test_should_return_the_default_value_if_flag_is_not_the_right_ty
262
262
assertEquals ('integer_key ' , $ got ->getFlagKey ());
263
263
}
264
264
265
- public function test_should_return_the_default_value_of_the_flag_if_error_send_by_the_API_http_code_403 ()
265
+ public function test_should_return_the_default_value_of_the_flag_if_error_send_by_the_API_http_code_403 (): void
266
266
{
267
267
$ mockClient = $ this ->createMock (Client::class);
268
268
$ mockResponse = new Response (403 , [], json_encode ([]));
@@ -288,7 +288,7 @@ public function test_should_return_the_default_value_of_the_flag_if_error_send_b
288
288
assertEquals ('boolean_key ' , $ got ->getFlagKey ());
289
289
}
290
290
291
- public function test_should_return_the_default_value_of_the_flag_if_error_send_by_the_API__http_code_400__ ()
291
+ public function test_should_return_the_default_value_of_the_flag_if_error_send_by_the_API__http_code_400 (): void
292
292
{
293
293
$ mockClient = $ this ->createMock (Client::class);
294
294
$ mockResponse = new Response (400 , [], json_encode ([
@@ -319,7 +319,7 @@ public function test_should_return_the_default_value_of_the_flag_if_error_send_b
319
319
assertEquals ('boolean_key ' , $ got ->getFlagKey ());
320
320
}
321
321
322
- public function test_should_return_default_value_if_no_evaluation_context ()
322
+ public function test_should_return_default_value_if_no_evaluation_context (): void
323
323
{
324
324
$ mockClient = $ this ->createMock (Client::class);
325
325
$ mockResponse = new Response (200 , [], json_encode ([
@@ -349,7 +349,7 @@ public function test_should_return_default_value_if_no_evaluation_context()
349
349
assertEquals ('boolean_key ' , $ got ->getFlagKey ());
350
350
}
351
351
352
- public function test_should_return_default_value_if_evaluation_context_has_empty_string_targetingKey ()
352
+ public function test_should_return_default_value_if_evaluation_context_has_empty_string_targetingKey (): void
353
353
{
354
354
$ mockClient = $ this ->createMock (Client::class);
355
355
$ mockResponse = new Response (200 , [], json_encode ([
@@ -379,7 +379,7 @@ public function test_should_return_default_value_if_evaluation_context_has_empty
379
379
assertEquals ('boolean_key ' , $ got ->getFlagKey ());
380
380
}
381
381
382
- public function test_should_return_default_value_if_evaluation_context_has_null_targetingKey ()
382
+ public function test_should_return_default_value_if_evaluation_context_has_null_targetingKey (): void
383
383
{
384
384
$ mockClient = $ this ->createMock (Client::class);
385
385
$ mockResponse = new Response (200 , [], json_encode ([
@@ -409,7 +409,7 @@ public function test_should_return_default_value_if_evaluation_context_has_null_
409
409
assertEquals ('boolean_key ' , $ got ->getFlagKey ());
410
410
}
411
411
412
- public function test_should_return_default_value_if_flag_key_empty_string ()
412
+ public function test_should_return_default_value_if_flag_key_empty_string (): void
413
413
{
414
414
$ mockClient = $ this ->createMock (Client::class);
415
415
$ mockResponse = new Response (200 , [], json_encode ([
@@ -439,7 +439,7 @@ public function test_should_return_default_value_if_flag_key_empty_string()
439
439
assertEquals ('' , $ got ->getFlagKey ());
440
440
}
441
441
442
- public function test_return_an_error_API_response_if_500 ()
442
+ public function test_return_an_error_API_response_if_500 (): void
443
443
{
444
444
$ mockClient = $ this ->createMock (Client::class);
445
445
$ mockResponse = new Response (500 , [], json_encode ([]));
@@ -472,7 +472,7 @@ protected function setUp(): void
472
472
$ this ->defaultEvaluationContext = new MutableEvaluationContext ("214b796a-807b-4697-b3a3-42de0ec10a37 " , new Attributes (["email " => "contact@gofeatureflag.org " ]));
473
473
}
474
474
475
- private function mockClient ($ provider , $ mockClient )
475
+ private function mockClient ($ provider , $ mockClient ): void
476
476
{
477
477
$ providerReflection = new \ReflectionClass ($ provider );
478
478
$ ofrepApiProperty = $ providerReflection ->getProperty ('ofrepApi ' );
0 commit comments