$sql = 'SELECT authentication_type,ldap_auth_enabled,ldap_case_sensitive,ldap_userdirectoryid,http_auth_enabled,http_login_form,'.
require_once dirname(__FILE__).'/../../include/CLegacyWebTest.php';
class testUsersAuthenticationHttp extends CLegacyWebTest {
protected function getFilePath() {
return dirname(__FILE__).'/../../../conf/zabbix.conf.php';
public function getBehaviors() {
return ['class' => CMessageBehavior::class];
public function testUsersAuthenticationHttp_Layout() {
$this->page->login()->open('zabbix.php?action=authentication.edit');
$form = $this->query('id:authentication-form')->asForm()->one();
$form->selectTab('HTTP settings');
'Enable HTTP authentication' => false,
'Default login form' => 'Zabbix login form',
'Remove domain name' => '',
'Case-sensitive login' => true
$form->checkValue($default_values);
$fields = ['Default login form', 'Remove domain name', 'Case-sensitive login'];
foreach ($fields as $field) {
$this->assertTrue($form->getField($field)->isEnabled(false));
$this->assertEquals(['Zabbix login form', 'HTTP login form'], $form->getField('Default login form')
->getOptions()->asText());
$this->assertEquals('2048', $form->getField('Remove domain name')->getAttribute('maxlength'));
$form->getLabel('Enable HTTP authentication')->query('class:zi-help-filled-small')->one()->click();
$hintbox = $form->query('xpath://div[@class="overlay-dialogue wordbreak"]')->waitUntilPresent();
$this->assertEquals('If HTTP authentication is enabled, all users (even with frontend access set to LDAP/Internal)'.
' will be authenticated by the web server, not by Zabbix.', $hintbox->one()->getText());
$hintbox->query('class:btn-overlay-close')->one()->click()->waitUntilNotPresent();
foreach (['button:Cancel', 'class:btn-overlay-close', 'button:Ok'] as $button) {
$form->fill(['Enable HTTP authentication' => true]);
$dialog = COverlayDialogElement::find()->one();
$this->assertEquals('Confirm changes', $dialog->getTitle());
$this->assertEquals('Enable HTTP authentication for all users.', $dialog->getContent()->getText());
$dialog->query($button)->one()->click();
COverlayDialogElement::ensureNotPresent();