function SearchMultilingualEntityTest::assertIndexCounts
Same name in other branches
- 9 core/modules/search/tests/src/Functional/SearchMultilingualEntityTest.php \Drupal\Tests\search\Functional\SearchMultilingualEntityTest::assertIndexCounts()
- 10 core/modules/search/tests/src/Functional/SearchMultilingualEntityTest.php \Drupal\Tests\search\Functional\SearchMultilingualEntityTest::assertIndexCounts()
- 11.x core/modules/search/tests/src/Functional/SearchMultilingualEntityTest.php \Drupal\Tests\search\Functional\SearchMultilingualEntityTest::assertIndexCounts()
Verifies the indexing status counts.
Parameters
int $remaining: Count of remaining items to verify.
int $total: Count of total items to verify.
string $message: Message to use, something like "after updating the search index".
2 calls to SearchMultilingualEntityTest::assertIndexCounts()
- SearchMultilingualEntityTest::setUp in core/
modules/ search/ tests/ src/ Functional/ SearchMultilingualEntityTest.php - SearchMultilingualEntityTest::testMultilingualSearch in core/
modules/ search/ tests/ src/ Functional/ SearchMultilingualEntityTest.php - Tests the indexing throttle and search results with multilingual nodes.
File
-
core/
modules/ search/ tests/ src/ Functional/ SearchMultilingualEntityTest.php, line 286
Class
- SearchMultilingualEntityTest
- Tests entities with multilingual fields.
Namespace
Drupal\Tests\search\FunctionalCode
protected function assertIndexCounts($remaining, $total, $message) {
// Check status via plugin method call.
$status = $this->plugin
->indexStatus();
$this->assertEqual($status['remaining'], $remaining, 'Remaining items ' . $message . ' is ' . $remaining);
$this->assertEqual($status['total'], $total, 'Total items ' . $message . ' is ' . $total);
// Check text in progress section of Search settings page. Note that this
// test avoids using
// \Drupal\Core\StringTranslation\TranslationInterface::formatPlural(), so
// it tests for fragments of text.
$indexed = $total - $remaining;
$percent = $total > 0 ? floor(100 * $indexed / $total) : 100;
$this->drupalGet('admin/config/search/pages');
$this->assertText($percent . '% of the site has been indexed.', 'Progress percent text at top of Search settings page is correct at: ' . $message);
$this->assertText($remaining . ' item', 'Remaining text at top of Search settings page is correct at: ' . $message);
// Check text in pages section of Search settings page.
$this->assertText($indexed . ' of ' . $total . ' indexed', 'Progress text in pages section of Search settings page is correct at: ' . $message);
// Check text on status report page.
$this->drupalGet('admin/reports/status');
$this->assertText('Search index progress', 'Search status section header is present on status report page');
$this->assertText($percent . '%', 'Correct percentage is shown on status report page at: ' . $message);
$this->assertText('(' . $remaining . ' remaining)', 'Correct remaining value is shown on status report page at: ' . $message);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.