You are here

function DrupalSolrOfflineUnitTestCase::testContentFilters in Apache Solr Search 6.3

Same name and namespace in other branches
  1. 8 tests/apachesolr_base.test \DrupalSolrOfflineUnitTestCase::testContentFilters()
  2. 7 tests/apachesolr_base.test \DrupalSolrOfflineUnitTestCase::testContentFilters()

Test ordering of parsed filter positions.

Regression test for http://drupal.org/node/891962

File

tests/apachesolr_base.test, line 684
Unit test class that provides tests for base functionality of the Apachesolr Module without having the need of a Solr Server

Class

DrupalSolrOfflineUnitTestCase

Code

function testContentFilters() {
  $cleaned = apachesolr_clean_text($this->script_content);
  $this
    ->assertFalse(strpos($cleaned, 'script'), 'Script tags removed');
  $this
    ->assertFalse(strpos($cleaned, 'accordion_teachers'), 'Script tags conent removed');
  $this
    ->assertTrue(strpos(trim($cleaned), 'GOOD_CONTENT') === 0, 'Real content retained');
  $cleaned = apachesolr_clean_text($this->embed_content);
  $this
    ->assertFalse(strpos($cleaned, 'object'), 'object tags removed');
  $this
    ->assertFalse(strpos($cleaned, 'embed'), 'embed tags removed');
  $this
    ->assertFalse(strpos($cleaned, '8Vmnq5dBF7Y'), 'object tags conent removed');
  $this
    ->assertFalse(strpos($cleaned, 'shockwave-flash'), 'embed tags conent removed');
  $this
    ->assertTrue(strpos(trim($cleaned), 'GOOD_CONTENT') === 0, 'Real content retained');
  $this
    ->assertTrue(strpos($cleaned, 'OTHER_CONTENT') > 0, 'Other content retained');
  $cleaned = apachesolr_clean_text($this->iframe_content);
  $this
    ->assertFalse(strpos($cleaned, 'iframe'), 'iframe tags removed');
  $this
    ->assertFalse(strpos($cleaned, '8Vmnq5dBF7Y'), 'iframe tags conent removed');
  $this
    ->assertTrue(strpos(trim($cleaned), 'GOOD_CONTENT') === 0, 'Real content retained');
  $cleaned = apachesolr_clean_text($this->comment_content);
  $this
    ->assertFalse(strpos($cleaned, 'COMMENT'), 'html comment content removed ');
  $this
    ->assertTrue(strpos(trim($cleaned), 'GOOD_CONTENT') === 0, 'Real content retained');
}