Source
'expected_error' => 'Invalid parameter "/1/overrides/1/operations/1/operator": value must be one of '.implode(', ', [CONDITION_OPERATOR_EQUAL, CONDITION_OPERATOR_NOT_EQUAL, CONDITION_OPERATOR_LIKE, CONDITION_OPERATOR_NOT_LIKE, CONDITION_OPERATOR_REGEXP, CONDITION_OPERATOR_NOT_REGEXP]).'.'
<?php
/*
** Zabbix
** Copyright (C) 2001-2022 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/CAPITest.php';
require_once dirname(__FILE__).'/../../include/classes/parsers/CConditionFormula.php';
require_once dirname(__FILE__).'/../../include/classes/helpers/CConditionHelper.php';
/**
* @backup items
*/
class testDiscoveryRule extends CAPITest {
public static function discoveryrule_create_data_invalid() {
return [
'Test invalid permissions to host' => [
'discoveryrule' => [
'name' => 'API LLD rule invalid permissions',
'key_' => 'apilldruleinvalidpermissions',
'hostid' => '1',
'type' => ITEM_TYPE_ZABBIX,
'interfaceid' => '50022',
'delay' => '30s'
],
'expected_error' => 'No permissions to referred object or it does not exist!'
],
'Test invalid interface ID' => [
'discoveryrule' => [
'name' => 'API LLD rule invalid interface',
'key_' => 'apilldruleinvalidinterface',
'hostid' => '50009',
'type' => ITEM_TYPE_ZABBIX,
'interfaceid' => '1',
'delay' => '30s'
],
'expected_error' => 'Item uses host interface from non-parent host.'
],
'Test if LLD rule name and key already exists' => [
'discoveryrule' => [
'name' => 'API LLD rule 4',
'key_' => 'apilldrule4',
'hostid' => '50009',
'type' => ITEM_TYPE_ZABBIX,
'interfaceid' => '50022',
'delay' => '30s'
],
'expected_error' => 'Item with key "apilldrule4" already exists on "API Host".'
],
'Test without update interval for mqtt.get key of Agent type' => [
'discoveryrule' => [
'name' => 'API mqtt.get',
'key_' => 'mqtt.get[test]',
'hostid' => '50009',
'type' => ITEM_TYPE_ZABBIX,
'interfaceid' => '50022'
],
'expected_error' => 'Incorrect arguments passed to function.'
],
'Test 0 update interval for mqtt.get key of Agent type' => [
'discoveryrule' => [
'name' => 'API mqtt.get',
'key_' => 'mqtt.get[test]',
'hostid' => '50009',
'type' => ITEM_TYPE_ZABBIX,
'interfaceid' => '50022',
'delay' => '0'
],
'expected_error' => 'Item will not be refreshed. Specified update interval requires having at least one either flexible or scheduling interval.'
],
'Test 0 update interval for wrong mqtt key of Active agent type' => [
'discoveryrule' => [
'name' => 'API mqtt.get',
'key_' => 'mqt.get[test]',
'hostid' => '50009',
'type' => ITEM_TYPE_ZABBIX_ACTIVE,