You are here

protected function FeaturesUserTestCase::_test_filter in Features 6

Same name and namespace in other branches
  1. 7.2 tests/features.test \FeaturesUserTestCase::_test_filter()
  2. 7 tests/features.test \FeaturesUserTestCase::_test_filter()

File

tests/features.test, line 129

Class

FeaturesUserTestCase
User permission component tests for Features

Code

protected function _test_filter($op = 'load') {

  // So... relying on our own API functions to test is pretty lame.
  // But these modules don't have APIs either. So might as well use
  // the ones we've written for them...
  features_include();
  $formats = _filter_get_formats();
  foreach ($formats as $k => $v) {
    if ($v['name'] === 'features_test') {
      $format = $v;
      $format_id = $k;
    }
  }
  switch ($op) {
    case 'load':
      return isset($format) ? $format : FALSE;
    case 'override':
      if (isset($format_id)) {
        db_query("DELETE FROM {filters} WHERE module = 'filter' AND format = %d AND delta = %d", $format_id, 0);
      }
      break;
  }
}