Source
if (($db_map['grid_align'] == SYSMAP_GRID_ALIGN_ON && $autoAlign == 0) || ($db_map['grid_align'] == SYSMAP_GRID_ALIGN_OFF && $autoAlign == 1)) {
<?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/CLegacyWebTest.php';
/**
* @backup sysmaps, globalmacro
*
* @onBefore prepareMapForMacrofunctions
*/
class testFormMapConstructor extends CLegacyWebTest {
protected static $macro_map_id;
const MAP_MACRO_FUNCTIONS = 'Map for testing macro functions';
const HOST_MACRO_FUNCTIONS = 'Testing macro functions 12345';
const ITEM_KEY = 'trapmacrofunctions';
const ITEM_NAME = 'Item for testing macro functions with expression macros';
public function prepareMapForMacrofunctions() {
$host = CDataHelper::createHosts([
[
'host' => self::HOST_MACRO_FUNCTIONS,
'groups' => ['groupid' => 4], // Zabbix servers.
'items' => [
[
'name' => self::ITEM_NAME,
'key_' => self::ITEM_KEY,
'type' => ITEM_TYPE_TRAPPER,
'value_type' => ITEM_VALUE_TYPE_FLOAT
]
]
]
]);
$item_id = CDBHelper::getValue('SELECT itemid FROM items WHERE name='.zbx_dbstr(self::ITEM_NAME));
// Add value to item history table, to use expression macros.
CDataHelper::addItemData($item_id, 123.33);
$triggers = CDataHelper::call('trigger.create', [
[
'description' => 'Trigger testing macro functions',
'expression' => 'last(/'.self::HOST_MACRO_FUNCTIONS.'/'.self::ITEM_KEY.')=0',
'priority' => TRIGGER_SEVERITY_AVERAGE
],
[
'description' => 'Trigger for testing incorrectly used macro functions',
'expression' => 'last(/'.self::HOST_MACRO_FUNCTIONS.'/'.self::ITEM_KEY.')=0',
'priority' => TRIGGER_SEVERITY_AVERAGE