['name' => '!@#$%^&*()_+-=[]{};:"|,./<>?Ž©µÆ', 'description' => '!@#$%^&*()_+-=[]{};:"|,./<>?Ž©µÆ', 'provision_status' => 1]
require_once dirname(__FILE__).'/../behaviors/CMessageBehavior.php';
require_once dirname(__FILE__).'/../behaviors/CTableBehavior.php';
require_once dirname(__FILE__).'/../../include/helpers/CDataHelper.php';
require_once dirname(__FILE__).'/../common/testFormAuthentication.php';
class testUsersAuthenticationLdap extends testFormAuthentication {
public function getBehaviors() {
public function testUsersAuthenticationLdap_Layout() {
$ldap_form = $this->openFormAndCheckBasics('LDAP');
'Enable LDAP authentication' => false,
'Enable JIT provisioning' => false,
'Case-sensitive login' => true,
'Provisioning period' => '1h'
foreach ([false, true] as $status) {
$ldap_form->fill(['Enable LDAP authentication' => $status]);
foreach (['Enable JIT provisioning', 'Servers', 'Case-sensitive login'] as $label) {
$this->assertTrue($ldap_form->getField($label)->isEnabled($status));
$this->assertEquals(['Servers'], $ldap_form->getRequiredLabels());
'headers' => ['Name', 'Host', 'User groups', 'Default', 'Action']
$this->checkTablesHeaders($server_table, $ldap_form);
foreach ([false, true] as $jit_status) {
$ldap_form->fill(['Enable JIT provisioning' => $jit_status]);
$this->assertTrue($ldap_form->getField('Provisioning period')->isEnabled($jit_status));
$ldap_form->getFieldContainer('Servers')->query('button:Add')->waitUntilClickable()->one()->click();
$server_dialog = COverlayDialogElement::find()->waitUntilReady()->one();
$this->assertEquals('New LDAP server', $server_dialog->getTitle());
$server_form = $server_dialog->asForm();
'Name' => ['visible' => true, 'maxlength' => 128, 'value' => ''],
'Host' => ['visible' => true, 'maxlength' => 255, 'value' => ''],
'Port' => ['visible' => true, 'maxlength' => 5, 'value' => 389],
'Base DN' => ['visible' => true, 'maxlength' => 255, 'value' => ''],
'Search attribute' => ['visible' => true, 'maxlength' => 128, 'value' => ''],
'Bind DN' => ['visible' => true, 'maxlength' => 255, 'value' => ''],