Source
' {{#M}.regsub("^([0-9]+)", "{#M}: \1")} - {$M} ', 0, ['usermacros' => true, 'lldmacros' => true],
<?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 CRangeParserTest extends TestCase {
/**
* An array of time periods and parsed results.
*/
public static function dataProvider() {
$negative = ['with_minus' => true];
$float = ['with_float' => true];
$suffix= ['with_suffix' => true];
return [
// success
[
'0', 0, [],
[
'rc' => CParser::PARSE_SUCCESS,
'match' => '0',
'range' => ['0']
]
],
[
'100', 0, [],
[
'rc' => CParser::PARSE_SUCCESS,
'match' => '100',
'range' => ['100']
]
],
[
'123456789', 0, [],
[
'rc' => CParser::PARSE_SUCCESS,
'match' => '123456789',
'range' => ['123456789']
]
],
[
'200-300', 0, [],
[
'rc' => CParser::PARSE_SUCCESS,