You are here

public function SearchByPageTesterTest::verifyIndexCycling in Search by Page 8

Helper function: Verifies reindexing.

Tests that one item was reindexed, and it was the oldest item, given previous and current output from getIndexTimes(). Assumes, but does not explicitly check, that the array keys are the same for the two arrays.

Parameters

$prev: Previous index times array.

$curr: Current index times array.

5 calls to SearchByPageTesterTest::verifyIndexCycling()
SearchbyPageAttachReindexTest::testReindexingAutomatic in tests/src/Functional/search_by_page.test
Tests that cycling through attachment reindexing happens correctly.
SearchByPageExtraUsersTest::testReindexingUsers in tests/src/Functional/search_by_page.test
Tests that no new users are created when reindexing.
SearchByPageNodesReindexTest::testReindexingAutomatic in tests/src/Functional/search_by_page.test
Tests that cycling through content reindexing happens correctly.
SearchByPagePathsReindexTest::testReindexingAutomatic in tests/src/Functional/search_by_page.test
Tests that cycling through path reindexing happens correctly.
SearchByPageUsersReindexTest::testReindexingAutomatic in tests/src/Functional/search_by_page.test
Tests that cycling through user reindexing happens correctly.

File

tests/src/Functional/SearchByPageTesterTest.php, line 161
General Functional Tests for the Search by Page module. By Jennifer Hodgdon of Poplar ProductivityWare, www.poplarware.com

Class

SearchByPageTesterTest
Base class for testing Search by Page.

Namespace

Drupal\Tests\search_by_page\Functional

Code

public function verifyIndexCycling($prev, $curr) {
  $keys = array_keys($prev);
  $min_val = min($prev);
  $count = 0;
  foreach ($keys as $key) {
    if ($prev[$key] != $curr[$key]) {
      $count++;
      $this
        ->assertEqual($prev[$key], $min_val, "Item indexed was the oldest");
    }
  }
  $this
    ->assertEqual($count, 1, "Exactly one item was indexed");
}