You are here

public function FacetapiAdapterTestCase::testSetParams in Facet API 6.3

File

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

Class

FacetapiAdapterTestCase

Code

public function testSetParams() {

  // Sets dummy parameters.
  $adapter = facetapi_adapter_load('facetapi_test');
  $url = facetapi_parse_url('http://example.com/index.php?q=test&page=1&f[0]=bundle:page');
  $adapter
    ->setParams($url['query']);

  // Ensures that the "q" and "page" variables are stripped.
  $params = $adapter
    ->getUrlProcessor()
    ->getParams();
  $this
    ->assertTrue(!isset($params['q']), t('The "q" variable is stripped by FacetapiAdapter::setParams().'));
  $this
    ->assertTrue(!isset($params['page']), t('The "page" variable is stripped by FacetapiAdapter::setParams().'));

  // Tests that the "bundle:page" variable is set.
  $value = isset($params['f'][0]) && 'bundle:page' == $params['f'][0];
  $this
    ->assertTrue($value, t('Facet value captured via FacetapiAdapter::setParams().'));
}