Source
'expression' => self::FUNC_NAME.'(/'.self::HOST_NAME.'/'.$item['key'].','.$trigger['params'].')='.$trigger['expected_result']
<?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/CIntegrationTest.php';
/**
* Test suite for changecount() function evaluation.
*
* @required-components server
* @hosts test_host
* @backup history
*/
class testFunctionChangeCount extends CIntegrationTest {
const HOST_NAME = 'test_host';
const WAIT_TIME = 1;
const FUNC_NAME = 'changecount';
private static $hostid;
private static $interfaceid;
private static $items = [
'item_ui64' => [
'key' => 'item_ui64',
'value_type' => ITEM_VALUE_TYPE_UINT64,
'triggers' => [
// All values different, this case is also used to check
// "not enough data" scenario
'all_different' => [
'params' => '#5',
'expected_result' => 4
],
// Some values are equal
'some_equal' => [
'params' => '#5',
'expected_result' => 2
],
// "inc" mode
'inc' => [
'params' => '#5,"inc"',
'expected_result' => 2
],
// "dec" mode
'dec' => [
'params' => '#5,"dec"',
'expected_result' => 2