Source
xxxxxxxxxx
'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
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
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' => [