Source
'expected_error' => 'Invalid parameter "/1/active_till": cannot be less than or equal to the value of parameter "/1/active_since".'
<?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';
/**
* @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
]