Source
xxxxxxxxxx
'source' => '<?xml version="1.0" encoding="UTF-8"?> <zabbix_export> <version>5.4</version> <date>2016-12-12T07:18:00Z</date> <hosts> <host> <host>API xml import host</host> <name>API xml import host</name> <groups> <group> <name>Linux servers</name> </group> </groups> <valuemaps> <valuemap> <name>API valueMap xml import</name> <mappings> <mapping> <value>1</value> <newvalue>Up</newvalue> </mapping> </mappings> </valuemap> </valuemaps> </host> </hosts> </zabbix_export>',
<?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';
/**
* @backup hosts, hstgrp
*/
class testConfiguration extends CAPITest {
public static function export_fail_data() {
return [
// Check format parameter.
[
'export' => [
'options' => [
'hosts' => [
'50009'
]
]
],
'expected_error' => 'Invalid parameter "/": the parameter "format" is missing.'
],
[
'export' => [
'options' => [
'hosts' => [
'50009'
]
],
'format' => ''
],
'expected_error' => 'Invalid parameter "/format": value must be one of "yaml", "xml", "json", "raw".'
],
[
'export' => [
'options' => [
'hosts' => [
'50009'
]
],
'format' => 'æų'
],
'expected_error' => 'Invalid parameter "/format": value must be one of "yaml", "xml", "json", "raw".'
],
// Check unexpected parameter.
[
'export' => [
'options' => [
'host_groups' => [
'50012'
]
],
'format' => 'test',
'hosts' => '50009'
],
'expected_error' => 'Invalid parameter "/": unexpected parameter "hosts".'
],
[
'export' => [
'options' => [
'host_groups' => [
'50009'
],
'group' => [
'50009'
]
],
'format' => 'xml'
],
'expected_error' => 'Invalid parameter "/options": unexpected parameter "group".'
],
// Check missing options parameter.
[
'export' => [
'format' => 'xml'
],
'expected_error' => 'Invalid parameter "/": the parameter "options" is missing.'