Source
* @param array $filter filter parameters passed in format: ['<filter_label>' => '<filter_value>']
<?php
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
require_once dirname(__FILE__) . '/../../include/CWebTest.php';
class testMultiselectDialogs extends CWebTest {
/**
* Function for opening multiselects in a form and check their contents.
*
* @param CFormElement $form form where checks are performed
* @param array $multiselects multiselect fields to be checked
*/
protected function checkMultiselectDialogs($form, $multiselects) {
foreach ($multiselects as $multiselect) {
$count = count($multiselect);
$multiselect_form = $form;
foreach ($multiselect as $field => $parameters) {
// Open multiselect dialog.
$dialog = $multiselect_form->getField($field)->edit();
$this->checkErrorsAndTitle($dialog, $parameters['title']);
if (array_key_exists('filter', $parameters)) {
$this->checkOverlayFilter($dialog, $parameters['title'], $parameters['filter']);
}
if (CTestArrayHelper::get($parameters, 'empty', false)) {
$this->checkOverlayStud($dialog, $parameters['title']);
}
// Set form element of current overlay dialog if multiple dialogs layers are opened.
if ($count > 1) {
$multiselect_form = $dialog->asForm(['normalized' => true]);
}
}
if ($count > 1) {
COverlayDialogElement::closeAll(true);
}
else {
$dialog->close();
}
}
}
/**
* Function for checking dialog title and error absence in it.
*
* @param COverlayDialogElement $dialog dialog form where checks are performed