$this->assertEquals(1, CDBHelper::getCount($sqlValuemap), 'Chuck Norris: Value map with such name has not been created in the DB');
require_once dirname(__FILE__).'/../include/CLegacyWebTest.php';
class testFormAdministrationGeneralValuemap extends CLegacyWebTest {
private $valuemapWithMultipleMappings = '1valuemapWithMultipleMappings1';
public function testFormAdministrationGeneralValuemap_Layout() {
$this->zbxTestLogin('zabbix.php?action=gui.edit');
$this->query('id:page-title-general')->asPopupButton()->one()->select('Value mapping');
$this->zbxTestCheckTitle('Configuration of value mapping');
$this->zbxTestCheckHeader('Value mapping');
$this->zbxTestAssertElementPresentXpath('//button[text()="Create value map"]');
$this->zbxTestClickButtonText('Create value map');
$this->zbxTestTextPresent('Name');
$this->zbxTestAssertElementPresentId('name');
$this->zbxTestAssertAttribute("//input[@id='name']", "maxlength", 64);
$this->zbxTestTextPresent(['Mappings', 'Value', 'Mapped to']);
$this->zbxTestAssertElementPresentId('mappings_0_value');
$this->zbxTestAssertAttribute("//table[@id='mappings_table']//input[@name='mappings[0][value]']", "maxlength", 64);
$this->zbxTestAssertElementPresentId('mappings_0_newvalue');
$this->zbxTestAssertAttribute("//table[@id='mappings_table']//input[@name='mappings[0][newvalue]']", "maxlength", 64);
$this->zbxTestAssertElementPresentId('mapping_add');
public static function dataCreate() {
['1valuemap1', '1', 'one'],
['2valuemap2', '2', 'two']
public static function dataUpdate() {
['1valuemap1', '1valuemap_updated'],
['2valuemap2', '2valuemap_updated']