56 lines
1.3 KiB
PHP
56 lines
1.3 KiB
PHP
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||
|
|
||
|
/**
|
||
|
* This should test all our ORM methods
|
||
|
*
|
||
|
* @package Kohana/LDAP
|
||
|
* @category Test
|
||
|
* @author Deon George
|
||
|
* @copyright (c) 2013 phpLDAPadmin Development Team
|
||
|
* @license http://dev.phpldapadmin.org/license.html
|
||
|
* @group ldap
|
||
|
* @group ldap.server
|
||
|
*/
|
||
|
Class LDAPorm extends Unittest_TestCase {
|
||
|
function hosts() {
|
||
|
return array(
|
||
|
array('localhost','389','a',TRUE),
|
||
|
array('localhost','389','b',TRUE),
|
||
|
array('localhost','390','a',FALSE),
|
||
|
array('localhost','390','b',FALSE),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Test that we can connect to an LDAP server
|
||
|
*/
|
||
|
function testorm() {
|
||
|
$x = ORM::factory('LDAP',NULL);
|
||
|
|
||
|
$this->assertInstanceOf('ORM',$x);
|
||
|
}
|
||
|
|
||
|
function testormloaddn() {
|
||
|
// @todo It would be nice if we auto connect as required.
|
||
|
$y = LDAP::factory('auth');
|
||
|
$y->connect();
|
||
|
$y = LDAP::factory('user');
|
||
|
$y->connect();
|
||
|
|
||
|
$x = ORM::factory('LDAP','cn=Bart Simpson,ou=People,o=Simpsons');
|
||
|
|
||
|
$this->assertInstanceOf('ORM',$x);
|
||
|
}
|
||
|
|
||
|
function testormdnval() {
|
||
|
// @todo It would be nice if we auto connect as required.
|
||
|
$y = LDAP::factory('auth');
|
||
|
$y->connect();
|
||
|
$y = LDAP::factory('user');
|
||
|
$y->connect();
|
||
|
|
||
|
$x = ORM::factory('LDAP','cn=Bart Simpson,ou=People,o=Simpsons');
|
||
|
$this->assertEquals($x->cn['0'],'Bart Simpson');
|
||
|
}
|
||
|
}
|