Source
'name' => 'Phasellus imperdiet sapien sed justo elementum, quis maximus ipsum iaculis! Proin egestas, felis non efficitur molestie, nulla risus facilisis nisi, sed consectetur lorem mauris non arcu. Aliquam hendrerit massa vel metus maximus consequat. Sed condimen256'
<?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
*/
class testTemplateGroup extends CAPITest {
public static function templategroup_create() {
return [
[
'templategroup' => [
'name' => 'non existent parameter',
'flags' => '4'
],
'expected_error' => 'Invalid parameter "/1": unexpected parameter "flags".'
],
// Check templategroup name.
[
'templategroup' => [
'name' => ''
],
'expected_error' => 'Invalid parameter "/1/name": cannot be empty.'
],
[
'templategroup' => [
'name' => 'Phasellus imperdiet sapien sed justo elementum, quis maximus ipsum iaculis! Proin egestas, felis non efficitur molestie, nulla risus facilisis nisi, sed consectetur lorem mauris non arcu. Aliquam hendrerit massa vel metus maximus consequat. Sed condimen256'
],
'expected_error' => 'Invalid parameter "/1/name": value is too long.'
],
// Check for duplicated template groups names.
[
'templategroup' => [
'name' => 'API template group 1'
],
'expected_error' => 'Template group "API template group 1" already exists.'
],
[
'templategroup' => [
[
'name' => 'One template group with existing name'
],
[
'name' => 'API template group 1'
]
],
'expected_error' => 'Template group "API template group 1" already exists.'
],
[
'templategroup' => [
[
'name' => 'Template groups with two identical names'
],
[
'name' => 'Template groups with two identical names'
]
],
'expected_error' => 'Invalid parameter "/2": value (name)=(Template groups with two identical names) already exists.'
],
// Check successfully create.
[
'templategroup' => [
[
'name' => 'API template group create'
]
],
'expected_error' => null
],
[
'templategroup' => [
[
'name' => '☺'
],
[
'name' => 'æų'