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

use Test::More tests => 10;
use Net::LDAP::Server::Test;
ok( my $server = Net::LDAP::Server::Test->new(8080),
"test LDAP server spawned");
# connect to port 8080 with your Net::LDAP code.
ok(my $ldap = Net::LDAP->new( 'localhost', port => 8080 ),
"new LDAP connection" );
# ... test stuff with $ldap ...
# server will exit when you call final LDAP unbind().
ok($ldap->unbind(), "LDAP server unbound");

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

Only one user-level method is implemented: new().
Create a new server. Basically this just fork()s a child process listing on port and handling requests using Net::LDAP::Server.
port defaults to 10636.
key_value_args may be:
data is optional data to return from the Net::LDAP search() function. Typically it would be an array ref of Net::LDAP::Entry objects.
A true value means the add(), modify() and delete() methods will store internal in-memory data based on DN values, so that search() will mimic working on a real LDAP schema.
Work in Active Directory mode. This means that entries are automatically assigned a objectSID, and some effort is made to mimic the member/memberOf linking between AD Users and Groups.
new() will croak() if there was a problem fork()ing a new server.
Returns a Net::LDAP::Server::Test object, which is just a blessed reference to the PID of the forked server.
When a LDAP test server object is destroyed, waitpid() is called on the associated child process. Typically this is unnecessary, but implemented here as an exercise.

Peter Karman, <karman at cpan.org>

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

You can find documentation for this module with the perldoc command.
perldoc Net::LDAP::Server::Test
You can also look for information at:
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-LDAP-Server-Test

The Minnesota Supercomputing Institute http://www.msi.umn.edu/ sponsored the development of this software.

Copyright 2007 by the Regents of the University of Minnesota.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
