-
Notifications
You must be signed in to change notification settings - Fork 183
Expand file tree
/
Copy pathphpinfo_03.phpt
More file actions
73 lines (66 loc) · 1.88 KB
/
Copy pathphpinfo_03.phpt
File metadata and controls
73 lines (66 loc) · 1.88 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
67
68
69
70
71
72
73
--TEST--
[profiling] test profiler's extension info
--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_LOG_LEVEL=off
DD_PROFILING_EXPERIMENTAL_CPU_TIME_ENABLED=no
DD_PROFILING_ALLOCATION_ENABLED=no
DD_PROFILING_EXCEPTION_ENABLED=no
DD_SERVICE=datadog-profiling-phpt
DD_ENV=dev
DD_VERSION=13
DD_AGENT_HOST=localh0st
DD_TRACE_AGENT_PORT=80
DD_TRACE_AGENT_URL=http://datadog:8126
--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"],
["Experimental CPU Time Profiling Enabled", "false"],
["Allocation Profiling Enabled", "false"],
["Exception Profiling Enabled", "false"],
["I/O Profiling Enabled", "true"],
["Endpoint Collection Enabled", "true"],
["Profiling Log Level", "off"],
["Profiling Agent Endpoint", "http://datadog:8126/"],
["Application's Environment (DD_ENV)", "dev"],
["Application's Service (DD_SERVICE)", "datadog-profiling-phpt"],
["Application's Version (DD_VERSION)", "13"],
];
foreach ($sections as [$key, $expected]) {
assert(
$values[$key] === $expected,
"Expected '{$expected}', found '{$values[$key]}', for key '{$key}'"
);
}
echo "Done.", PHP_EOL;
?>
--EXPECT--
Done.