require_once dirname(__FILE__).'/../include/CLegacyWebTest.php';
class testFormHostLinkTemplates extends CLegacyWebTest {
protected static $host = 'Visible host for template linkage';
protected static $template = 'Form test template';
protected static $link_template = 'Linux by Zabbix agent active';
protected static $hostid;
protected static $templateid;
protected static $link_templateid;
public function getBehaviors() {
return [CMessageBehavior::class];
protected static function getIDs() {
$ids = CDBHelper::getAll('SELECT hostid FROM hosts WHERE host IN ('.zbx_dbstr(self::$template).', '.
zbx_dbstr(self::$link_template).') OR name='.zbx_dbstr(self::$host).' ORDER BY host DESC'
self::$hostid = $ids[0]['hostid'];
self::$templateid = $ids[1]['hostid'];
self::$link_templateid = $ids[2]['hostid'];
public function testFormHostLinkTemplates_Layout() {
$this->page->login()->open('zabbix.php?action=host.list')->waitUntilReady();
$this->query('button:Create host')->one()->click();
$form = COverlayDialogElement::find()->asForm()->one()->waitUntilVisible();
$form->selectTab('Inventory');
$inventoryFields = getHostInventories();
$inventoryFields = zbx_toHash($inventoryFields, 'db_field');
foreach ($inventoryFields as $fieldId => $fieldName) {
$this->zbxTestTextPresent($fieldName['title']);
$this->zbxTestAssertElementPresentId('host_inventory_'.$fieldId.'');
COverlayDialogElement::find()->one()->close();