Source
<?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/CPreprocessingBehavior.php';
/**
* Base class for "Test item" function tests.
*/
class testItemTest extends CWebTest {
/**
* Attach PreprocessingBehavior and MessageBehavior to the test.
*
* @return array
*/
public function getBehaviors() {
return [
CMessageBehavior::class,
CPreprocessingBehavior::class
];
}
const HOST_ID = 99136; // 'Test item host' monitored by 'Active proxy 1'.
const TEMPLATE_ID = 99137; // 'Test Item Template'
/**
* Test item button state data for item, item prototype and LLD.
*/
public function getCommonTestButtonStateData() {
return [
['Type' => 'Zabbix agent'],
['Type' => 'Zabbix agent (active)'],
['Type' => 'Simple check'],
['Type' => 'SNMP agent','SNMP OID' => '[IF-MIB::]ifInOctets.1'],
['Type' => 'Zabbix internal'],
['Type' => 'Zabbix trapper'],
['Type' => 'External check'],
['Type' => 'Database monitor', 'SQL query' => 'query'],
['Type' => 'HTTP agent', 'URL' => 'https://www.zabbix.com'],
['Type' => 'IPMI agent', 'IPMI sensor' => 'Sensor'],
['Type' => 'SSH agent', 'Key' => 'ssh.run[Description,127.0.0.1,50,[{#KEY}]]', 'User name' => 'Name', 'Executed script' => 'Script'],
['Type' => 'TELNET agent', 'Key' => 'telnet[{#KEY}]'],
['Type' => 'JMX agent', 'Key' => 'jmx[{#KEY}]', 'JMX endpoint' => 'service:jmx:rmi:///jndi/rmi://{HOST.CONN}:{HOST.PORT}/jmxrmi', 'User name' => ''],
['Type' => 'Dependent item', 'Key' => 'dependent[{#KEY}]', 'Master item' => 'Master item'],
['Type' => 'Script', 'Script' => 'return 1;'],
['Type' => 'Browser']
];
}