$settings['body'
] =
[['value' => 'love cheesy pizza'
]];
$this->
drupalCreateNode($settings);
} // Create another node and save it for later.
$settings['body'
] =
[['value' => 'Druplicon'
]];
$node =
$this->
drupalCreateNode($settings);
// Update the search index.
$this->container->
get('plugin.manager.search'
)->
createInstance('node_search'
)->
updateIndex();
// Refresh variables after the treatment.
$this->
refreshVariables();
// Test that the correct number of pager links are found for keyword search.
$edit =
['keys' => 'love pizza'
];
$this->
drupalGet('search/node'
);
$this->
submitForm($edit, 'Search'
);
$this->
assertSession()->
linkByHrefExists('page=1', 0, '2nd page link is found for keyword search.'
);
$this->
assertSession()->
linkByHrefExists('page=2', 0, '3rd page link is found for keyword search.'
);
$this->
assertSession()->
linkByHrefExists('page=3', 0, '4th page link is found for keyword search.'
);
$this->
assertSession()->
linkByHrefNotExists('page=4', '5th page link is not found for keyword search.'
);
// Test that the correct number of pager links are found for exact phrase search.