Source
DBexecute("INSERT INTO history (itemid, clock, value, ns) VALUES (".zbx_dbstr(self::$data['itemids']['last']).
<?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';
/**
* @onBefore prepareItemsData, prepareMapsData, writeValuesToItems
*
* @onAfter clearData
*/
class testExpandExpressionMacros extends CWebTest {
protected static $data = [
'hostgroupid',
'hostids' => [
'last' => null,
'avg' => null,
'min' => null,
'max' => null
],
'itemids' => [
'last' => null,
'avg' => null,
'min' => null,
'max' => null
],
'mapid'
];
public function prepareItemsData() {
// Create hostgroup for hosts with items and graphs.
$hostgroups = CDataHelper::call('hostgroup.create', [
[
'name' => 'Group for macro expand testing'
]
]);
$this->assertArrayHasKey('groupids', $hostgroups);
self::$data['hostgroupid'] = $hostgroups['groupids'][0];
// Create hosts for items and graphs.
$hosts_data = [];
foreach (['Last', 'Avg', 'Min', 'Max'] as $type) {
$hosts_data[] = [
'host' => 'Host for expression macro '.$type,
'groups' => [
['groupid' => self::$data['hostgroupid']]