summaryrefslogtreecommitdiff
path: root/ext/pdo_oci/tests/pdo_oci_class_constants.phpt
blob: c1d270ddf03d2dfa13acf058e7b83f3ab646b029 (plain)
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--
PDO OCI specific class constants
--SKIPIF--
<?php
if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
require(__DIR__.'/../../pdo/tests/pdo_test.inc');
PDOTest::skip();
?>
--FILE--
<?php

require(__DIR__ . '/../../pdo/tests/pdo_test.inc');

$expected = [
    'OCI_ATTR_CLIENT_INFO'        => true,
    'OCI_ATTR_ACTION'             => true,
    'OCI_ATTR_CLIENT_IDENTIFIER'  => true,
    'OCI_ATTR_MODULE'             => true,
    'OCI_ATTR_CALL_TIMEOUT'       => true,
];

$ref = new ReflectionClass('PDO');
$constants = $ref->getConstants();
$values = [];

foreach ($constants as $name => $value) {
    if (substr($name, 0, 8) == 'OCI_ATTR') {
        if (!isset($values[$value])) {
            $values[$value] = [$name];
        } else {
            $values[$value][] = $name;
        }

        if (isset($expected[$name])) {
            unset($expected[$name]);
            unset($constants[$name]);
        }

        } else {
            unset($constants[$name]);
        }
}

if (!empty($constants)) {
    printf("[001] Dumping list of unexpected constants\n");
    var_dump($constants);
}

if (!empty($expected)) {
    printf("[002] Dumping list of missing constants\n");
    var_dump($expected);
}

if (!empty($values)) {
    foreach ($values as $value => $constants) {
        if (count($constants) > 1) {
            printf("[003] Several constants share the same value '%s'\n", $value);
            var_dump($constants);
        }
    }
}

print "done!";
?>
--EXPECT--
done!