self::$freebsd_templateid, 'templates' => [ [ 'templateid' => self::$agent_templateid ] ] ] ]); } /** * @dataProvider getTriggerDependenciesData */ public function testTriggerDependenciesFromHost_SimpleTest($data) { // Get the id of template to be updated based on the template that owns the trigger in dependencies tab. $ids = [ self::TEMPLATE_AGENT => self::$agent_templateid, self::TEMPLATE_APACHE => self::$apache_templateid ]; $update_id = ($data['template'] === self::TEMPLATE_APACHE) ? $ids[self::TEMPLATE_APACHE] : $ids[self::TEMPLATE_AGENT]; $this->zbxTestLogin('triggers.php?filter_set=1&context=template&filter_hostids[0]='.$update_id); $this->zbxTestCheckTitle('Configuration of triggers'); $this->zbxTestClickLinkTextWait($data['trigger']); $this->zbxTestClickWait('tab_dependenciesTab'); $this->zbxTestClick('add_dep_trigger'); $this->zbxTestLaunchOverlayDialog('Triggers'); $host = COverlayDialogElement::find()->one()->waitUntilReady()->query('class:multiselect-control')->asMultiselect()->one(); $host->fill([ 'values' => $data['template'], 'context' => 'Templates' ]); $this->zbxTestClickLinkTextWait($data['dependency']); $this->zbxTestWaitUntilElementVisible(WebDriverBy::id('add_dep_trigger')); $this->zbxTestClickWait('update'); if ($data['expected'] === TEST_BAD) { $this->assertMessage(TEST_BAD, 'Cannot update trigger', $data['error_message']); } else { $this->assertMessage(TEST_GOOD, 'Trigger updated'); } } public function getTriggerDependenciesData() { return [ [ [ 'expected' => TEST_BAD, 'trigger' => 'Apache: Host has been restarted', 'template' => self::TEMPLATE_FREEBSD, 'dependency' => 'FreeBSD: /etc/passwd has been changed on FreeBSD by Zabbix agent', 'error_message' => 'Trigger "Apache: Host has been restarted" cannot depend on the trigger'. ' "FreeBSD: /etc/passwd has been changed on {HOST.NAME}" from the template "FreeBSD by'. ' Zabbix agent", because dependencies on triggers from a child template or host are not allowed.' ] ], [ [ 'expected' => TEST_BAD, 'trigger' => 'Apache: Service is down', 'template' => self::TEMPLATE_APACHE, 'dependency' => 'Apache: Service response time is too high', 'error_message' => 'Trigger "Apache: Service is down" cannot depend on the trigger "Apache: Service response'. ' time is too high", because a circular linkage ("Apache: Service response time is too high" ->'. ' "Apache: Service is down" -> "Apache: Service response time is too high") would occur.' ] ], [ [ 'expected' => TEST_BAD, 'trigger' => 'Apache: Host has been restarted', 'template' => self::TEMPLATE_APACHE, 'dependency' => 'Apache: Host has been restarted', 'error_message' => 'Trigger "Apache: Host has been restarted" cannot depend on the trigger "Apache:'. ' Host has been restarted", because a circular linkage ("Apache: Host has been restarted" ->'. ' "Apache: Host has been restarted") would occur.' ] ], [ [ 'expected' => TEST_GOOD, 'trigger' => 'Apache: Host has been restarted', 'template' => self::TEMPLATE_APACHE, 'dependency' => 'Apache: Service is down' ] ] ]; } }