require_once dirname(__FILE__).'/../../include/CLegacyWebTest.php';
class testFormHostLinkTemplates extends CLegacyWebTest {
public $host_for_template = 'Visible host for template linkage';
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();
public function testFormHostLinkTemplates_TemplateLink() {
$this->zbxTestLogin(self::HOST_LIST_PAGE);
$this->query('button:Reset')->one()->click();
$this->zbxTestClickLinkTextWait($this->host_for_template);
$dialog = COverlayDialogElement::find()->asForm()->waitUntilReady()->one();
$dialog->fill(['Templates' => 'Linux by Zabbix agent active']);
$this->zbxTestTextPresent('Linux by Zabbix agent active');
$this->zbxTestCheckTitle('Configuration of hosts');
$this->zbxTestWaitUntilMessageTextPresent('msg-good', 'Host updated');
$this->zbxTestTextPresent($this->host_for_template);
public function testFormHostLinkTemplates_TemplateUnlink() {