Source
'{$SIMPLE_INTERVAL};{$FLEXIBLE_INTERVAL_DELAY}/{$FLEXIBLE_INTERVAL_PERIOD};{$SCHEDULING_INTERVAL}', 0,
<?php
/*
** Zabbix
** 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 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.
**/
use PHPUnit\Framework\TestCase;
class CUpdateIntervalParserTest extends TestCase {
/**
* An array of update intervals and parsed results.
*/
public static function dataProvider() {
return [
// success
[
'333h', 0, [],
[
'rc' => CParser::PARSE_SUCCESS,
'match' => '333h',
'delay' => '333h',
'intervals' => []
]
],
[
'0;5m/1-5,09:00-18:00;wd6-7h9', 0, [],
[
'rc' => CParser::PARSE_SUCCESS,
'match' => '0;5m/1-5,09:00-18:00;wd6-7h9',
'delay' => '0',
'intervals' => [
[
'type' => ITEM_DELAY_FLEXIBLE,
'interval' => '5m/1-5,09:00-18:00',
'update_interval' => '5m',
'time_period' => '1-5,09:00-18:00'
],
['type' => ITEM_DELAY_SCHEDULING, 'interval' => 'wd6-7h9']
]
]
],
[
'{$SIMPLE_INTERVAL1}', 0, ['usermacros' => true],
[
'rc' => CParser::PARSE_SUCCESS,
'match' => '{$SIMPLE_INTERVAL1}',
'delay' => '{$SIMPLE_INTERVAL1}',