Source
$this->assertEquals($data['db_check'], CDBHelper::getRow('SELECT auditlog_enabled, hk_audit_mode, hk_audit FROM config'));
<?php
/*
** Zabbix
** Copyright (C) 2001-2023 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__).'/common/testFormAdministrationGeneral.php';
/**
* @backup config
*/
class testFormAdministrationGeneralAuditLog extends testFormAdministrationGeneral {
public $form_selector = 'id:audit-settings';
public $config_link = 'zabbix.php?action=audit.settings.edit';
public $default_values = [
'Enable audit logging' => true,
'Enable internal housekeeping' => true,
'Data storage period' => '365d'
];
public $custom_values = [
'Enable audit logging' => true,
'Enable internal housekeeping' => true,
'Data storage period' => '400d'
];
/**
* Attach MessageBehavior to the test.
*
* @return array
*/
public function getBehaviors() {
return ['class' => CMessageBehavior::class];
}
/**
* The function's main purpose is to check if the layout of the page is not broken and fields are in their place,
* Additional checkups are made and committed within the function.
*/
public function testFormAdministrationGeneralAuditLog_CheckLayout() {
$this->page->login()->open('zabbix.php?action=audit.settings.edit')->waitUntilReady();
$form = $this->query('id:audit-settings')->waitUntilPresent()->asForm()->one();
$form->checkValue($this->default_values);
// Check if field "Data storage period" is disabled when options are in all possible ways.
$checkboxes = [
['audit' => true, 'housekeeping' => false],
['audit' => false, 'housekeeping' => true],