You are here

function SearchCommentTestCase::checkCommentAccess in Drupal 7

Update search index and search for comment.

1 call to SearchCommentTestCase::checkCommentAccess()
SearchCommentTestCase::testSearchResultsCommentAccess in modules/search/search.test
Verify access rules for comment indexing with different permissions.

File

modules/search/search.test, line 925
Tests for search.module.

Class

SearchCommentTestCase
Test integration searching comments.

Code

function checkCommentAccess($message, $assume_access = FALSE) {

  // Invoke search index update.
  search_touch_node($this->node->nid);
  $this
    ->cronRun();

  // Search for the comment subject.
  $edit = array(
    'search_block_form' => "'" . $this->comment_subject . "'",
  );
  $this
    ->drupalPost('', $edit, t('Search'));
  $method = $assume_access ? 'assertText' : 'assertNoText';
  $verb = $assume_access ? 'found' : 'not found';
  $this
    ->{$method}($this->node->title, "Node {$verb} in search results: " . $message);
  $this
    ->{$method}($this->comment_subject, "Comment subject {$verb} in search results: " . $message);
}