mirror of
https://github.com/roundcube/roundcubemail.git
synced 2026-03-04 23:34:01 +01:00
* fix Tests\Browser\TestCase imports * fix remaining imports * fix PHPUnit\Framework\TestCase imports * import GuzzleHttp\Client * fix remaining * "php_unit_method_casing" is not todo * fix "single_line_comment_spacing" * fix 2nd commit done using older fixer
51 lines
1.3 KiB
PHP
51 lines
1.3 KiB
PHP
<?php
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
/**
|
|
* Test class to test rcube_ldap_generic class
|
|
*/
|
|
class Framework_LdapGeneric extends 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);
|
|
}
|
|
}
|