1Net::LDAP::Server::TestU(s3e)r Contributed Perl DocumentaNteito:n:LDAP::Server::Test(3)
2
3
4

NAME

6       Net::LDAP::Server::Test - test Net::LDAP code
7

SYNOPSIS

9           use Test::More tests => 10;
10           use Net::LDAP::Server::Test;
11
12           ok( my $server = Net::LDAP::Server::Test->new(8080),
13                   "test LDAP server spawned");
14
15           # connect to port 8080 with your Net::LDAP code.
16           ok(my $ldap = Net::LDAP->new( 'localhost', port => 8080 ),
17                    "new LDAP connection" );
18
19           # ... test stuff with $ldap ...
20
21           # server will exit when you call final LDAP unbind().
22           ok($ldap->unbind(), "LDAP server unbound");
23

DESCRIPTION

25       Now you can test your Net::LDAP code without having a real LDAP server
26       available.
27

METHODS

29       Only one user-level method is implemented: new().
30
31   new( port, key_value_args )
32       Create a new server. Basically this just fork()s a child process
33       listing on port and handling requests using Net::LDAP::Server.
34
35       port defaults to 10636.
36
37       port may be an IO::Socket object listening to a local port.
38
39       key_value_args may be:
40
41       data
42           data is optional data to return from the Net::LDAP search()
43           function.  Typically it would be an array ref of Net::LDAP::Entry
44           objects.
45
46       auto_schema
47           A true value means the add(), modify() and delete() methods will
48           store internal in-memory data based on DN values, so that search()
49           will mimic working on a real LDAP schema.
50
51       active_directory
52           Work in Active Directory mode. This means that entries are
53           automatically assigned a objectSID, and some effort is made to
54           mimic the member/memberOf linking between AD Users and Groups.
55
56       new() will croak() if there was a problem fork()ing a new server.
57
58       Returns a Net::LDAP::Server::Test object, which is just a blessed
59       reference to the PID of the forked server.
60
61   stop
62       Calls waitpid() on the server's associated child process.  You may find
63       it helpful to call this method explicitly, especially if you are
64       creating multiple servers in the same test. Otherwise, this method is
65       typically not needed and may even cause your tests to hang indefinitely
66       if they die prematurely. YMMV.
67
68       To prevent waitpid() from blocking and hanging your test server, it is
69       wrapped in an alarm() call, which will wait 2 seconds and then call
70       kill() on the reluctant pid. You have been warned.
71
72   port_is_open
73       Returns an IO::Socket (or subclass) for the current server port.  If
74       the port is already in use, this is a false value.
75

AUTHOR

77       Peter Karman, "<karman at cpan.org>"
78

BUGS

80       Please report any bugs or feature requests to "bug-net-ldap-server-test
81       at rt.cpan.org", or through the web interface at
82       <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-LDAP-Server-Test>.
83       I will be notified, and then you'll automatically be notified of
84       progress on your bug as I make changes.
85

SUPPORT

87       You can find documentation for this module with the perldoc command.
88
89           perldoc Net::LDAP::Server::Test
90
91       You can also look for information at:
92
93       ·   AnnoCPAN: Annotated CPAN documentation
94
95           <http://annocpan.org/dist/Net-LDAP-Server-Test>
96
97       ·   CPAN Ratings
98
99           <http://cpanratings.perl.org/d/Net-LDAP-Server-Test>
100
101       ·   RT: CPAN's request tracker
102
103           <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-LDAP-Server-Test>
104
105       ·   Search CPAN
106
107           <http://search.cpan.org/dist/Net-LDAP-Server-Test>
108

ACKNOWLEDGEMENTS

110       The Minnesota Supercomputing Institute "http://www.msi.umn.edu/"
111       sponsored the development of this software.
112
114       Copyright 2007 by the Regents of the University of Minnesota.
115
116       This program is free software; you can redistribute it and/or modify it
117       under the same terms as Perl itself.
118

SEE ALSO

120       Net::LDAP::Server
121
122
123
124perl v5.32.0                      2020-07-28        Net::LDAP::Server::Test(3)
Impressum