Files
roundcubemail/tests/Framework/LdapGeneric.php
Michael Voříšek 6a53a1d853 Fix CS (whitespace, visibility) (#9297)
* Fix "method_argument_space"

* Fix "control_structure_continuation_position"

* Fix "new_with_parentheses"

* Fix "blank_line_before_statement"

* Fix "visibility_required"

* Fix some "array_indentation"

* Fix some "array_indentation" - unify all "rcube::raise_error" calls

* rm useless eslint ignores and add rules counts

* sort eslint ignores

* fix eslint ignores grammar

* Revert "Fix "blank_line_before_statement""

* fix CS 3.46.0
2024-01-04 14:26:35 +01:00

49 lines
1.3 KiB
PHP

<?php
/**
* Test class to test rcube_ldap_generic class
*/
class Framework_LdapGeneric extends PHPUnit\Framework\TestCase
{
protected function markTestSkippedIfNetLdapPackageIsNotInstalled(): void
{
if (!class_exists(Net_LDAP3::class)) {
$this->markTestSkipped('The Net_LDAP3 package not available.');
}
}
/**
* Class constructor
*/
public function test_class()
{
$this->markTestSkippedIfNetLdapPackageIsNotInstalled();
$object = new rcube_ldap_generic([]);
$this->assertInstanceOf('rcube_ldap_generic', $object, 'Class constructor');
}
/**
* Test fulltext_search_filter() method
*/
public function test_fulltext_search_filter()
{
$this->markTestSkippedIfNetLdapPackageIsNotInstalled();
$object = new rcube_ldap_generic([]);
$result = $object->fulltext_search_filter('test', ['dn']);
$this->assertSame('(|(dn=test))', $result);
$result = $object->fulltext_search_filter('test', ['dn', 'mail'], 2);
$this->assertSame('(|(dn=test*)(mail=test*))', $result);
$result = $object->fulltext_search_filter('test1 test2', ['dn', 'mail'], 0);
$this->assertSame('(&(|(dn=*test1*)(mail=*test1*))(|(dn=*test2*)(mail=*test2*)))', $result);
}
}