require_once dirname(__FILE__).'/../include/CLegacyWebTest.php';
class testPageNetworkDiscovery extends CLegacyWebTest {
public function testPageNetworkDiscovery_CheckLayout() {
$this->zbxTestLogin('discoveryconf.php');
$this->zbxTestCheckTitle('Configuration of discovery rules');
$this->zbxTestCheckHeader('Discovery rules');
$this->zbxTestTextPresent('Displaying');
$this->zbxTestTextPresent(['Name', 'IP range', 'Proxy', 'Interval', 'Checks', 'Status']);
$this->zbxTestTextPresent(['Enable', 'Disable', 'Delete']);
public static function allRules() {
return CDBHelper::getDataProvider('SELECT druleid,name FROM drules');
public function testPageNetworkDiscovery_SimpleUpdate($drule) {
$sqlDRules = 'SELECT * FROM drules WHERE druleid='.$drule['druleid'];
$sqlDChecks = 'SELECT * FROM dchecks WHERE druleid='.$drule['druleid'].' ORDER BY dcheckid';
$oldHashDRules = CDBHelper::getHash($sqlDRules);
$oldHashDChecks = CDBHelper::getHash($sqlDChecks);
$this->zbxTestLogin('discoveryconf.php');
$this->zbxTestCheckTitle('Configuration of discovery rules');
$this->zbxTestClickLinkText($drule['name']);
$this->zbxTestClickWait('update');
$this->zbxTestCheckTitle('Configuration of discovery rules');
$this->zbxTestTextPresent('Discovery rule updated');
$this->zbxTestTextPresent($drule['name']);
$this->assertEquals($oldHashDRules, CDBHelper::getHash($sqlDRules));
$this->assertEquals($oldHashDChecks, CDBHelper::getHash($sqlDChecks));