Source
CDBHelper::setTriggerProblem(['Trigger Riga', 'Trigger Tallin', 'Trigger Vilnius', 'Trigger Oslo', 'Trigger Bergen'],
<?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';
require_once dirname(__FILE__).'/../../include/helpers/CDataHelper.php';
/**
* @backup config, widget, hosts
*
* @onBefore prepareZoomData
*
* This annotation is needed because some tile providers produce errors like:
* https://stamen-tiles-b.a.ssl.fastly.net/terrain/18/148702/80340.png -
* Failed to load resource: the server responded with a status of 404 (Not Found)
* @ignoreBrowserErrors
*/
class testDashboardGeomapWidgetScreenshots extends CWebTest {
// Dashboard for zoom screenshot tests.
protected static $zoom_dashboardid;
// Host data for zoom screenshot tests.
protected static $cities = [
'hostgroupid',
'hostids' => [
'Riga' => null,
'Tallin' => null,
'Vilnius' => null,
'Oslo' => null,
'Bergen' => null
]
];
public function prepareZoomData() {
// Create hostgroup for hosts with items triggers.
$hostgroups = CDataHelper::call('hostgroup.create', [['name' => 'Baltics']]);
$this->assertArrayHasKey('groupids', $hostgroups);
self::$cities['hostgroupid'] = $hostgroups['groupids'][0];
// Create hosts for items and triggers.
$cities_location = [
['name' => 'Riga', 'latitude' => '56.9546328976717', 'longitude' => '24.1207979437706'],
['name' => 'Tallin', 'latitude' => '59.4349125678522', 'longitude' => '24.7568789765827'],
['name' => 'Vilnius', 'latitude' => '54.6879298114432', 'longitude' => '25.2793571402776'],
['name' => 'Oslo', 'latitude' => '59.9161327671058', 'longitude' => '10.7554327978315'],
['name' => 'Bergen', 'latitude' => '60.3995117455505', 'longitude' => '5.20166836521941']
];
$hosts_data = [];
foreach ($cities_location as $city) {