Source
'error' => 'Invalid parameter "/selectChildren/1": value must be one of "serviceid", "uuid", "name", "status", "algorithm", "sortorder", "weight", "propagation_rule", "propagation_value", "description", "created_at", "readonly".',
<?php declare(strict_types = 0);
/*
** 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 __DIR__.'/../include/CAPITest.php';
/**
* @backup services
*/
class testServices extends CAPITest {
public static function service_create_data_invalid(): array {
return [
[
'service' => [],
'expected_error' => 'Invalid parameter "/": cannot be empty.'
],
[
'service' => [null],
'expected_error' => 'Invalid parameter "/1": an array is expected.'
],
[
'service' => [true],
'expected_error' => 'Invalid parameter "/1": an array is expected.'
],
[
'service' => [0],
'expected_error' => 'Invalid parameter "/1": an array is expected.'
],
[
'service' => [''],
'expected_error' => 'Invalid parameter "/1": an array is expected.'
],
// Required fields.
[
'service' => [[]],
'expected_error' => 'Invalid parameter "/1": the parameter "name" is missing.'
],
[
'service' => [
'name' => null
],
'expected_error' => 'Invalid parameter "/1/name": a character string is expected.'
],
[
'service' => [
'name' => true
],
'expected_error' => 'Invalid parameter "/1/name": a character string is expected.'
],
[
'service' => [
'name' => 0
],
'expected_error' => 'Invalid parameter "/1/name": a character string is expected.'
],
[
'service' => [
'name' => []
],
'expected_error' => 'Invalid parameter "/1/name": a character string is expected.'
],
[
'service' => [
'name' => ''
],
'expected_error' => 'Invalid parameter "/1/name": cannot be empty.'
],
[
'service' => [
'name' => str_repeat('a', DB::getFieldLength('services', 'name') + 1)
],
'expected_error' => 'Invalid parameter "/1/name": value is too long.'
],
[
'service' => [
'name' => 'foo'
],