Source
$this->assertEquals(1, CDBHelper::getCount($sql), "Chuck Norris: host $hostid activated but status is wrong in the DB");
<?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';
require_once dirname(__FILE__).'/behaviors/CTableBehavior.php';
require_once dirname(__FILE__).'/behaviors/CTagBehavior.php';
/**
* @dataSource TagFilter, WebScenarios
*/
class testPageHosts extends CLegacyWebTest {
/**
* Attach MessageBehavior, TableBehavior and TagBehavior to the test.
*/
public function getBehaviors() {
return [
CTableBehavior::class,
CTagBehavior::class
];
}
public $HostName = 'ЗАББИКС Сервер';
public $HostGroup = 'Zabbix servers';
public $HostIp = '127.0.0.1';
public $HostPort = '10050';
public static function allHosts() {
return CDBHelper::getDataProvider(
'SELECT h.name,h.hostid,g.name AS group_name'.
' FROM hosts h'.
' LEFT JOIN hosts_groups hg'.
' ON hg.hostid=h.hostid'.
' LEFT JOIN hstgrp g'.
' ON g.groupid=hg.groupid'.
' WHERE h.status IN ('.HOST_STATUS_MONITORED.','.HOST_STATUS_NOT_MONITORED.')'.
" AND NOT h.flags = 2"
);
}
public function testPageHosts_CheckLayout() {
$this->zbxTestLogin(self::HOST_LIST_PAGE);
$this->zbxTestCheckTitle('Configuration of hosts');
$this->zbxTestCheckHeader('Hosts');
$table = $this->query('class:list-table')->asTable()->one();
$filter = $this->query('name:zbx_filter')->asForm()->one();