Annotation of embedaddon/php/ext/oci8/tests/password.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: oci_password_change() for non-persistent connections
3: --SKIPIF--
4: <?php
5: if (!extension_loaded('oci8')) die("skip no oci8 extension");
6: require(dirname(__FILE__)."/details.inc");
7: if (empty($dbase)) die ("skip requires database connection string be set");
8: if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
9: if ($test_drcp) die("skip password change not supported in DRCP Mode");
10: ?>
11: --FILE--
12: <?php
13:
14: require(dirname(__FILE__)."/connect.inc");
15:
16: $stmtarray = array(
17: "drop user testuser cascade",
18: "create user testuser identified by testuserpwd",
19: "grant connect, create session to testuser"
20: );
21:
22: oci8_test_sql_execute($c, $stmtarray);
23:
24:
25: // Connect and change the password
26: $c1 = oci_connect("testuser", "testuserpwd", $dbase);
27: var_dump($c1);
28: $rn1 = (int)$c1;
29:
30: oci_password_change($c1, "testuser", "testuserpwd", "testuserpwd2");
31:
32: // Second connect should return a new resource because the hash string will be different from $c1
33: $c2 = oci_connect("testuser", "testuserpwd2", $dbase);
34: var_dump($c2);
35: $rn2 = (int)$c2;
36:
37: // Despite using the old password this connect should succeed and return the original resource
38: $c3 = oci_connect("testuser", "testuserpwd", $dbase);
39: var_dump($c3);
40: $rn3 = (int)$c3;
41:
42: // Connections should differ
43: if ($rn1 == $rn2) {
44: echo "First and second connections share a resource: Not OK\n";
45: var_dump($c1);
46: }
47: else {
48: echo "First and second connections are different: OK\n";
49: }
50:
51: // Connections should be the same
52: if ($rn1 == $rn3) {
53: echo "First and third connections share a resource: OK\n";
54: }
55: else {
56: echo "First and third connections are different: Not OK\n";
57: var_dump($c1);
58: var_dump($c2);
59: }
60:
61: echo "Done\n";
62:
63: ?>
64: --CLEAN--
65: <?php
66:
67: require(dirname(__FILE__)."/connect.inc");
68:
69: $stmtarray = array(
70: "drop user testuser cascade"
71: );
72:
73: oci8_test_sql_execute($c, $stmtarray);
74:
75: ?>
76: --EXPECTF--
77: resource(%d) of type (oci8 connection)
78: resource(%d) of type (oci8 connection)
79: resource(%d) of type (oci8 connection)
80: First and second connections are different: OK
81: First and third connections share a resource: OK
82: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>