1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
<?php
namespace Roundcube\Tests\Framework;
use PHPUnit\Framework\TestCase;
use Roundcube\Tests\StderrMock;
/**
* Test class to test rcube_ldap class
*/
class Framework_Ldap extends TestCase
{
/**
* Class constructor
*/
function test_class()
{
// skip test if Net_LDAP3 does not exist
if (!class_exists('Net_LDAP3')) {
$this->markTestSkipped('The Net_LDAP3 package not available.');
}
// skip test if php-ldap is not available
if (!extension_loaded('ldap')) {
$this->markTestSkipped('The ldap extension is not available.');
}
StderrMock::start();
$object = new \rcube_ldap([]);
StderrMock::stop();
$this->assertInstanceOf(\rcube_ldap::class, $object, "Class constructor");
$this->assertSame('ERROR: Could not connect to any LDAP server', trim(StderrMock::$output));
}
}
|