protected function RangeViewsBaseTestCase::createSearchServerAndIndex in Range 7
Creates search server and index.
2 calls to RangeViewsBaseTestCase::createSearchServerAndIndex()
- RangeViewsArgumentTestCase::testRangeSearchApiViewsArgument in tests/
views/ range.views.argument.test - Tests range search API views argument.
- RangeViewsFilterTestCase::testRangeSearchApiViewsFilter in tests/
views/ range.views.filter.test - Tests range search API views filter.
File
- tests/
views/ range.views.base.test, line 114 - Contains range views base test class.
Class
- RangeViewsBaseTestCase
- Base class for testing range views handlers.
Code
protected function createSearchServerAndIndex() {
// Create search server and index using DB service.
$server_values = array(
'name' => 'test_server',
'machine_name' => 'test_server',
'class' => 'search_api_db_service',
'options' => array(
'database' => 'default:default',
),
);
search_api_server_insert($server_values);
$index_values = array(
'name' => 'test_index',
'machine_name' => 'test_index',
'server' => 'test_server',
'item_type' => 'node',
'options' => array(
'index_directly' => TRUE,
'fields' => array(
'field_range_integer:from' => array(
'type' => 'integer',
),
'field_range_integer:to' => array(
'type' => 'integer',
),
'search_api_language' => array(
'type' => 'string',
),
),
),
);
$index_id = search_api_index_insert($index_values);
$index = search_api_index_load($index_id);
search_api_index_items($index);
// Search API returns result with a different column keys.
$this->map = array(
'entity' => 'nid',
);
}