<?php
require_once dirname(__FILE__).'/../include/CWebTest.php';
class testPagesWithoutData extends CWebTest {
const EMPTY_HOST = 'Empty host for multiselects test';
const EMPTY_LLD_HOST = 'Host with empty LLD';
const EMPTY_TEMPLATE = 'Empty template for multiselects test';
const EMPTY_LLD_TEMPLATE = 'Template with empty LLD';
protected static $empty_hostid;
protected static $empty_templateid;
protected static $host_lldid;
protected static $template_lldid;
public function getBehaviors() {
return [CTableBehavior::class];
}
public function clearData() {
$slaids = CDBHelper::getColumn('SELECT * FROM sla', 'slaid');
if ($slaids !== []) {
CDataHelper::call('sla.delete', array_values($slaids));
}
}
public function prepareEmptyData() {
$hostgroups = CDataHelper::call('hostgroup.create', [['name' => 'Group for empty pages']]);
$host_groupid = $hostgroups['groupids'][0];
$hosts = CDataHelper::createHosts([
[
'host' => self::EMPTY_LLD_HOST,
'groups' => [['groupid' => $host_groupid]],
'discoveryrules' => [
[
'name' => 'Empty LLD',
'key_' => 'lld_test',
'type' => ITEM_TYPE_TRAPPER
]
]
],
[
'host' => self::EMPTY_HOST,
'groups' => [['groupid' => $host_groupid]]
]
]);
self::$host_lldid = $hosts['discoveryruleids'][self::EMPTY_LLD_HOST.':lld_test'];
self::$empty_hostid = $hosts['hostids'][self::EMPTY_HOST];
$template_groups = CDataHelper::call('templategroup.create', [
['name' => 'Template group for empty template']
]);
$template_groupid = $template_groups['groupids'][0];
$templates = CDataHelper::createTemplates([
[
'host' => self::EMPTY_LLD_TEMPLATE,
'groups' => [['groupid' => $template_groupid]],