You are here

public function FacetapiApiFunctions::testPropertyRequirements in Facet API 7

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

Tests the requirements system for property equality.

See also

facetapi_check_requirements()

facetapi_requirement_property()

facetapi_requirement_realm_property()

facetapi_requirement_facet_property()

File

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

Class

FacetapiApiFunctions
Test cases for low level API functions.

Code

public function testPropertyRequirements() {
  list($facet, $realm, $adapter) = $this
    ->facetapiLoadObjects();
  $requirements = array(
    'facetapi_requirement_facet_property' => array(
      'label' => t('Enabled facet'),
    ),
  );
  $passed = facetapi_check_requirements($requirements, $realm, $facet);
  $this
    ->assertTrue($passed, t('Requirements pass when a testing whether a facet property equals the same value.'), 'Facet API');
  $requirements = array(
    'facetapi_requirement_facet_property' => array(
      'label' => 'Does not match',
    ),
  );
  $passed = facetapi_check_requirements($requirements, $realm, $facet);
  $this
    ->assertFalse($passed, t('Requirements fail when a testing whether a facet property equals a different value.'), 'Facet API');
  $requirements = array(
    'facetapi_requirement_realm_property' => array(
      'label' => t('No display'),
    ),
  );
  $passed = facetapi_check_requirements($requirements, $realm, $facet);
  $this
    ->assertTrue($passed, t('Requirements pass when a testing whether a realm property equals the same value.'), 'Facet API');
  $requirements = array(
    'facetapi_requirement_realm_property' => array(
      'label' => 'Does not match',
    ),
  );
  $passed = facetapi_check_requirements($requirements, $realm, $facet);
  $this
    ->assertFalse($passed, t('Requirements fail when a testing whether a realm property equals a different value.'), 'Facet API');
}