function SearchSimplifyTest::testSearchSimplifyPunctuation

Tests that search_simplify() does the right thing with punctuation.

File

drupal/core/modules/search/lib/Drupal/search/Tests/SearchSimplifyTest.php, line 77
Definition of Drupal\search\Tests\SearchSimplifyTest.

Class

SearchSimplifyTest
Test search_simplify() on every Unicode character, and some other cases.

Namespace

Drupal\search\Tests

Code

function testSearchSimplifyPunctuation() {
  $cases = array(
    array(
      '20.03/94-28,876',
      '20039428876',
      'Punctuation removed from numbers',
    ),
    array(
      'great...drupal--module',
      'great drupal module',
      'Multiple dot and dashes are word boundaries',
    ),
    array(
      'very_great-drupal.module',
      'verygreatdrupalmodule',
      'Single dot, dash, underscore are removed',
    ),
    array(
      'regular,punctuation;word',
      'regular punctuation word',
      'Punctuation is a word boundary',
    ),
  );
  foreach ($cases as $case) {
    $out = trim(search_simplify($case[0]));
    $this
      ->assertEqual($out, $case[1], $case[2]);
  }
}