API documentation

Plugin

LdapiHelper::Plugin : public BasePlugin

Plugin for LdapiHelper

This class is only a stub so it can be easily found through namespace.

LDAPIConnection

LdapiHelper::LDAP::LDAPIConnection

Static wrapper to share a single LDAPI instance

Public Static Functions

static LdapiHelper\LDAP\LDAPIConnection::get()

Get LDAP reference

return

LDAPI

static LdapiHelper\LDAP\LDAPIConnection::setTestLdapi()

Set local LDAPI instance to a test version

return

void

LdapiBehavior

LdapiHelper::Model::Behavior::LdapiBehavior : public Behavior

LdapiBehavior behavior

Possible options:

  • fields.user => Column containing LDAPUser id (default: ‘user_id’)

  • fields.committee => Column containing LDAPCommittee id (default: ‘committee_id’)

  • entities.user => Key used to store LDAPUser (default: ‘user’)

  • entities.committee => Key used to store LDAPCommittee (default: ‘committee’)

Public Functions

LdapiHelper\Model\Behavior\LdapiBehavior::findWithCommittees(Query $query, array $options)

Include LDAPCommittee objects through LDAPI

This makes use of the user and entity config options.

param $query

param $options

return

Query

LdapiHelper\Model\Behavior\LdapiBehavior::findWithUsers(Query $query, array $options)

Include LDAPUser objects through LDAPI

This makes use of the user and entity config options.

param $query

param $options

return

Query

LdapiHelper\Model\Behavior\LdapiBehavior::formatterObjects(CollectionInterface $results)

Takes in the results collection of a ORM query and process the results

Returns a modified collection, in this case included with LDAPI objects.

param $results

return

CollectionInterface

LdapiTrait

(Auto doc not supported for PHP Traits.)

LdapiHelper::TestSuite::LdapiTestTrait

Include this trait in your test case to fake calls to the LDAP:

use LdapiTestTrait;

Instead of trying to use a remote connection, the local fixture files are used.

TestLdapi

LdapiHelper::TestSuite::TestLdapi : public LDAPI

Test extension of LDAPI

Relies on local fixtures instead of an actual connection. For this test version, no LDAP server is needed.

The basic connect and get functions are overloaded, such that the LDAPI and the returned objects still behave regularly.

Public Functions

LdapiHelper\TestSuite\TestLdapi::__construct()

Overloaded constructor

No actual configuration is loaded.

LdapiHelper\TestSuite\TestLdapi::__destruct()

Overloaded destructor

LdapiHelper\TestSuite\TestLdapi::login( $username,  $password)

Login user from fixtures

Passwords are not saved with users. So instead for testing the username is used as the password.

LdapiHelper\TestSuite\TestLdapi::_changeUserPassword( $user,  $newPassword)

Change the users password

Result is not actually saved! There is no place yet to fix user passwords.

LdapiHelper\TestSuite\TestLdapi::_saveNewObject( $object,  $additional_fields = null)

Save an object by updating the registered fixtures

LdapiHelper\TestSuite\TestLdapi::_saveUpdatedObject( $object)

Update fixtures with modified object

LdapiHelper\TestSuite\TestLdapi::_getEmailForward( $user)

Returned fixtured email forward

LdapiHelper\TestSuite\TestLdapi::_saveEmailForward( $user,  $email)

Update fixtured email forward

LdapiHelper\TestSuite\TestLdapi::deleteCommittee( $committee)

Remove a fixtured committee

LdapiHelper\TestSuite\TestLdapi::deleteUser( $user)

}

LdapiHelper\TestSuite\TestLdapi::_writeCheck()

Enable write check by default

Public Static Functions

static LdapiHelper\TestSuite\TestLdapi::classes_equal( $a,  $b)

Extension of is_subclass_of()

Checks if $a is a subclass of $b, or equal to $b. Both parameters are meant to be class names, not objects.

param $a

param $b

return

bool

static LdapiHelper\TestSuite\TestLdapi::fields_equal_wildcards( $search,  $subject)

Mimic field evaluation in LDAP, can process the whildcards in a search.

‘*’ is used for any number of characters (including none) and ‘?’ for exactly one character.

param $search

param $subject

Public Static Attributes

static static $_users   = []
static static $_committees   = []
static static $_forwards   = []

TestFixture

LdapiHelper::TestSuite::Fixture::TestFixture

Public Functions

LdapiHelper\TestSuite\Fixture\TestFixture::__construct()

Constructor

LdapiHelper\TestSuite\Fixture\TestFixture::init()

Init

Let user overload to fill in records (and base_record)

LdapiHelper\TestSuite\Fixture\TestFixture::load( $ldapi)

Load this fixture into the LDAP test storage

param $ldapi

Public Members

$records
$base_record
$type   = null
const TYPE_USER   = 'user'

The possible types of fixtures

const TYPE_COMMITTEE   = 'committee'
const TYPE_FORWARD   = 'forward'