You are here

public function FacetapiApiFunctions::testFacetEnabled in Facet API 7

Same name and namespace in other branches
  1. 7.2 tests/facetapi.test \FacetapiApiFunctions::testFacetEnabled()

Tests the facetapi_facet_enabled() function.

See also

facetapi_facet_enabled()

File

tests/facetapi.test, line 362
Tests for the Facet API module.

Class

FacetapiApiFunctions
Test cases for low level API functions.

Code

public function testFacetEnabled() {
  list($facet, $realm, $adapter) = $this
    ->facetapiLoadObjects();

  // Ensure the facet is disabled, which it is by default.
  $enabled = facetapi_facet_enabled('facetapi_test', 'nodisplay', 'enabled');
  $this
    ->assertFalse($enabled, t('Facet flagged as disabled by facetapi_facet_enabled().'), 'Facet API');

  // Enable the facet, ensure the API function flags it as enabled.
  facetapi_save_facet_enabled($adapter, $realm, $facet);
  $enabled = facetapi_facet_enabled('facetapi_test', 'nodisplay', 'enabled');
  $this
    ->assertTrue($enabled, t('Facet flagged as enabled by facetapi_facet_enabled().'), 'Facet API');
}