xref: /php-src/ext/ldap/tests/ldap_explode_dn.phpt (revision 849a34e4)
1--TEST--
2ldap_explode_dn() test
3--EXTENSIONS--
4ldap
5--FILE--
6<?php
7
8/* Explode with attributes */
9var_dump(ldap_explode_dn("cn=bob,dc=example,dc=com", 0));
10
11/* Explode with attributes */
12var_dump(ldap_explode_dn("cn=bob,ou=users,dc=example,dc=com", 0));
13
14/* Explode without attributes */
15var_dump(ldap_explode_dn("cn=bob,dc=example,dc=com", 1));
16
17/* Explode without attributes */
18var_dump(ldap_explode_dn("cn=bob,ou=users,dc=example,dc=com", 1));
19
20/* Explode with attributes and < > characters */
21var_dump(ldap_explode_dn("cn=<bob>,dc=example,dc=com", 0));
22
23/* Explode without attributes and < > characters */
24var_dump(ldap_explode_dn("cn=<bob>,dc=example,dc=com", 1));
25
26/* Bad DN value with attributes */
27var_dump(ldap_explode_dn("bob,dc=example,dc=com", 0));
28
29/* Bad DN value without attributes */
30var_dump(ldap_explode_dn("bob,dc=example,dc=com", 1));
31
32echo "Done\n";
33
34?>
35--EXPECT--
36array(4) {
37  ["count"]=>
38  int(3)
39  [0]=>
40  string(6) "cn=bob"
41  [1]=>
42  string(10) "dc=example"
43  [2]=>
44  string(6) "dc=com"
45}
46array(5) {
47  ["count"]=>
48  int(4)
49  [0]=>
50  string(6) "cn=bob"
51  [1]=>
52  string(8) "ou=users"
53  [2]=>
54  string(10) "dc=example"
55  [3]=>
56  string(6) "dc=com"
57}
58array(4) {
59  ["count"]=>
60  int(3)
61  [0]=>
62  string(3) "bob"
63  [1]=>
64  string(7) "example"
65  [2]=>
66  string(3) "com"
67}
68array(5) {
69  ["count"]=>
70  int(4)
71  [0]=>
72  string(3) "bob"
73  [1]=>
74  string(5) "users"
75  [2]=>
76  string(7) "example"
77  [3]=>
78  string(3) "com"
79}
80bool(false)
81bool(false)
82bool(false)
83bool(false)
84Done
85