Source
xxxxxxxxxx
'macro' => '{$SUSPENDISSE_CONDIMENTUM_VELIT_EU_SAPIENAPELLENTESQUEFPRETIUMTVELHACAAUGUEU_FFUSCE_ET_ANTE_IN_SEM_PHARETRA_PRETIUMMMMAURIS_DAPIBUS_FERMENTUM_URNA_SSCELERISQUE_ACCUMSAN_NULL_GCOMMODO_SIT_AMET_NNULLA_DAPIBUS_ID_PURUS_VITAE_MOLLIS_UPROIN_ET_SAPIEN_ET_TELLUS1}',
<?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 globalmacro
* @backup hostmacro
*/
class testUserMacro extends CAPITest {
public static function hostmacro_create() {
return [
[
'hostmacro' => [
'macro' => '{$ADD_1}',
'value' => 'test',
'type' => '0',
'hostid' => '90020',
'description' => 'text'
],
'expected_error' => null
],
[
'hostmacro' => [
[
'macro' => '{$MACRO}',
'value' => '',
'hostid' => 90020
],
[
'macro' => '{$MACRO}',
'value' => '',
'hostid' => 90020
]
],
'expected_error' => 'Invalid parameter "/2": value (hostid, macro)=(90020, {$MACRO}) already exists.'
],
[
'hostmacro' => [
[
'macro' => '{$MACRO: /var}',
'value' => '',
'hostid' => 90020
],
[
'macro' => '{$MACRO: /var}',
'value' => '',
'hostid' => 90021
],
[
'macro' => '{$MACRO: "/tmp"}',
'value' => '',
'hostid' => 90020
],
[
'macro' => '{$MACRO: "/var"}',
'value' => '',
'hostid' => 90020
]
],
'expected_error' => 'Invalid parameter "/4": value (hostid, macro)=(90020, {$MACRO: "/var"}) already exists.'
],
[
'hostmacro' => [
'macro' => '{$ADD_2}',
'value' => 'test',
'type' => '0',
'hostid' => '90020',
'description' => ''
],
'expected_error' => null,
'expect_db_row' => [
'macro' => '{$ADD_2}',
'value' => 'test',
'type' => '0',
'hostid' => '90020',
'description' => '',