xref: /PHP-7.3/ext/ldap/tests/ldap_add_basic.phpt (revision a5629f88)
1--TEST--
2ldap_add() - Basic add operation
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);
14
15var_dump(
16	ldap_add($link, "dc=my-domain,$base", array(
17		"objectClass"	=> array(
18			"top",
19			"dcObject",
20			"organization"),
21		"dc"			=> "my-domain",
22		"o"				=> "my-domain",
23	)),
24	ldap_get_entries(
25		$link,
26		ldap_search($link, "$base", "(o=my-domain)")
27	)
28);
29?>
30===DONE===
31--CLEAN--
32<?php
33require "connect.inc";
34
35$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
36
37ldap_delete($link, "dc=my-domain,$base");
38?>
39--EXPECTF--
40bool(true)
41array(2) {
42  ["count"]=>
43  int(1)
44  [0]=>
45  array(8) {
46    ["objectclass"]=>
47    array(4) {
48      ["count"]=>
49      int(3)
50      [0]=>
51      string(3) "top"
52      [1]=>
53      string(8) "dcObject"
54      [2]=>
55      string(12) "organization"
56    }
57    [0]=>
58    string(11) "objectclass"
59    ["dc"]=>
60    array(2) {
61      ["count"]=>
62      int(1)
63      [0]=>
64      string(9) "my-domain"
65    }
66    [1]=>
67    string(2) "dc"
68    ["o"]=>
69    array(2) {
70      ["count"]=>
71      int(1)
72      [0]=>
73      string(9) "my-domain"
74    }
75    [2]=>
76    string(1) "o"
77    ["count"]=>
78    int(3)
79    ["dn"]=>
80    string(%d) "dc=my-domain,%s"
81  }
82}
83===DONE===
84