コード例 #1
0
ファイル: ldap_members.php プロジェクト: Samara94/dolibarr
/*
 * Test de la connexion
 */
if (!empty($conf->global->LDAP_MEMBER_ACTIVE)) {
    $butlabel = $langs->trans("LDAPTestSynchroMember");
    $testlabel = 'testmember';
    $key = $conf->global->LDAP_KEY_MEMBERS;
    $dn = $conf->global->LDAP_MEMBER_DN;
    $objectclass = $conf->global->LDAP_MEMBER_OBJECT_CLASS;
    show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass);
}
if (function_exists("ldap_connect")) {
    if ($_GET["action"] == 'testmember') {
        // Creation objet
        $object = new Adherent($db);
        $object->initAsSpecimen();
        // Test synchro
        $ldap = new Ldap();
        $result = $ldap->connect_bind();
        if ($result > 0) {
            $info = $object->_load_ldap_info();
            $dn = $object->_load_ldap_dn($info);
            $result1 = $ldap->delete($dn);
            // To be sure to delete existing records
            $result2 = $ldap->add($dn, $info, $user);
            // Now the test
            $result3 = $ldap->delete($dn);
            // Clean what we did
            if ($result2 > 0) {
                print img_picto('', 'info') . ' ';
                print '<font class="ok">' . $langs->trans("LDAPSynchroOK") . '</font><br>';
コード例 #2
0
ファイル: AdherentTest.php プロジェクト: remyyounes/dolibarr
    /**
     */
    public function testAdherentCreate()
    {
    	global $conf,$user,$langs,$db;
		$conf=$this->savconf;
		$user=$this->savuser;
		$langs=$this->savlangs;
		$db=$this->savdb;

		$localobject=new Adherent($this->savdb);
    	$localobject->initAsSpecimen();
     	$result=$localobject->create($user);
        print __METHOD__." result=".$result."\n";
    	$this->assertLessThan($result, 0);

    	return $result;
    }