1--TEST--
2PDO OCI specific class constants
3--EXTENSIONS--
4pdo
5pdo_oci
6--SKIPIF--
7<?php
8require(__DIR__.'/../../pdo/tests/pdo_test.inc');
9PDOTest::skip();
10?>
11--FILE--
12<?php
13
14require(__DIR__ . '/../../pdo/tests/pdo_test.inc');
15
16$expected = [
17    'OCI_ATTR_CLIENT_INFO'        => true,
18    'OCI_ATTR_ACTION'             => true,
19    'OCI_ATTR_CLIENT_IDENTIFIER'  => true,
20    'OCI_ATTR_MODULE'             => true,
21    'OCI_ATTR_CALL_TIMEOUT'       => true,
22];
23
24$ref = new ReflectionClass('PDO');
25$constants = $ref->getConstants();
26$values = [];
27
28foreach ($constants as $name => $value) {
29    if (substr($name, 0, 8) == 'OCI_ATTR') {
30        if (!isset($values[$value])) {
31            $values[$value] = [$name];
32        } else {
33            $values[$value][] = $name;
34        }
35
36        if (isset($expected[$name])) {
37            unset($expected[$name]);
38            unset($constants[$name]);
39        }
40
41        } else {
42            unset($constants[$name]);
43        }
44}
45
46if (!empty($constants)) {
47    printf("[001] Dumping list of unexpected constants\n");
48    var_dump($constants);
49}
50
51if (!empty($expected)) {
52    printf("[002] Dumping list of missing constants\n");
53    var_dump($expected);
54}
55
56if (!empty($values)) {
57    foreach ($values as $value => $constants) {
58        if (count($constants) > 1) {
59            printf("[003] Several constants share the same value '%s'\n", $value);
60            var_dump($constants);
61        }
62    }
63}
64
65print "done!";
66?>
67--EXPECT--
68done!
69