xref: /PHP-5.5/ext/oci8/tests/extauth_03.phpt (revision 2e6db16f)
1--TEST--
2Test External Authentication errors with oci_pconnect
3--SKIPIF--
4<?php
5if (!extension_loaded('oci8')) die ("skip no oci8 extension");
6if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request');
7if (substr(PHP_OS, 0, 3) == 'WIN') die("skip feature not available on Windows platforms");
8?>
9--INI--
10oci8.privileged_connect=1
11--FILE--
12<?php
13
14// Run Test
15
16echo "Test 1\n";
17
18$c = oci_pconnect('/', 'notemtpy', 'anything', null, OCI_CRED_EXT);
19if (!$c) {
20	$m = oci_error();
21	var_dump($m);
22}
23var_dump($c);
24
25echo "Test 2\n";
26
27$c = oci_pconnect('notemtpy', 'notemtpy', 'anything', null, OCI_CRED_EXT);
28if (!$c) {
29	$m = oci_error();
30	var_dump($m);
31}
32var_dump($c);
33
34echo "Test 3\n";
35
36$c = oci_pconnect('notemtpy', '', 'anything', null, OCI_CRED_EXT);
37if (!$c) {
38	$m = oci_error();
39	var_dump($m);
40}
41var_dump($c);
42
43echo "Test 4\n";
44
45$c = oci_pconnect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER);
46if (!$c) {
47	$m = oci_error();
48	var_dump($m);
49}
50var_dump($c);
51
52echo "Test 5\n";
53
54$c = oci_pconnect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER+OCI_CRED_EXT);
55if (!$c) {
56	$m = oci_error();
57	var_dump($m);
58}
59var_dump($c);
60
61echo "Test 6\n";
62
63$c = oci_pconnect('', '', 'anything', null, OCI_CRED_EXT);
64if (!$c) {
65	$m = oci_error();
66	var_dump($m);
67}
68var_dump($c);
69
70echo "Test 7\n";
71
72$c = oci_pconnect('/', '', 'anything', null, OCI_CRED_EXT);
73if (!$c) {
74	$m = oci_error();
75	var_dump($m);
76}
77var_dump($c);
78
79echo "Test 8\n";
80
81$c = oci_pconnect('/', null, 'anything', null, OCI_CRED_EXT);
82if (!$c) {
83	$m = oci_error();
84	var_dump($m);
85}
86var_dump($c);
87
88echo "Test 9\n";
89
90$c = oci_pconnect('/', '', 'c', null, OCI_SYSDBA+OCI_CRED_EXT);
91if (!$c) {
92	$m = oci_error();
93	var_dump($m);
94}
95var_dump($c);
96
97echo "Test 10\n";
98
99$c = oci_pconnect('/', '', 'c', null, OCI_SYSOPER+OCI_CRED_EXT);
100if (!$c) {
101	$m = oci_error();
102	var_dump($m);
103}
104var_dump($c);
105
106
107?>
108===DONE===
109<?php exit(0); ?>
110--EXPECTF--
111Test 1
112
113Warning: oci_pconnect(): OCI_CRED_EXT can only be used with a username of "/" and a NULL password in %s on line %d
114bool(false)
115bool(false)
116Test 2
117
118Warning: oci_pconnect(): OCI_CRED_EXT can only be used with a username of "/" and a NULL password in %s on line %d
119bool(false)
120bool(false)
121Test 3
122
123Warning: oci_pconnect(): OCI_CRED_EXT can only be used with a username of "/" and a NULL password in %s on line %d
124bool(false)
125bool(false)
126Test 4
127
128Warning: oci_pconnect(): OCI_SYSDBA and OCI_SYSOPER cannot be used together in %s on line %d
129bool(false)
130bool(false)
131Test 5
132
133Warning: oci_pconnect(): OCI_SYSDBA and OCI_SYSOPER cannot be used together in %s on line %d
134bool(false)
135bool(false)
136Test 6
137
138Warning: oci_pconnect(): OCI_CRED_EXT can only be used with a username of "/" and a NULL password in %s on line %d
139bool(false)
140bool(false)
141Test 7
142
143Warning: oci_pconnect(): ORA-12154: %s in %s on line %d
144array(4) {
145  [%u|b%"code"]=>
146  int(12154)
147  [%u|b%"message"]=>
148  %unicode|string%(%d) "ORA-12154: %s"
149  [%u|b%"offset"]=>
150  int(0)
151  [%u|b%"sqltext"]=>
152  %unicode|string%(0) ""
153}
154bool(false)
155Test 8
156
157Warning: oci_pconnect(): ORA-12154: %s in %s on line %d
158array(4) {
159  [%u|b%"code"]=>
160  int(12154)
161  [%u|b%"message"]=>
162  %unicode|string%(%d) "ORA-12154: %s"
163  [%u|b%"offset"]=>
164  int(0)
165  [%u|b%"sqltext"]=>
166  %unicode|string%(0) ""
167}
168bool(false)
169Test 9
170
171Warning: oci_pconnect(): ORA-%d: TNS:%s in %s on line %d
172array(4) {
173  [%u|b%"code"]=>
174  int(%d)
175  [%u|b%"message"]=>
176  %unicode|string%(%d) "ORA-%d: %s"
177  [%u|b%"offset"]=>
178  int(0)
179  [%u|b%"sqltext"]=>
180  %unicode|string%(0) ""
181}
182bool(false)
183Test 10
184
185Warning: oci_pconnect(): ORA-%d: TNS:%s in %s on line %d
186array(4) {
187  [%u|b%"code"]=>
188  int(%d)
189  [%u|b%"message"]=>
190  %unicode|string%(%d) "ORA-%d: %s"
191  [%u|b%"offset"]=>
192  int(0)
193  [%u|b%"sqltext"]=>
194  %unicode|string%(0) ""
195}
196bool(false)
197===DONE===
198