Source
], 'Cannot link template "test-template-trigger-dependency-02" without template "test-template-trigger-dependency-01" to template "test-template-trigger-dependency-05" due to dependency of trigger "trigger-02".');
<?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';
/**
* @onBefore prepareTestData
*
* @backup hstgrp
* @backup hosts
*/
class testTemplate extends CAPITest {
private static $data = [
'templateids' => [
'api_vendor_test' => null
]
];
public function prepareTestData() {
$templates_data = [
[
'host' => 'api_vendor_test',
'groups' => ['groupid' => 1],
'vendor_name' => 'Zabbix',
'vendor_version' => '6.4-0'
]
];
$templates = CDataHelper::call('template.create', $templates_data);
$this->assertArrayHasKey('templateids', $templates);
self::$data['templateids']['api_vendor_test'] = $templates['templateids'][0];
}
public function dataProviderCreate() {
return [
[
'request' => [
'host' => 'test-template-01',
'groups' => ['groupid' => 1]
]
],
[
'request' => [
'host' => 'test-template-02',
'groups' => []
],
'expected_error' => 'Invalid parameter "/1/groups": cannot be empty.'
],
[
'request' => [