Source
'Time zone' => CDateTimeHelper::getTimeZoneFormat('System default'), // For local tests change system default 'Europe/Riga' to 'UTC'.
<?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 __DIR__ . '/../../include/CWebTest.php';
/**
* @backup users
*
* @dataSource LoginUsers, UserPermissions
*
* @onBefore prepareData
*/
class testFormUser extends CWebTest {
const SQL = 'SELECT * FROM users';
const ZABBIX_LDAP_USER = 'John Zabbix';
const UPDATE_USER = 'Tag-user';
const UPDATE_PASSWORD = 'Zabbix_Test_123';
/**
* Attach MessageBehavior to the test.
*
* @return array
*/
public function getBehaviors() {
return ['class' => CMessageBehavior::class];
}
public function prepareData() {
// Create LDAP server.
CDataHelper::call('userdirectory.create', [
[
'idp_type' => IDP_TYPE_LDAP,
'name' => 'LDAP server #1',
'host' => 'LDAP host',
'port' => 389,
'base_dn' => 'ou=Users,dc=example,dc=org',
'bind_dn' => 'cn=ldap_search,dc=example,dc=org',
'bind_password' => 'ldapsecretpassword',
'search_attribute' => 'uid'
]
]);
$userdirectoryids = CDataHelper::getIds('name');
// Create group with frontend access -> LDAP and previously created LDAP server.
CDataHelper::call('usergroup.create', [
[
'name' => 'Zabbix LDAP',
'gui_access' => GROUP_GUI_ACCESS_LDAP,
'userdirectoryid' => $userdirectoryids['LDAP server #1']