php-src/ext/ldap/tests/ldap_rename_basic.phpt
Côme Bernigaud a5629f8845 Fixed LDAP tests so that base can exists
Now you can set the base in the env var LDAP_TEST_BASE.
The base has to exists. (before tests were attempting to create/delete
the base itself)
2015-06-17 13:55:13 +02:00

63 lines
1.3 KiB
PHP

--TEST--
ldap_rename() - Basic ldap_rename test
--CREDITS--
Patrick Allaert <patrickallaert@php.net>
# Belgian PHP Testfest 2009
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipifbindfailure.inc'); ?>
--FILE--
<?php
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
var_dump(
ldap_rename($link, "cn=userA,$base", "cn=userZ", "$base", true)
);
$result = ldap_search($link, "$base", "(cn=userA)", array("cn", "sn"));
$result = ldap_search($link, "$base", "(cn=userZ)", array("cn", "sn"));
var_dump(ldap_get_entries($link, $result));
?>
===DONE===
--CLEAN--
<?php
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
ldap_rename($link, "cn=userZ,$base", "cn=userA", "$base", true);
remove_dummy_data($link, $base);
?>
--EXPECTF--
bool(true)
array(2) {
["count"]=>
int(1)
[0]=>
array(6) {
["sn"]=>
array(2) {
["count"]=>
int(1)
[0]=>
string(7) "testSN1"
}
[0]=>
string(2) "sn"
["cn"]=>
array(2) {
["count"]=>
int(1)
[0]=>
string(5) "userZ"
}
[1]=>
string(2) "cn"
["count"]=>
int(2)
["dn"]=>
string(%d) "cn=userZ,%s"
}
}
===DONE===