templateid. ' AND i.flags=0'. ')'. ' AND t.flags=0' ); } /** * @dataProvider update */ public function testInheritanceTrigger_SimpleUpdate($data) { $sqlTriggers = 'SELECT * FROM triggers ORDER BY triggerid'; $oldHashTriggers = CDBHelper::getHash($sqlTriggers); $this->zbxTestLogin('triggers.php?form=update&triggerid='.$data['triggerid'].'&context=host'); $this->zbxTestCheckTitle('Configuration of triggers'); $this->zbxTestClickWait('update'); $this->zbxTestWaitUntilMessageTextPresent('msg-good', 'Trigger updated'); $this->assertEquals($oldHashTriggers, CDBHelper::getHash($sqlTriggers)); } public static function create() { return [ [ [ 'expected' => TEST_GOOD, 'description' => 'testInheritanceTrigger', 'expression' => 'last(/Inheritance test template/test-inheritance-item1)=0' ] ], [ [ 'expected' => TEST_BAD, 'description' => 'testInheritanceTrigger1', 'expression' => 'last(/Inheritance test template/key-item-inheritance-test)=0', 'errors' => [ 'Trigger "testInheritanceTrigger1" already exists on "Inheritance test template".' ] ] ] ]; } /** * @dataProvider create */ public function testInheritanceTrigger_SimpleCreate($data) { $this->zbxTestLogin('triggers.php?filter_set=1&context=template&filter_hostids[0]='.$this->templateid); $this->zbxTestContentControlButtonClickTextWait('Create trigger'); $this->zbxTestInputType('description', $data['description']); $this->zbxTestInputType('expression', $data['expression']); $this->zbxTestClickWait('add'); switch ($data['expected']) { case TEST_GOOD: $this->zbxTestCheckTitle('Configuration of triggers'); $this->zbxTestCheckHeader('Triggers'); $this->zbxTestTextPresent('Trigger added'); $this->zbxTestTextPresent($data['description']); break; case TEST_BAD: $this->zbxTestCheckTitle('Configuration of triggers'); $this->zbxTestCheckHeader('Triggers'); $this->zbxTestTextPresent('Cannot add trigger'); $this->zbxTestTextPresent($data['errors']); break; } } }