Source
'expected_error' => static fn (): string => 'Invalid parameter "/2": value ('.CTestDataHelper::getConvertedValueReference(':action:del.trigger.action.1').') already exists.'
<?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/CAPITest.php';
require_once __DIR__.'/../include/helpers/CTestDataHelper.php';
/**
* @onBefore prepareTestData
* @onAfter cleanTestData
*/
class testAction extends CAPITest {
public static function prepareTestData(): void {
CTestDataHelper::createObjects([
'template_groups' => [
['name' => 'perm.tg1'],
['name' => 'perm.tg2'],
['name' => 'perm.tg3']
],
'host_groups' => [
['name' => 'del.hg1'],
['name' => 'perm.filter.condition.hg1'],
['name' => 'perm.hg1'],
['name' => 'perm.hg2'],
['name' => 'perm.hg3'],
['name' => 'perm.hg4'],
['name' => 'perm.hg5'],
['name' => 'perm.opcommand_grp.hg1'],
['name' => 'perm.hg6'],
['name' => 'perm.opgroup.hg1'],
['name' => 'perm.opgroup.hg2']
],
'proxies' => [
[
'name' => 'del.p1',
'operating_mode' => PROXY_OPERATING_MODE_ACTIVE
]
],
'templates' => [
[
'host' => 'perm.filter.condition.t1',
'groups' => ['groupid' => ':template_group:perm.tg1']
],
[
'host' => 'perm.optemplate.t1',
'groups' => ['groupid' => ':template_group:perm.tg2']
],
[
'host' => 'perm.optemplate.t2',
'groups' => ['groupid' => ':template_group:perm.tg3']
]
],
'hosts' => [
[
'host' => 'perm.filter.condition.h1',
'groups' => ['groupid' => ':host_group:perm.hg1']
],
[
'host' => 'perm.h1',
'groups' => ['groupid' => ':host_group:perm.hg2'],
'items' => [
['key_' => 'i1']
]
],
[
'host' => 'perm.opcommand_hst.h1',
'groups' => ['groupid' => ':host_group:perm.hg6']
]
],
'triggers' => [
'perm.filter.condition.tg1(perm.h1(i1))' => [
'description' => 'perm.filter.condition.tg1(perm.h1(i1))',
'expression' => 'last(/perm.h1/i1)=0'
]
],
'roles' => [
['name' => 'r1', 'type' => USER_TYPE_ZABBIX_ADMIN]
],