Source
xxxxxxxxxx
$this->page->login()->open('zabbix.php?&action=problem.view&filter_set=1&show_suppressed=1&hostids%5B%5D='.self::$hostid)->waitUntilReady();
<?php
/*
** Copyright (C) 2001-2024 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__).'/../../include/helpers/CDataHelper.php';
/**
* @backup hosts
*
* @onBefore prepareProblemsData
*/
class testFormUpdateProblem extends CWebTest {
/**
* Id of the host with problems.
*
* @var integer
*/
protected static $hostid;
/**
* Time when acknowledge was created.
*
* @var string
*/
protected static $acktime;
/**
* Eventid for problem suppression.
*
* @var integer
*/
protected static $eventid_for_icon_test;
/**
* Attach MessageBehavior to the test.
*
* @return array
*/
public function getBehaviors() {
return [CMessageBehavior::class];
}
/**
* Get all events related tables hash values.
*/
public static function getHash() {
return CDBHelper::getHash('SELECT * FROM events').
CDBHelper::getHash('SELECT * FROM problem').
CDBHelper::getHash('SELECT * FROM triggers').
CDBHelper::getHash('SELECT * FROM acknowledges').
CDBHelper::getHash('SELECT * FROM event_suppress');
}
public function prepareProblemsData() {
// Create hostgroup for hosts with items triggers.
$hostgroups = CDataHelper::call('hostgroup.create', [['name' => 'Group for Problems Update']]);
$this->assertArrayHasKey('groupids', $hostgroups);
$groupid = $hostgroups['groupids'][0];
// Create host for items and triggers.
$hosts = CDataHelper::call('host.create', [
'host' => 'Host for Problems Update',
'groups' => [['groupid' => $groupid]]
]);
$this->assertArrayHasKey('hostids', $hosts);
self::$hostid = $hosts['hostids'][0];
// Create items on previously created host.
$item_names = ['float', 'char', 'log', 'unsigned', 'text'];
$items_data = [];
foreach ($item_names as $i => $item) {
$items_data[] = [
'hostid' => self::$hostid,
'name' => $item,
'key_' => $item,
'type' => 2,