You are here

class FacetapiTestAdapter in Facet API 7

Same name and namespace in other branches
  1. 6.3 tests/facetapi_test/plugins/facetapi/test_adapter.inc \FacetapiTestAdapter
  2. 7.2 tests/facetapi_test.plugins.inc \FacetapiTestAdapter

Adapter for our test searcher.

The test searcher does not connect to a backend, it just renders dummy data every tom a search is executed. Facet API is not responsible for calculating the facets, so for testing purposes this works just fine.

Hierarchy

Expanded class hierarchy of FacetapiTestAdapter

1 string reference to 'FacetapiTestAdapter'
facetapi_test_facetapi_adapters in tests/facetapi_test.facetapi.inc
Implements hook_facetapi_adapters().

File

tests/facetapi_test.plugins.inc, line 15
Test adapter and plugins.

View source
class FacetapiTestAdapter extends FacetapiAdapter {

  /**
   * The total number of results in the query.
   */
  protected $resultCount = 10;

  /**
   * Implements FacetapiAdapter::searchExecuted().
   */
  public function searchExecuted() {
    return !empty($this->keys);
  }

  /**
   * Implements FacetapiAdapter::suppressOutput().
   */
  public function suppressOutput($realm_name) {
    return FALSE;
  }

  /**
   * Overrides FacetapiAdapter::getSearchPath().
   */
  public function getSearchPath() {
    return 'facetapi_test/search';
  }

  /**
   * Sets the result count.
   *
   * The test searcher does not use the core pager APIs, so we use this method
   * to set a dummy value.
   *
   * @param int $count
   *   The result count.
   *
   * @return FacetapiAdapter
   *   An instance of this class.
   */
  public function setResultCount($count) {
    $this->resultCount = $count;
    return $this;
  }

  /**
   * Overrides FacetapiAdapter::getResultCount().
   */
  public function getResultCount() {
    return $this->resultCount;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FacetapiAdapter::$activeItems protected property An array of active items created by FacetapiAdapter::processActiveItems().
FacetapiAdapter::$dependenciesPassed protected property An array of facets that passed their dependencies.
FacetapiAdapter::$facets protected property An array of FacetapiFacet objects for facets being rendered.
FacetapiAdapter::$info protected property The searcher information as returned by facetapi_get_searcher_info().
FacetapiAdapter::$keys protected property The search keys, or query text, submitted by the user.
FacetapiAdapter::$processed protected property A boolean flagging whether the facets have been processed, or built.
FacetapiAdapter::$processors protected property An array of FacetapiFacetProcessor objects.
FacetapiAdapter::$queryTypes protected property An array of executed query type plugins keyed by field name.
FacetapiAdapter::$searchPath protected property Stores the search path associated with this searcher.
FacetapiAdapter::$settings protected property Stores settings with defaults.
FacetapiAdapter::$urlProcessor protected property The url processor plugin associated with this adapter.
FacetapiAdapter::addActiveFilters function Allows the backend to add facet queries to its native query object.
FacetapiAdapter::buildRealm public function Uses each facet's widget to build the realm's render array.
FacetapiAdapter::getActiveItems public function Returns a facet's active items.
FacetapiAdapter::getAllActiveItems public function Return all active items keyed by raw filter, usually in field:value format.
FacetapiAdapter::getDefaultSettings public function Provides default values for the backend specific settings.
FacetapiAdapter::getEnabledFacets public function Returns enabled facets for the searcher associated with this adapter.
FacetapiAdapter::getFacet public function Returns a FacetapiFacet instance for the facet being rendered.
FacetapiAdapter::getFacetPath public function Helper function that returns the path for a facet link.
FacetapiAdapter::getFacetQuery public function Returns the facet's instantiated query type plugin.
FacetapiAdapter::getFacetSettings public function Returns realm specific settings for a facet.
FacetapiAdapter::getFacetSettingsGlobal public function Returns global settings for a facet.
FacetapiAdapter::getId public function Returns the id of the adapter plugin.
FacetapiAdapter::getMappedValue public function Maps a facet's index value to a human readable value displayed to the user.
FacetapiAdapter::getPageLimit public function Returns the number of results per page.
FacetapiAdapter::getPageNumber public function Returns the page number of the search result set.
FacetapiAdapter::getPageTotal public function Returns the total number of pages in the result set.
FacetapiAdapter::getPath public function Returns the path to the the realm's admin settings page.
FacetapiAdapter::getProcessor public function Returns the processor associated with the facet.
FacetapiAdapter::getQueryString public function Helper function that returns the query string variables for a facet item.
FacetapiAdapter::getSearcher public function Returns the machine readable name of the searcher.
FacetapiAdapter::getSearchKeys public function Gets the search keys, or query text, submitted by the user.
FacetapiAdapter::getTypes public function Returns the type of content indexed by $this->info['searcher'].
FacetapiAdapter::getUrlProcessor public function Return the instantiated url processor plugin.
FacetapiAdapter::initActiveFilters public function Hook that allows the backend to initialize its query object for faceting.
FacetapiAdapter::initSettingsObject public function Initializes a new settings object.
FacetapiAdapter::initUrlProcessor public function Extracts, stores, and processes facet data.
FacetapiAdapter::itemActive public function Tests whether a facet item is active by passing it's value.
FacetapiAdapter::loadQueryTypePlugins public function Returns an array of instantiated query type plugins for enabled facets.
FacetapiAdapter::loadUrlProcessor public function Loads the URL processor associated with this adapter.
FacetapiAdapter::processActiveItems public function Processes active facet items.
FacetapiAdapter::processFacets public function Initializes facet builds, sets the breadcrumb trail.
FacetapiAdapter::setParams public function Processes and stores the extracted facet data.
FacetapiAdapter::setSearchKeys public function Sets the search keys, or query text, submitted by the user.
FacetapiAdapter::settingsForm public function Allows for backend specific overrides to the settings form.
FacetapiAdapter::supportsFacetMincount public function Returns TRUE if the back-end supports "minimum facet counts".
FacetapiAdapter::supportsFacetMissing public function Returns TRUE if the backend supports "missing" facets.
FacetapiAdapter::__construct public function Constructs a FacetapiAdapter object.
FacetapiTestAdapter::$resultCount protected property The total number of results in the query.
FacetapiTestAdapter::getResultCount public function Overrides FacetapiAdapter::getResultCount(). Overrides FacetapiAdapter::getResultCount
FacetapiTestAdapter::getSearchPath public function Overrides FacetapiAdapter::getSearchPath(). Overrides FacetapiAdapter::getSearchPath
FacetapiTestAdapter::searchExecuted public function Implements FacetapiAdapter::searchExecuted(). Overrides FacetapiAdapter::searchExecuted
FacetapiTestAdapter::setResultCount public function Sets the result count.
FacetapiTestAdapter::suppressOutput public function Implements FacetapiAdapter::suppressOutput(). Overrides FacetapiAdapter::suppressOutput