Source
'expression' => self::FUNC_NAME.'(/'.self::HOST_NAME.'/'.$item['key'].','.$trigger['params'].')='.$trigger['expected_result']
<?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/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
],
// Explicit "all" mode
'all' => [
'params' => '#5,"all"',
'expected_result' => 3