File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
hooks/OpenTelemetry/tests/integration Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 9
9
use OpenFeature \OpenFeatureAPI ;
10
10
use OpenFeature \interfaces \hooks \Hook ;
11
11
12
+ use function phpversion ;
13
+ use function preg_match ;
14
+
12
15
class OpenTelemetryHookTest extends TestCase
13
16
{
14
17
public function testIsRegisteredAutomatically (): void
@@ -21,7 +24,8 @@ public function testIsRegisteredAutomatically(): void
21
24
$ this ->simulateAutoload ();
22
25
23
26
// Then
24
- $ this ->assertNotEmpty ($ api ->getHooks ());
27
+
28
+ $ this ->assertCount ($ this ->isAutoloadSupported () ? 1 : 0 , $ api ->getHooks ());
25
29
$ this ->assertInstanceOf (Hook::class, $ api ->getHooks ()[0 ]);
26
30
}
27
31
@@ -43,4 +47,15 @@ private function simulateAutoload(): void
43
47
{
44
48
require_once __DIR__ . '/../../src/_autoload.php ' ;
45
49
}
50
+
51
+ private function isAutoloadSupported (): bool
52
+ {
53
+ $ version = phpversion ();
54
+
55
+ if (!$ version ) {
56
+ return false ;
57
+ }
58
+
59
+ return preg_match ('/8\..+/ ' , $ version ) === 1 ;
60
+ }
46
61
}
You can’t perform that action at this time.
0 commit comments