Source
xxxxxxxxxx
foreach (['Hostgroups page' => 'Host groups', 'Hosts page' => 'Hosts', 'Items page' => 'Item'] as $page => $field) {
<?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/testWidgetCommunication.php';
/**
* @backup profiles
*
* @dataSource WidgetCommunication
*
* @onBefore getCreatedIds
*/
class testDashboardWidgetCommunication extends testWidgetCommunication {
/**
* Attach MessageBehavior and TagBehavior to the test.
*/
public function getBehaviors() {
return [
CMessageBehavior::class,
CTableBehavior::class,
CWidgetBehavior::class
];
}
protected static $current_broadcasters = [
'Hostgroups page' => 'Map hostgroup broadcaster',
'Hosts page' => 'Geomap host broadcaster',
'Items page' => 'Honeycomb item broadcaster',
'Maps page' => 'Navigation tree map broadcaster'
];
const GEOMAP_FILTERED_ICON_INDEX = 1;
const DEFAULT_WIDGET_CONTENT = [
'Hostgroups page' => [
'Data overview listener' => [
[
'Hosts' => self::FIRST_HOST_NAME,
'Trapper item' => '3'
],
[
'Hosts' => self::SECOND_HOST_NAME,
'Trapper item' => '4'
],
[
'Hosts' => self::THIRD_HOST_NAME,
'Trapper item' => '5'
]
],
'Geomap listener' => [
self::GEOMAP_ICON_INDEXES[self::FIRST_HOST_NAME] => [
'Host' => self::FIRST_HOST_NAME,
'I' => '1'
],
self::GEOMAP_ICON_INDEXES[self::SECOND_HOST_NAME] => [
'Host' => self::SECOND_HOST_NAME,
'W' => '1'
],
self::GEOMAP_ICON_INDEXES[self::THIRD_HOST_NAME] => [
'Host' => self::THIRD_HOST_NAME,
'H' => '1'
]
],
'Honeycomb listener' => [
self::FIRST_HOST_NAME => 3,
self::SECOND_HOST_NAME => 4,
self::THIRD_HOST_NAME => 5
],
'Host availability listener' => [], // This widget will get data from DB.
'Problem hosts listener' => [
[
'Host group' => self::FIRST_HOSTGROUP_NAME,
'With problems' => '1',
'Total' => '1'
],
[
'Host group' => self::SECOND_HOSTGROUP_NAME,