public function testGetList() { $testResult = array(array('host_id' => '1', 'host_template_model_htm_id' => null, 'command_command_id' => '2', 'command_command_id_arg1' => '1!2', 'timeperiod_tp_id' => '1', 'timeperiod_tp_id2' => '1', 'command_command_id2' => '3', 'command_command_id_arg2' => '80!90', 'host_name' => 'Template host', 'host_alias' => 'Template host', 'host_address' => null, 'display_name' => 'Template host', 'host_max_check_attempts' => '5', 'host_check_interval' => '5', 'host_retry_check_interval' => '5', 'host_active_checks_enabled' => '2', 'host_passive_checks_enabled' => '2', 'host_checks_enabled' => '2', 'initial_state' => 'u', 'host_obsess_over_host' => '2', 'host_check_freshness' => '2', 'host_freshness_threshold' => '5', 'host_event_handler_enabled' => '2', 'host_low_flap_threshold' => '5', 'host_high_flap_threshold' => '5', 'host_flap_detection_enabled' => '2', 'flap_detection_options' => 'f', 'host_process_perf_data' => '2', 'host_retain_status_information' => '2', 'host_retain_nonstatus_information' => '2', 'host_notification_interval' => '300', 'host_notification_options' => '$HOSTNAME$', 'host_notifications_enabled' => '2', 'contact_additive_inheritance' => '1', 'cg_additive_inheritance' => '1', 'host_first_notification_delay' => '0', 'host_snmp_community' => 'public', 'host_snmp_version' => '2c', 'host_location' => '0', 'host_comment' => 'Host template', 'host_register' => '0', 'host_activate' => '1', 'organization_id' => 1, 'environment_id' => null, 'poller_id' => null)); $result = Hosttemplate::getList(); $this->assertEquals($testResult, $result); $testResult = array(array('host_id' => '1', 'host_template_model_htm_id' => null, 'command_command_id' => '2', 'command_command_id_arg1' => '1!2', 'timeperiod_tp_id' => '1', 'timeperiod_tp_id2' => '1', 'command_command_id2' => '3', 'command_command_id_arg2' => '80!90', 'host_name' => 'Template host', 'host_alias' => 'Template host', 'host_address' => null, 'display_name' => 'Template host', 'host_max_check_attempts' => '5', 'host_check_interval' => '5', 'host_retry_check_interval' => '5', 'host_active_checks_enabled' => '2', 'host_passive_checks_enabled' => '2', 'host_checks_enabled' => '2', 'initial_state' => 'u', 'host_obsess_over_host' => '2', 'host_check_freshness' => '2', 'host_freshness_threshold' => '5', 'host_event_handler_enabled' => '2', 'host_low_flap_threshold' => '5', 'host_high_flap_threshold' => '5', 'host_flap_detection_enabled' => '2', 'flap_detection_options' => 'f', 'host_process_perf_data' => '2', 'host_retain_status_information' => '2', 'host_retain_nonstatus_information' => '2', 'host_notification_interval' => '300', 'host_notification_options' => '$HOSTNAME$', 'host_notifications_enabled' => '2', 'contact_additive_inheritance' => '1', 'cg_additive_inheritance' => '1', 'host_first_notification_delay' => '0', 'host_snmp_community' => 'public', 'host_snmp_version' => '2c', 'host_location' => '0', 'host_comment' => 'Host template', 'host_register' => '0', 'host_activate' => '1', 'organization_id' => 1, 'environment_id' => null, 'poller_id' => null)); $result = Hosttemplate::getList('*', 1); $this->assertEquals($testResult, $result); $testResult = array(); $result = Hosttemplate::getList('*', 1, 1); $this->assertEquals($testResult, $result); $testResult = array(array('host_name' => 'Template host')); $result = Hosttemplate::getList('host_name'); $this->assertEquals($testResult, $result); $testResult = array(array('host_name' => 'Template host', 'host_id' => 1)); $result = Hosttemplate::getList(array('host_name', 'host_id')); $this->assertEquals($testResult, $result); $testResult = array(array('host_name' => 'Template host')); $result = Hosttemplate::getList('host_name', -1, 0, 'host_name', 'DESC'); $this->assertEquals($testResult, $result); $testResult = array(array('host_name' => 'Template host')); $result = Hosttemplate::getList('host_name', -1, 0, null, 'ASC', array('host_name' => 'Template host')); $this->assertEquals($testResult, $result); $this->setExpectedException('\\Centreon\\Internal\\Exception', "Unknown filter type", 0); Hosttemplate::getList('host_name', -1, 0, null, 'ASC', array('host_name' => array('Host 1', 'Host 2')), 'ERR'); }