Source
xxxxxxxxxx
: 'zabbix.php?action=template.list&').'filter_set=1&filter_groups%5B0%5D='.$group_id, $this->page->getCurrentUrl()
<?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/CWebTest.php';
require_once dirname(__FILE__).'/../behaviors/CMessageBehavior.php';
require_once dirname(__FILE__).'/../behaviors/CTableBehavior.php';
/**
* Base class for Host and Template groups page.
*/
class testPageGroups extends CWebTest {
/**
* Attach MessageBehavior and TableBehavior to the test.
*
* @return array
*/
public function getBehaviors() {
return [
CMessageBehavior::class,
CTableBehavior::class
];
}
/**
* Objects created in dataSource DiscoveredHosts.
*/
const DISCOVERED_GROUP = 'Group created from host prototype 1';
const DISCOVERED_GROUP2 = 'Group created from host prototype 11';
const HOST_PROTOTYPE = 'Host created from host prototype {#KEY}';
const LLD = 'LLD for Discovered host tests';
/**
* Objects created in dataSource HostTemplateGroups.
*/
const DELETE_ONE_GROUP = 'One group belongs to one object for Delete test';
const DELETE_EMPTY_GROUP = 'Group empty for Delete test';
const DELETE_GROUP2 = 'First group to one object for Delete test';
/**
* The group was created in host/template page test for multiple group deletion.
*/
const DELETE_GROUP3 = 'Group 3 for Delete test';
/**
* SQL query to get groups to compare hash values.
*/
const GROUPS_SQL = 'SELECT * FROM hstgrp g INNER JOIN hosts_groups hg ON g.groupid=hg.groupid'.
' ORDER BY g.groupid, hg.hostgroupid';
/**
* SQL query to get hosts to compare hash values.
*/
const HOSTS_SQL = 'SELECT * FROM hosts ORDER BY hostid';
/**
* Link to page for opening groups page.
*/
protected $link;
/**
* Host or template group.
*/
protected $object;
/**
* Test for checking group page layout.
*
* @param array $data data provider
* @param array $links related links of group to be checked
*/
public function checkLayout($data, $links) {
$this->page->login()->open($this->link)->waitUntilReady();
$this->page->assertHeader(ucfirst($this->object).' groups');
$this->page->assertTitle('Configuration of '.$this->object.' groups');
// Check filter.
$filter = CFilterElement::find()->one();