xref: /PHP-8.0/ext/ldap/tests/ldap_add_basic.phpt (revision f8d79582)
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--CLEAN--
31<?php
32require "connect.inc";
33
34$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
35
36ldap_delete($link, "dc=my-domain,$base");
37?>
38--EXPECTF--
39bool(true)
40array(2) {
41  ["count"]=>
42  int(1)
43  [0]=>
44  array(8) {
45    ["objectclass"]=>
46    array(4) {
47      ["count"]=>
48      int(3)
49      [0]=>
50      string(3) "top"
51      [1]=>
52      string(8) "dcObject"
53      [2]=>
54      string(12) "organization"
55    }
56    [0]=>
57    string(11) "objectclass"
58    ["dc"]=>
59    array(2) {
60      ["count"]=>
61      int(1)
62      [0]=>
63      string(9) "my-domain"
64    }
65    [1]=>
66    string(2) "dc"
67    ["o"]=>
68    array(2) {
69      ["count"]=>
70      int(1)
71      [0]=>
72      string(9) "my-domain"
73    }
74    [2]=>
75    string(1) "o"
76    ["count"]=>
77    int(3)
78    ["dn"]=>
79    string(%d) "dc=my-domain,%s"
80  }
81}
82