You are here

public function LinkitsearchPluginNodeTestCase::testBasicResults in Linkit 7.3

Test that we get results back which is valid.

File

test/linkit_search_plugin_node.test, line 51
Tests for Linkit search plugin node.

Class

LinkitsearchPluginNodeTestCase
Test the the node search plugin.

Code

public function testBasicResults() {

  // Create some nodes.
  $node_1 = $this
    ->drupalCreateNode(array(
    'type' => 'article',
    'title' => $this->search_string . $this
      ->randomName(),
  ));
  $node_2 = $this
    ->drupalCreateNode(array(
    'type' => 'article',
    'title' => $this->search_string . $this
      ->randomName(),
  ));
  $node_3 = $this
    ->drupalCreateNode(array(
    'type' => 'page',
    'title' => $this->search_string . $this
      ->randomName(),
  ));
  $node_4 = $this
    ->drupalCreateNode(array(
    'type' => 'page',
    'title' => $this->search_string . $this
      ->randomName(),
  ));

  // Call the autocomplete helper method.
  $this
    ->autocompleteCall();

  // Assert that the node titles appears in the response.
  $this
    ->assertRaw($node_1->title, 'Node was found in the result array.');
  $this
    ->assertRaw($node_2->title, 'Node was found in the result array.');
  $this
    ->assertRaw($node_3->title, 'Node was found in the result array.');
  $this
    ->assertRaw($node_4->title, 'Node was found in the result array.');
}