Source
public function testUrlParameters_UrlLoad($title, $check_server_name, $server_name_on_page, $test_cases) {
<?php
/*
** Zabbix
** 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 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/CLegacyWebTest.php';
class testUrlParameters extends CLegacyWebTest {
public static function data() {
return [
[
'title' => 'Configuration of host groups',
'check_server_name' => true,
'server_name_on_page' => true,
'test_cases' => [
[
'url' => 'hostgroups.php?form=update&groupid=1',
'text_present' => 'Host groups'
],
[
'url' => 'hostgroups.php?form=update&groupid=9999999',
'text_not_present' => 'Host groups',
'text_present' => [
'No permissions to referred object or it does not exist!'
]
],
[
'url' => 'hostgroups.php?form=update&groupid=abc',
'text_not_present' => 'Host groups',
'text_present' => [
'Zabbix has received an incorrect request.',
'Field "groupid" is not integer.'
]
],
[
'url' => 'hostgroups.php?form=update&groupid=',
'text_not_present' => 'Host groups',
'text_present' => [
'Zabbix has received an incorrect request.',
'Field "groupid" is not integer.'
]
],
[
'url' => 'hostgroups.php?form=update&groupid=-1',
'text_not_present' => 'Host groups',
'text_present' => [
'Zabbix has received an incorrect request.',
'Incorrect value "-1" for "groupid" field.'
]
],
[
'url' => 'hostgroups.php?form=update&groupid[]=1',
'text_not_present' => 'Host groups',
'text_present' => [
'Zabbix has received an incorrect request.',
'Field "groupid" is not correct: invalid data type.'
]
],
[
'url' => 'hostgroups.php?form[]=update&groupid=1',
'text_not_present' => 'Host groups',
'text_present' => [
'Zabbix has received an incorrect request.',
'Field "form" is not correct: invalid data type.'
]
],
[
'url' => 'hostgroups.php?form=update',
'text_not_present' => 'Host groups',
'text_present' => [
'Zabbix has received an incorrect request.',
'Field "groupid" is mandatory.'
]
]