Source
'value' => str_repeat('b', DB::getFieldLength('items', 'query_fields') - strlen('[{"a":""}]') + 1)
<?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 dirname(__FILE__).'/../include/helpers/CDataHelper.php';
/**
* @backup items
* @onBefore prepareUpdateData
*/
class testItem extends CAPITest {
protected static $items;
public static function getItemCreateData() {
$valid_item_types = [
ITEM_TYPE_ZABBIX => '50022',
ITEM_TYPE_TRAPPER => null,
ITEM_TYPE_SIMPLE => '50022',
ITEM_TYPE_INTERNAL => null,
ITEM_TYPE_ZABBIX_ACTIVE => null,
ITEM_TYPE_EXTERNAL => '50022',
ITEM_TYPE_DB_MONITOR => null,
ITEM_TYPE_IPMI => '50031',
ITEM_TYPE_SSH => '50022',
ITEM_TYPE_TELNET => '50022',
ITEM_TYPE_CALCULATED => null,
ITEM_TYPE_JMX => '50030',
ITEM_TYPE_DEPENDENT => null,
ITEM_TYPE_HTTPAGENT => '50022',
ITEM_TYPE_SNMP => '50029',
ITEM_TYPE_SCRIPT => null,
ITEM_TYPE_BROWSER => null
];
$item_type_tests = [];
$binary_valuetype_tests = [];
foreach ($valid_item_types as $type => $interfaceid) {
switch ($type) {
case ITEM_TYPE_ZABBIX:
case ITEM_TYPE_SIMPLE:
case ITEM_TYPE_INTERNAL:
case ITEM_TYPE_ZABBIX_ACTIVE:
case ITEM_TYPE_EXTERNAL:
$params = [
'delay' => '30s'
];
break;
case ITEM_TYPE_DB_MONITOR:
$params = [
'params' => 'SELECT * FROM table',
'delay' => '30s'
];
break;
case ITEM_TYPE_IPMI:
$params = [
'ipmi_sensor' => '1.2.3',
'delay' => '30s'
];
break;
case ITEM_TYPE_SSH:
$params = [
'username' => 'username',
'authtype' => ITEM_AUTHTYPE_PASSWORD,
'params' => 'return true;',
'delay' => '30s'
];
break;
case ITEM_TYPE_TELNET:
$params = [
'username' => 'username',
'params' => 'return true;',
'delay' => '30s'
];