assertSearchResultsCount example

'site_default_language' => 'en',
    ], 'Save configuration');
    // When default language is changed, the container is rebuilt in the child     // site, so a rebuild in the main site is required to use the new container     // here.     $this->rebuildContainer();

    // Before running cron, verify that a search returns no results and shows     // warning.     $this->drupalGet('search/help');
    $this->submitForm(['keys' => 'not-a-word-english'], 'Search');
    $this->assertSearchResultsCount(0);
    $this->assertSession()->statusMessageContains('Help search is not fully indexed', 'warning');

    // Run cron until the topics are fully indexed, with a limit of 100 runs     // to avoid infinite loops.     $num_runs = 100;
    $plugin = HelpSearch::create($this->container, [], 'help_search', []);
    do {
      $this->cronRun();
      $remaining = $plugin->indexStatus()['remaining'];
    } while (--$num_runs && $remaining);
    $this->assertNotEmpty($num_runs);
    
Home | Imprint | This part of the site doesn't use cookies.