1--TEST--
2ldap_rename() - Basic ldap_rename test
3--CREDITS--
4Patrick Allaert <patrickallaert@php.net>
5# Belgian PHP Testfest 2009
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);
15var_dump(
16	ldap_rename($link, "cn=userA,dc=my-domain,dc=com", "cn=userZ", "dc=my-domain,dc=com", true)
17);
18$result = ldap_search($link, "dc=my-domain,dc=com", "(cn=userA)", array("cn", "sn"));
19$result = ldap_search($link, "dc=my-domain,dc=com", "(cn=userZ)", array("cn", "sn"));
20var_dump(ldap_get_entries($link, $result));
21?>
22===DONE===
23--CLEAN--
24<?php
25include "connect.inc";
26
27$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
28ldap_rename($link, "cn=userZ,dc=my-domain,dc=com", "cn=userA", "dc=my-domain,dc=com", true);
29remove_dummy_data($link);
30?>
31--EXPECT--
32bool(true)
33array(2) {
34  ["count"]=>
35  int(1)
36  [0]=>
37  array(6) {
38    ["sn"]=>
39    array(2) {
40      ["count"]=>
41      int(1)
42      [0]=>
43      string(7) "testSN1"
44    }
45    [0]=>
46    string(2) "sn"
47    ["cn"]=>
48    array(2) {
49      ["count"]=>
50      int(1)
51      [0]=>
52      string(5) "userZ"
53    }
54    [1]=>
55    string(2) "cn"
56    ["count"]=>
57    int(2)
58    ["dn"]=>
59    string(28) "cn=userZ,dc=my-domain,dc=com"
60  }
61}
62===DONE===
63