-
Notifications
You must be signed in to change notification settings - Fork 183
Expand file tree
/
Copy pathphpinfo_07.phpt
More file actions
66 lines (59 loc) · 1.71 KB
/
Copy pathphpinfo_07.phpt
File metadata and controls
66 lines (59 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
--TEST--
[profiling] test profiler's extension info with experimental feature override
--DESCRIPTION--
The profiler's phpinfo section contains important debugging information. This
test verifies that certain information is present.
--SKIPIF--
<?php
if (!extension_loaded('datadog-profiling'))
echo "skip: test requires Datadog Continuous Profiler\n";
?>
--ENV--
DD_PROFILING_ENABLED=yes
DD_PROFILING_EXPERIMENTAL_FEATURES_ENABLED=yes
DD_PROFILING_LOG_LEVEL=off
DD_PROFILING_EXPERIMENTAL_CPU_TIME_ENABLED=no
DD_PROFILING_ALLOCATION_ENABLED=no
DD_PROFILING_EXCEPTION_ENABLED=no
DD_PROFILING_TIMELINE_ENABLED=no
DD_PROFILING_EXPERIMENTAL_IO_ENABLED=no
--INI--
assert.exception=1
opcache.jit=off
--FILE--
<?php
ob_start();
$extension = new ReflectionExtension('datadog-profiling');
$extension->info();
$output = ob_get_clean();
$lines = preg_split("/\R/", $output);
$values = [];
foreach ($lines as $line) {
$pair = explode("=>", $line);
if (count($pair) != 2) {
continue;
}
$values[trim($pair[0])] = trim($pair[1]);
}
// Check that Version exists, but not its value
assert(isset($values["Version"]));
// Check exact values for this set
$sections = [
["Profiling Enabled", "true"],
["Profiling Experimental Features Enabled", "true"],
["Experimental CPU Time Profiling Enabled", "true (all experimental features enabled)"],
["Allocation Profiling Enabled", "false"],
["Exception Profiling Enabled", "false"],
["Timeline Enabled", "false"],
["I/O Profiling Enabled", "false"],
];
foreach ($sections as [$key, $expected]) {
assert(
$values[$key] === $expected,
"Expected '{$expected}', found '{$values[$key]}', for key '{$key}'"
);
}
echo "Done.";
?>
--EXPECT--
Done.