Source
CDBHelper::setTriggerProblem(['Trigger Riga', 'Trigger Tallin', 'Trigger Vilnius', 'Trigger Oslo', 'Trigger Bergen'],
<?php
/*
** Zabbix
** 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 General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
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 testGeomapWidgetScreenshots 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'],