Tests for indexing throttle with nodes in multiple languages.
function testIndexingThrottle() {
// Index only 4 items per cron run.
config('search.settings')
->set('index.cron_limit', 4)
->save();
// Update the index. This does the initial processing.
node_update_index();
// Run the shutdown function. Testing is a unique case where indexing
// and searching has to happen in the same request, so running the shutdown
// function manually is needed to finish the indexing process.
search_update_totals();
// Then check how many nodes have been indexed. We have created three nodes,
// the first has one, the second has two and the third has three language
// variants. Indexing the third would exceed the throttle limit, so we
// expect that only the first two will be indexed.
$status = module_invoke('node', 'search_status');
$this
->assertEqual($status['remaining'], 1, 'Remaining items after updating the search index is 1.');
}