Source
<?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__).'/../common/testMultiselectDialogs.php';
/**
* Test for checking empty multiselects' overlays.
*
* @onBefore clearData, prepareEmptyData
*
* @backup profiles
*/
class testMultiselectsWithoutData extends testMultiselectDialogs {
const EMPTY_HOST = 'Empty host for multiselects test';
const EMPTY_LLD_HOST = 'Host with empty LLD';
const EMPTY_TEMPLATE = 'Empty template for multiselects test';
const EMPTY_LLD_TEMPLATE = 'Template with empty LLD';
const SCRIPT = 'Script for Actions';
const TEMPLATES_MULTISELECT = ['Templates' => ['title' => 'Templates', 'empty' => true, 'filter' => ['Template group' => '']]];
const HOSTS_MULTISELECT = ['Hosts' => ['title' => 'Hosts', 'empty' => true, 'filter' => ['Host group' => '']]];
protected static $empty_hostid;
protected static $empty_templateid;
protected static $host_lldid;
protected static $template_lldid;
/**
* Attach TableBehavior to the test.
*
* @return array
*/
public function getBehaviors() {
return [CTableBehavior::class];
}
/**
* Function for finding and deleting data created before with previous tests.
*/
public function clearData() {
$delete_data = [
// Delete Services.
[
'api' => 'service.delete',
'sql' => 'SELECT * FROM services',
'column' => 'serviceid'
],
// Delete Proxies and Proxy groups, connected Hosts, Actions and Discovery rules.
[
'api' => 'drule.delete',
'sql' => 'SELECT * FROM drules',