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