search_api_test_2.module in Search API 7
Provides a second test service and server for testing Search API.
File
tests/search_api_test_2.module
View source
<?php
function search_api_test_2_search_api_service_info() {
$name = 'search_api_test_service_2';
$services[$name] = array(
'name' => $name,
'description' => 'search_api_test_service_2 description',
'class' => 'SearchApiDummyService',
);
return $services;
}
function search_api_test_2_default_search_api_server() {
$id = 'test_server_2';
$items[$id] = entity_create('search_api_server', array(
'name' => 'Search API test server 2',
'machine_name' => $id,
'enabled' => 1,
'description' => 'A server used for testing.',
'class' => 'search_api_test_service_2',
));
return $items;
}
class SearchApiDummyService implements SearchApiServiceInterface {
public function __construct(\SearchApiServer $server) {
}
public function configurationForm(array $form, array &$form_state) {
return array();
}
public function configurationFormValidate(array $form, array &$values, array &$form_state) {
}
public function configurationFormSubmit(array $form, array &$values, array &$form_state) {
}
public function supportsFeature($feature) {
return FALSE;
}
public function viewSettings() {
return array();
}
public function postCreate() {
}
public function postUpdate() {
return FALSE;
}
public function preDelete() {
}
public function addIndex(SearchApiIndex $index) {
}
public function fieldsUpdated(SearchApiIndex $index) {
return FALSE;
}
public function removeIndex($index) {
}
public function indexItems(SearchApiIndex $index, array $items) {
return array();
}
public function deleteItems($ids = 'all', SearchApiIndex $index = NULL) {
}
public function query(SearchApiIndex $index, $options = array()) {
throw new SearchApiException("The dummy service doesn't support queries");
}
public function search(SearchApiQueryInterface $query) {
return array();
}
}