Source
xxxxxxxxxx
<?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 dirname(__FILE__) . '/../include/CWebTest.php';
require_once dirname(__FILE__).'/behaviors/CMessageBehavior.php';
require_once dirname(__FILE__).'/behaviors/CTableBehavior.php';
/**
* @backup sessions
*
* @backupConfig
*/
class testFormSetup extends CWebTest {
/**
* Attach MessageBehavior and TableBehavior to the test.
*
* @return array
*/
public function getBehaviors() {
return [
CMessageBehavior::class,
CTableBehavior::class
];
}
/**
* @backup config
*/
public function testFormSetup_welcomeSectionLayout() {
$this->page->login()->open('setup.php')->waitUntilReady();
// Check Welcome section.
$this->assertEquals("Welcome to\nZabbix ".ZABBIX_EXPORT_VERSION, $this->query('xpath://div[@class="setup-title"]')->one()->getText());
$this->checkSections('Welcome');
$form = $this->query('xpath://form')->asForm()->one();
$language_field = $form->getField('Default language');
$this->assertEquals('English (en_GB)', $language_field->getValue());
$hint_text = 'You are not able to choose some of the languages, because locales for them are not installed '.
'on the web server.';
$this->assertEquals($hint_text, $this->query('xpath://button[@data-hintbox]')->one()
->getAttribute('data-hintbox-contents'));
$this->checkButtons('first section');
$this->assertScreenshot($form, 'Welcome_En');
// Check that default language can be changed.
$language_field->fill('Russian (ru_RU)');
$this->page->refresh()->waitUntilReady();
$this->assertEquals("Добро пожаловать в\nZabbix ".ZABBIX_EXPORT_VERSION, $this->query('xpath://div[@class="setup-title"]')->one()->getText());
$this->checkButtons('russian');
$this->assertScreenshotExcept($form, $this->query('id:default-lang')->one(), 'Welcome_Rus');
}
// Commented until Jenkins issue investigated.
// public function testFormSetup_prerequisitesSectionLayout() {
// $this->page->login()->open('setup.php')->waitUntilReady();
// $this->query('button:Next step')->one()->click();
//
// // Check Pre-requisites section.
// $this->checkPageTextElements('Check of pre-requisites');
// $headers = $this->query('class:list-table')->asTable()->one()->getHeadersText();
// $this->assertEquals(['', 'Current value', 'Required', ''], $headers);
//
// $prerequisites = [
// 'PHP version',
// 'PHP option "memory_limit"',
// 'PHP option "post_max_size"',
// 'PHP option "upload_max_filesize"',
// 'PHP option "max_execution_time"',
// 'PHP option "max_input_time"',
// 'PHP databases support',
// 'PHP bcmath',
// 'PHP mbstring',
// 'PHP option "mbstring.func_overload"',
// 'PHP sockets',
// 'PHP gd',
// 'PHP gd PNG support',