This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
lnldap/tests/classes/LDAPorm.php

56 lines
1.3 KiB
PHP
Raw Permalink Normal View History

2013-08-16 02:21:17 +00:00
<?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');
}
}