$this->assertEquals($oldHashIcons, CDBHelper::getHash($sqlIcons), 'Chuck Norris: No-change images update should not update data in table "images"');
require_once dirname(__FILE__).'/../include/CLegacyWebTest.php';
class testFormAdministrationGeneralImages extends CLegacyWebTest {
public $icon_image_name = '1image1';
public $icon_image_name2 = '2image2';
public $bg_image_name = '1bgimage1';
public $bg_image_name2 = '2bgimage2';
public function testFormAdministrationGeneralImages_CheckLayout() {
$this->zbxTestLogin('zabbix.php?action=gui.edit');
$this->query('id:page-title-general')->asPopupButton()->one()->select('Images');
$this->zbxTestCheckTitle('Configuration of images');
$this->zbxTestCheckHeader('Images');
$this->zbxTestTextPresent(['Images', 'Type']);
$this->zbxTestAssertElementPresentXpath("//select[@id='imagetype']/option[text()='Icon']");
$this->zbxTestAssertElementPresentXpath("//select[@id='imagetype']/option[text()='Background']");
$this->zbxTestAssertElementPresentXpath("//button[text()='Create icon']");
$this->zbxTestClickButtonText('Create icon');
$this->zbxTestAssertElementPresentId('name');
$this->zbxTestAssertAttribute("//input[@id='name']", "maxlength", '64');
$this->zbxTestAssertElementPresentId('image');
$this->zbxTestAssertElementPresentXpath("//button[text()='Add']");
$this->zbxTestAssertElementPresentXpath("//button[text()='Cancel']");
public function testFormAdministrationGeneralImages_AddImage() {
$this->zbxTestLogin('zabbix.php?action=image.list');
$this->zbxTestClickButtonText('Create icon');
$this->zbxTestAssertElementPresentId('name');
$this->zbxTestInputType('name', $this->icon_image_name);
$this->zbxTestInputType('image', PHPUNIT_BASEDIR.'/ui/tests/images/image.png');
$this->zbxTestClickButtonText('Add');
$this->zbxTestCheckTitle('Configuration of images');
$this->zbxTestCheckHeader('Images');
$this->zbxTestTextPresent(['Images', 'Type', 'Image added']);
$sql = 'SELECT * FROM images WHERE imagetype=1 AND name=\''.$this->icon_image_name.'\'';