Source
'expected_error' => 'Invalid parameter "/1/active_till": cannot be less than or equal to the value of parameter "/1/active_since".'
<?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 maintenances
*/
class testMaintenance extends CAPITest {
public static function getMaintenanceCreateData() {
$n = 0;
$def_options = [
'active_since' => '1514757600',
'active_till' => '1546207200',
'groups' => [['groupid' => '2']],
'timeperiods' => [
[
'timeperiod_type' => 3,
'every' => 1,
'dayofweek' => 64,
'start_time' => 3600,
'period' => 7200
]
]
];
return [
// Success. Created maintenance without tags.
[
'request_data' => [
'name' => 'M'.++$n
] + $def_options,
'expected_error' => null
],
// Success. Created maintenance without tags.
[
'request_data' => [
'name' => 'M'.++$n,
'tags' => []
] + $def_options,
'expected_error' => null
],
// Success. Created maintenance with one tag.
[
'request_data' => [
'name' => 'M'.++$n,
'tags' => [
'tag' => 'tag'
]
] + $def_options,
'expected_error' => null
],
// Success. Created maintenance with one tag.
[
'request_data' => [
'name' => 'M'.++$n,
'tags' => [
[
'tag' => 'tag'
]
]
] + $def_options,
'expected_error' => null
],
// Success. Created maintenance with one tag.
[
'request_data' => [
'name' => 'M'.++$n,
'tags' => [
[
'tag' => 'tag',
'operator' => 0
]
]
] + $def_options,
'expected_error' => null
],
// Success. Created maintenance with one tag with empty value.