Source
'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
/*
** Zabbix
** Copyright (C) 2001-2022 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';
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' => [