Source
xxxxxxxxxx
'expected_error' => 'Invalid parameter "/filter/value/1": a character string, integer or floating point value is expected.'
<?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 history_bin
*/
class testHistory extends CAPITest {
public static function history_get_data() {
$binary_itemid = 58740;
return [
// Test item history of value_type == ITEM_VALUE_TYPE_STR ('history' => 1).
[
'api_request' => [
'output' => 'extend',
'history' => 1,
'itemids' => ['133760']
],
'expected_result' => [
[
'itemid' => '133760',
'clock' => '1549350960',
'value' => '1',
'ns' => '754460948'
],
[
'itemid' => '133760',
'clock' => '1549350962',
'value' => '1',
'ns' => '919404393'
],
[
'itemid' => '133760',
'clock' => '1549350965',
'value' => '1',
'ns' => '512878374'
]
],
'expected_error' => false
],
// Test item history of value_type == ITEM_VALUE_TYPE_LOG ('history' => 2).
[
'api_request' => [
'output' => ['value', 'severity'],
'history' => 2,
'itemids' => ['133761']
],
'expected_result' => [
[
'value' => '1',
'severity' => '0'
],
[
'value' => '2',
'severity' => '0'
],
[
'value' => '3',
'severity' => '0'
],
[
'value' => '4',
'severity' => '0'
],
[
'value' => '5',
'severity' => '0'
]
],
'expected_error' => false
],
// Get last 5 values of item of value_type == ITEM_VALUE_TYPE_FLOAT ('history' => 0).
[
'api_request' => [