+----------------------------------------+
| Howto for a OpenLDAP based test server |
+----------------------------------------+


PREFACE
=======

This file describes briefly, how you can set up an OpenLDAP-based
test server where you can run the tests on.
The test cases and ini-files match this guide, so after following it,
you can readily start to run all tests out of the box.

 /!\  DO NOT DO THIS ON A PRODUCTION MACHINE OR  /!\
 /!\       ONE CONNECTED TO THE INTERNET         /!\

If you already have a test server in place, then:
 - You don't need to install or configure OpenLDAP
 - Adjust the DN in Net_LDAP2/trunk/tests/ldif_data/INITIAL_TESTDATA.ldif
   to match your tree
 - Adjust your ldapconfig.ini to match your servers setup




THE GUIDE
=========

0. PHP, phpunit
Of course you will need this to run the tests...


1. Install and configure OpenLDAP
Config:
 - base:           dc=example,dc=com
 - admin:          admin (will map to cn=admin,dc=example,dc=com)
 - admin-password: test

Needed schemas: core, inetorgperson
Note that the core schema is usually already present and you have good chances
that the inetorgperson one is there too.
You can apply the schema ldifs after the initial install of openldap with ldapadd:
  Net_LDAP2/trunk/tests$  ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/inetorgperson.ldif

A note for debian users:
Since some recent version the installer does not ask for the baseDN anymore.
Before using apt to install, you may need to manipulate the /etc/hosts, so the
command `dnsdomainname` will return 'example.com'. Then just do `apt-get install slapd`.
The other solution is to adjust all ldif files here and also the test case php scripts.


2. Import basic Net_LDAP2 test data
Net_LDAP2 provides an basic LDIF file that maps to the test cases initial config:
  Net_LDAP2/trunk/tests$ ldapadd -D cn=admin,dc=example,dc=com -W -H ldapi:/// -f ldif_data/INITIAL_TESTDATA.ldif


3. configure test suite
Copy the default config to a real one:
  Net_LDAP2/trunk/tests$ cp ldapconfig.ini.dist ldapconfig.ini


4. run the tests
 - all tests:       Net_LDAP2/trunk/tests$ phpunit AllTests.php
 - a specific test: Net_LDAP2/trunk/tests$ phpunit Net_LDAP2_UtilTest.php
