$search_result =
$this->plugin->
execute();
$this->
assertCount(2,
$search_result, 'The search found 2 results'
);
// Test to check for the language of result items.
foreach ($search_result as $result) { $this->
assertEquals('hu',
$result['langcode'
], 'The search found the correct Hungarian result'
);
} // Mark one of the nodes for reindexing, using the API function, and
// verify indexing status.
$search_index->
markForReindex('node_search',
$this->searchableNodes
[0
]->
id());
$this->
assertIndexCounts(1, 8, 'after marking one node to reindex via API function'
);
// Update the index and verify the totals again.
$this->plugin =
$this->container->
get('plugin.manager.search'
)->
createInstance('node_search'
);
$this->plugin->
updateIndex();
$this->
assertIndexCounts(0, 8, 'after indexing again'
);
// Mark one node for reindexing by saving it, and verify indexing status.
$this->searchableNodes
[1
]->
save();
$this->
assertIndexCounts(1, 8, 'after marking one node to reindex via save'
);