1--TEST--
2ldap_modify_batch() - Basic batch modify operation
3--CREDITS--
4Patrick Allaert <patrickallaert@php.net>
5Ondřej Hošek <ondra.hosek@gmail.com>
6--SKIPIF--
7<?php require_once('skipif.inc'); ?>
8<?php require_once('skipifbindfailure.inc'); ?>
9--FILE--
10<?php
11require "connect.inc";
12
13$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
14insert_dummy_data($link);
15
16$mods = array(
17	array(
18		"attrib"	=> "telephoneNumber",
19		"modtype"	=> LDAP_MODIFY_BATCH_ADD,
20		"values"	=> array(
21			"+1 555 5551717"
22		)
23	),
24	array(
25		"attrib"	=> "sn",
26		"modtype"	=> LDAP_MODIFY_BATCH_REPLACE,
27		"values"	=> array("Brown-Smith")
28	),
29	array(
30		"attrib"	=> "description",
31		"modtype"	=> LDAP_MODIFY_BATCH_REMOVE_ALL
32	)
33);
34
35var_dump(
36	ldap_modify_batch($link, "cn=userA,dc=my-domain,dc=com", $mods),
37	ldap_get_entries($link, ldap_search($link, "dc=my-domain,dc=com", "(sn=Brown-Smith)"))
38);
39?>
40===DONE===
41--CLEAN--
42<?php
43require "connect.inc";
44
45$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
46
47remove_dummy_data($link);
48?>
49--EXPECT--
50bool(true)
51array(2) {
52  ["count"]=>
53  int(1)
54  [0]=>
55  array(12) {
56    ["objectclass"]=>
57    array(2) {
58      ["count"]=>
59      int(1)
60      [0]=>
61      string(6) "person"
62    }
63    [0]=>
64    string(11) "objectclass"
65    ["cn"]=>
66    array(2) {
67      ["count"]=>
68      int(1)
69      [0]=>
70      string(5) "userA"
71    }
72    [1]=>
73    string(2) "cn"
74    ["userpassword"]=>
75    array(2) {
76      ["count"]=>
77      int(1)
78      [0]=>
79      string(4) "oops"
80    }
81    [2]=>
82    string(12) "userpassword"
83    ["telephonenumber"]=>
84    array(3) {
85      ["count"]=>
86      int(2)
87      [0]=>
88      string(14) "xx-xx-xx-xx-xx"
89      [1]=>
90      string(14) "+1 555 5551717"
91    }
92    [3]=>
93    string(15) "telephonenumber"
94    ["sn"]=>
95    array(2) {
96      ["count"]=>
97      int(1)
98      [0]=>
99      string(11) "Brown-Smith"
100    }
101    [4]=>
102    string(2) "sn"
103    ["count"]=>
104    int(5)
105    ["dn"]=>
106    string(28) "cn=userA,dc=my-domain,dc=com"
107  }
108}
109===DONE===
110