public function FacetapiApiFunctions::testUrlProcessorQueryString in Facet API 7
Same name and namespace in other branches
- 7.2 tests/facetapi.test \FacetapiApiFunctions::testUrlProcessorQueryString()
Test query string building via the url processor plugin.
See also
FacetapiUrlProcessor::getQueryString()
File
- tests/
facetapi.test, line 698 - Tests for the Facet API module.
Class
- FacetapiApiFunctions
- Test cases for low level API functions.
Code
public function testUrlProcessorQueryString() {
list($facet, $realm, $adapter) = $this
->facetapiLoadObjects();
facetapi_save_facet_enabled($adapter, $realm, $facet);
// Send params with facet data.
$params = array(
'f' => array(
'enabled:testone',
'enabled:testthree',
),
);
$adapter
->setParams($params);
$url_processor = $adapter
->getUrlProcessor();
// Tests activating an additional facet item.
$qstring = $url_processor
->getQueryString($facet, array(
'testtwo',
), 0);
$expected = array(
'f' => array(
'enabled:testone',
'enabled:testthree',
'enabled:testtwo',
),
);
$this
->assertEqual($qstring, $expected, t('Facet item is appended to the query string when activated.'), 'Facet API');
// Tests deactivating an additional facet item.
$qstring = $url_processor
->getQueryString($facet, array(
'testone',
), 1);
$expected = array(
'f' => array(
'enabled:testthree',
),
);
$this
->assertEqual($qstring, $expected, t('Facet item is removed from the query string when deactivated.'), 'Facet API');
}