require_once dirname(__FILE__).'/../include/CLegacyWebTest.php';
class testFormAdministrationGeneralTrigDisplOptions extends CLegacyWebTest {
public static function allValues() {
return CDBHelper::getDataProvider(
'SELECT custom_color,problem_unack_color,problem_unack_style,problem_ack_color,problem_ack_style,'.
'ok_unack_color,ok_unack_style,ok_ack_color,ok_ack_style,ok_period,blink_period'.
public function testFormAdministrationGeneralTrigDisplOptions_Layout($allValues) {
$this->zbxTestLogin('zabbix.php?action=trigdisplay.edit');
$this->zbxTestCheckHeader('Trigger displaying options');
$this->zbxTestTextPresent(
'Trigger displaying options',
'Use custom event status colours',
'Unacknowledged PROBLEM events',
'Acknowledged PROBLEM events',
'Unacknowledged RESOLVED events',
'Acknowledged RESOLVED events',
'Display OK triggers for',
'On status change triggers blink for'
$this->assertEquals($this->zbxTestCheckboxSelected('custom_color'), (bool) $allValues['custom_color']);
$this->zbxTestAssertElementValue('problem_unack_color', $allValues['problem_unack_color']);
$this->zbxTestAssertElementValue('problem_ack_color', $allValues['problem_ack_color']);
$this->zbxTestAssertElementValue('ok_unack_color', $allValues['ok_unack_color']);
$this->zbxTestAssertElementValue('ok_ack_color', $allValues['ok_ack_color']);
$this->assertEquals($this->zbxTestCheckboxSelected('problem_unack_style'), (bool) $allValues['problem_unack_style']);
$this->assertEquals($this->zbxTestCheckboxSelected('problem_ack_style'), (bool) $allValues['problem_ack_style']);
$this->assertEquals($this->zbxTestCheckboxSelected('ok_unack_style'), (bool) $allValues['ok_unack_style']);
$this->assertEquals($this->zbxTestCheckboxSelected('ok_ack_style'), (bool) $allValues['ok_ack_style']);
$this->zbxTestAssertElementValue('ok_period', $allValues['ok_period']);
$this->zbxTestAssertElementValue('blink_period', $allValues['blink_period']);
$this->zbxTestAssertElementPresentXpath("//input[@id='problem_unack_color'][@disabled]");
$this->zbxTestAssertElementPresentXpath("//input[@id='problem_ack_color'][@disabled]");
$this->zbxTestAssertElementPresentXpath("//input[@id='ok_unack_color'][@disabled]");
$this->zbxTestAssertElementPresentXpath("//input[@id='ok_ack_color'][@disabled]");
public function testFormAdministrationGeneralTrigDisplOptions_UpdateTrigDisplOptions() {
$this->zbxTestLogin('zabbix.php?action=trigdisplay.edit');
$this->zbxTestCheckTitle('Configuration of trigger displaying options');
$this->zbxTestCheckHeader('Trigger displaying options');
$this->query('id:page-title-general')->asPopupButton()->one()->select('Trigger displaying options');
$this->zbxTestTextPresent(['Trigger displaying options', 'blinking', 'Unacknowledged PROBLEM events', 'Acknowledged PROBLEM events', 'Unacknowledged RESOLVED events', 'Acknowledged RESOLVED events', 'Display OK triggers for', 'On status change triggers blink for']);
$sql_hash = 'SELECT '.CDBHelper::getTableFields('config', ['custom_color', 'problem_unack_color', 'problem_ack_color', 'ok_unack_color', 'ok_ack_color', 'problem_unack_style', 'problem_ack_style', 'ok_unack_style', 'ok_ack_style', 'ok_period', 'blink_period']).' FROM config ORDER BY configid';
$old_hash = CDBHelper::getHash($sql_hash);
$this->zbxTestCheckboxSelect('custom_color');
$this->zbxTestInputType('problem_unack_color', 'AAAAAA');
$this->zbxTestInputType('problem_ack_color', 'BBBBBB');
$this->zbxTestInputType('ok_unack_color', 'CCCCCC');
$this->zbxTestInputType('ok_ack_color', 'DDDDDD');
$this->zbxTestCheckboxSelect('problem_unack_style', false);
$this->zbxTestCheckboxSelect('problem_ack_style', false);