You are here

public function SearchByPageTester::verifyIndexCycling in Search by Page 6

Same name and namespace in other branches
  1. 7 tests/search_by_page.test \SearchByPageTester::verifyIndexCycling()

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.

4 calls to SearchByPageTester::verifyIndexCycling()
SearchbyPageAttachReindexTest::testReindexingAutomatic in tests/search_by_page.test
Tests that cycling through attachment reindexing happens correctly.
SearchByPageNodesReindexTest::testReindexingAutomatic in tests/search_by_page.test
Tests that cycling through content reindexing happens correctly.
SearchByPagePathsReindexTest::testReindexingAutomatic in tests/search_by_page.test
Tests that cycling through path reindexing happens correctly.
SearchByPageUsersReindexTest::testReindexingAutomatic in tests/search_by_page.test
Tests that cycling through user reindexing happens correctly.

File

tests/search_by_page.test, line 241
Tests for the Search by Page module. By Jennifer Hodgdon of Poplar ProductivityWare, www.poplarware.com

Class

SearchByPageTester
Base class for testing Search by Page.

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 ({$count})");
}