Source
'error' => 'Discovery rule "Discovery rule for deleting, check used in Action" is used in "Action with discovery check" action.'
<?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/CWebTest.php';
require_once dirname(__FILE__).'/../behaviors/CMessageBehavior.php';
require_once dirname(__FILE__).'/../behaviors/CTableBehavior.php';
/**
* @backup drules
*
* @onBefore prepareDiscoveryErrorData
*
* @dataSource NetworkDiscovery, Proxies
*/
class testPageNetworkDiscovery extends CWebTest {
/**
* Attach MessageBehavior and TableBehavior to the test.
*
* @return array
*/
public function getBehaviors() {
return [
CMessageBehavior::class,
CTableBehavior::class
];
}
/**
* SQL query which selects all values from table drules.
*/
const SQL = 'SELECT * FROM drules';
const CUSTOM_ERROR_RULE = 'Discovery rule for testing error';
const SYMBOLS_ERROR_RULE = 'Discovery rule with error (4-byte symbols)';
const DISABLED_ERROR_RULE = 'Disabled discovery rule for testing error';
const ERROR_MESSAGES = [
self::CUSTOM_ERROR_RULE => 'Test error message for a discovery rule.',
self::SYMBOLS_ERROR_RULE => 'Test error message with symbols: ᵭᵻᵴᶜṌṼẻṜὙ🛑😐🗼🁨☕',
self::DISABLED_ERROR_RULE => 'Error for discovery rule with disabled status'
];
public function prepareDiscoveryErrorData() {
CDataHelper::call('drule.create', [
[
'name' => self::CUSTOM_ERROR_RULE,
'iprange' => '192.168.1.1-255',
'status' => DRULE_STATUS_ACTIVE,
'dchecks' => [