Source
$template_name = ($data['vault'] === 'Hashicorp') ? 'Template for creating Vault macros' : 'Empty Template without macros';
<?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__) . '/../common/testFormMacros.php';
/**
* @backup hosts, config
*
* @onBefore prepareTemplateMacrosData
*/
class testFormMacrosTemplate extends testFormMacros {
const TEMPLATES_GROUP = 1;
protected $vault_object = 'template';
protected $hashi_error_field = '/1/macros/4/value';
protected $cyber_error_field = '/1/macros/4/value';
protected $update_vault_macro = '{$VAULT_TEMPLATE_MACRO_CHANGED}';
protected $vault_macro_index = 0;
protected $revert_macro_1 = '{$SECRET_TEMPLATE_MACRO_REVERT}';
protected $revert_macro_2 = '{$SECRET_TEMPLATE_MACRO_2_TEXT_REVERT}';
protected $revert_macro_object = 'template';
protected static $templateid_remove_inherited;
public function prepareTemplateMacrosData() {
$templates = CDataHelper::createTemplates([
[
'host' => 'Template with macros',
'groups' => ['groupid' => self::TEMPLATES_GROUP],
'macros' => [
['macro' => '{$TEMPLATE_MACRO1}', 'value' => ''],
['macro' => '{$TEMPLATE_MACRO2}', 'value' => '']
]
],
[
'host' => 'Template for removing macros',
'groups' => ['groupid' => self::TEMPLATES_GROUP],
'macros' => [
['macro' => '{$MACRO_FOR_REMOVE1}', 'value' => ''],
['macro' => '{$MACRO_FOR_REMOVE2}', 'value' => '']
]
],
[
'host' => 'Template for Inherited macros removing',
'groups' => ['groupid' => self::TEMPLATES_GROUP],
'macros' => [
[
'macro' => '{$TEST_MACRO123}',
'value' => 'test123',
'description' => 'description 123'