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--EXTENSIONS--
7ldap
8--SKIPIF--
9<?php require_once('skipifbindfailure.inc'); ?>
10--FILE--
11<?php
12require "connect.inc";
13
14$link = ldap_connect_and_bind($uri, $user, $passwd, $protocol_version);
15insert_dummy_data($link, $base);
16
17$mods = array(
18    array(
19        "attrib"	=> "telephoneNumber",
20        "modtype"	=> LDAP_MODIFY_BATCH_ADD,
21        "values"	=> array(
22            "+1 555 5551717"
23        )
24    ),
25    array(
26        "attrib"	=> "sn",
27        "modtype"	=> LDAP_MODIFY_BATCH_REPLACE,
28        "values"	=> array("Brown-Smith")
29    ),
30    array(
31        "attrib"	=> "description",
32        "modtype"	=> LDAP_MODIFY_BATCH_REMOVE_ALL
33    )
34);
35
36var_dump(
37    ldap_modify_batch($link, "cn=userA,$base", $mods),
38    ldap_get_entries($link, ldap_search($link, "$base", "(sn=Brown-Smith)"))
39);
40?>
41--CLEAN--
42<?php
43require "connect.inc";
44
45$link = ldap_connect_and_bind($uri, $user, $passwd, $protocol_version);
46
47remove_dummy_data($link, $base);
48?>
49--EXPECTF--
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(%d) "%s"
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(%d) "cn=userA,%s"
107  }
108}
109