Source
['{$MACRƒabcdefghijklimnopqrstuv123123456456789789000aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooo111}', 0, [
<?php declare(strict_types = 0);
/*
** 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/>.
**/
use PHPUnit\Framework\TestCase;
class CUserMacroParserTest extends TestCase {
/**
* An array of user macros and parsed results.
*/
public function dataProvider() {
return [
// Normal macros without context.
['{$MACRO}', 0, [
'rc' => CParser::PARSE_SUCCESS,
'match' => '{$MACRO}',
'macro' => 'MACRO',
'context' => null,
'regex' => null,
'minified_macro' => '{$MACRO}',
'error' => ''
]],
['{$MACRO_}', 0, [
'rc' => CParser::PARSE_SUCCESS,
'match' => '{$MACRO_}',
'macro' => 'MACRO_',
'context' => null,
'regex' => null,
'minified_macro' => '{$MACRO_}',
'error' => ''
]],
['{$MACRO_12}', 0, [
'rc' => CParser::PARSE_SUCCESS,
'match' => '{$MACRO_12}',
'macro' => 'MACRO_12',
'context' => null,
'regex' => null,
'minified_macro' => '{$MACRO_12}',
'error' => ''
]],
['{$MACRO_1.2}', 0, [
'rc' => CParser::PARSE_SUCCESS,
'match' => '{$MACRO_1.2}',
'macro' => 'MACRO_1.2',
'context' => null,
'regex' => null,
'minified_macro' => '{$MACRO_1.2}',
'error' => ''
]],
// Context based unquoted macros.