public function LinkitsearchPluginNodeTestCase::testGroupbyBundle in Linkit 7.3
Test group by bundle.
The actual grouping is made by the javascript later on. We just test that the resons contains group info.
File
- test/
linkit_search_plugin_node.test, line 108 - Tests for Linkit search plugin node.
Class
- LinkitsearchPluginNodeTestCase
- Test the the node search plugin.
Code
public function testGroupbyBundle() {
// Create some nodes.
$node_1 = $this
->drupalCreateNode(array(
'type' => 'article',
'title' => $this->search_string . $this
->randomName(),
));
$node_2 = $this
->drupalCreateNode(array(
'type' => 'page',
'title' => $this->search_string . $this
->randomName(),
));
// Get the bundle names.
$node_type_name_1 = node_type_get_name($node_1);
$node_type_name_2 = node_type_get_name($node_2);
// Update the profile to group by bundle.
$this->_profile->data['entity:node']['group_by_bundle'] = 1;
$this
->updateProfile();
// Call the autocomplete helper method.
$this
->autocompleteCall();
// Assert that the bundle title appear in the response.
$this
->assertRaw('"group":"Node - ' . $node_type_name_1, 'Bundle name in group was found in the result array.');
$this
->assertRaw('"group":"Node - ' . $node_type_name_2, 'Bundle name in group was found in the result array.');
}