call('iconmap.create', [ [ 'name' => 'icon_mapping', 'default_iconid' => 5, 'mappings' => [ [ 'inventory_link' => 1, 'expression' => 'created_mapping', 'iconid' => 2 ] ] ] ]); $resourceid = $create['result']['iconmapids'][0]; $icon_map = CDBHelper::getRow('SELECT iconmappingid FROM icon_mapping WHERE iconmapid='.zbx_dbstr($resourceid)); $created = json_encode([ 'iconmap.name' => ['add', 'icon_mapping'], 'iconmap.default_iconid' => ['add', '5'], 'iconmap.mappings['.$icon_map['iconmappingid'].']' => ['add'], 'iconmap.mappings['.$icon_map['iconmappingid'].'].inventory_link' => ['add', '1'], 'iconmap.mappings['.$icon_map['iconmappingid'].'].expression' => ['add', 'created_mapping'], 'iconmap.mappings['.$icon_map['iconmappingid'].'].iconid' => ['add', '2'], 'iconmap.mappings['.$icon_map['iconmappingid'].'].iconmappingid' => ['add', $icon_map['iconmappingid']], 'iconmap.iconmapid' => ['add', $resourceid] ]); $this->getAuditDetails('details', $this->add_actionid, $created, $resourceid); } public function testAuditlogIconMap_Update() { $this->call('iconmap.update', [ [ 'iconmapid' => self::ICONMAPID, 'name' => 'updated_icon_mapping', 'default_iconid' => 4, 'mappings' => [ [ 'inventory_link' => 2, 'expression' => 'updated_created_mapping', 'iconid' => 3 ] ] ] ]); $icon_map = CDBHelper::getRow('SELECT iconmappingid FROM icon_mapping WHERE iconmapid='.zbx_dbstr(self::ICONMAPID)); $updated = json_encode([ 'iconmap.mappings[1]' => ['delete'], 'iconmap.mappings['.$icon_map['iconmappingid'].']' => ['add'], 'iconmap.name' => ['update', 'updated_icon_mapping', 'API icon map'], 'iconmap.default_iconid' => ['update', '4', '2'], 'iconmap.mappings['.$icon_map['iconmappingid'].'].inventory_link' => ['add', '2'], 'iconmap.mappings['.$icon_map['iconmappingid'].'].expression' => ['add', 'updated_created_mapping'], 'iconmap.mappings['.$icon_map['iconmappingid'].'].iconid' => ['add', '3'], 'iconmap.mappings['.$icon_map['iconmappingid'].'].iconmappingid' => ['add', $icon_map['iconmappingid']] ]); $this->getAuditDetails('details', $this->update_actionid, $updated, self::ICONMAPID); } public function testAuditlogIconMap_Delete() { $this->call('iconmap.delete', [self::ICONMAPID]); $this->getAuditDetails('resourcename', $this->delete_actionid, 'updated_icon_mapping', self::ICONMAPID); } }