Source
'expected_error' => 'Trigger "test-trigger-1" cannot depend on the trigger "test-trigger-2", because a circular linkage ("test-trigger-2" -> "test-trigger-1" -> "test-trigger-2") would occur.'
<?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';
/**
* @backup triggers
*/
class testTriggerValidation extends CAPITest {
const TEMPLATE_TRIGGERID = 50178;
const UPDATE_TRIGGER_1 = 50176;
const UPDATE_TRIGGER_2 = 50177;
public static function triggers_to_update_data() {
return [
// Successful cases.
'disable trigger' => [
'triggers' => [
[
'status' => 1,
'triggerid' => self::UPDATE_TRIGGER_1
]
],
'expected_error' => null
],
'add dependent trigger' => [
'triggers' => [
[
'triggerid' => self::UPDATE_TRIGGER_1,
'dependencies' => [
[
'triggerid' => self::UPDATE_TRIGGER_2
]
]
]
],
'expected_error' => null
],
'delete dependent trigger' => [
'triggers' => [
[
'triggerid' => self::UPDATE_TRIGGER_1,
'dependencies' => []
]
],
'expected_error' => null
],
'change recovery mode to "none"' => [
'triggers' => [