You are here

public function KeywordFilterTest::providerKeywordFilter in Tamper 8

Data provider for testKeywordFilter().

File

tests/src/Unit/Plugin/Tamper/KeywordFilterTest.php, line 34

Class

KeywordFilterTest
Tests the keyword filter plugin.

Namespace

Drupal\Tests\tamper\Unit\Plugin\Tamper

Code

public function providerKeywordFilter() {
  return [
    'StriPosFilter' => [
      '',
      [
        KeywordFilter::WORDS => 'booya',
        KeywordFilter::WORD_BOUNDARIES => FALSE,
        KeywordFilter::EXACT => FALSE,
        KeywordFilter::CASE_SENSITIVE => FALSE,
        KeywordFilter::INVERT => FALSE,
        KeywordFilter::WORD_LIST => [
          'booya',
        ],
        KeywordFilter::REGEX => FALSE,
        KeywordFilter::FUNCTION => 'stripos',
      ],
    ],
    'StriPosPass' => [
      'This is atitle',
      [
        KeywordFilter::WORDS => 'this',
        KeywordFilter::WORD_BOUNDARIES => FALSE,
        KeywordFilter::EXACT => FALSE,
        KeywordFilter::CASE_SENSITIVE => FALSE,
        KeywordFilter::INVERT => FALSE,
        KeywordFilter::WORD_LIST => [
          'this',
        ],
        KeywordFilter::REGEX => FALSE,
        KeywordFilter::FUNCTION => 'stripos',
      ],
    ],
    'StrPosFilter' => [
      '',
      [
        KeywordFilter::WORDS => 'this',
        KeywordFilter::WORD_BOUNDARIES => FALSE,
        KeywordFilter::EXACT => FALSE,
        KeywordFilter::CASE_SENSITIVE => TRUE,
        KeywordFilter::INVERT => FALSE,
        KeywordFilter::WORD_LIST => [
          'this',
        ],
        KeywordFilter::REGEX => FALSE,
        KeywordFilter::FUNCTION => 'strpos',
      ],
    ],
    'ExactFilter' => [
      '',
      [
        KeywordFilter::WORDS => '/^a title$/ui',
        KeywordFilter::WORD_BOUNDARIES => TRUE,
        KeywordFilter::EXACT => TRUE,
        KeywordFilter::CASE_SENSITIVE => FALSE,
        KeywordFilter::INVERT => FALSE,
        KeywordFilter::WORD_LIST => [
          '/^a title$/ui',
        ],
        KeywordFilter::REGEX => TRUE,
        KeywordFilter::FUNCTION => 'matchRegex',
      ],
    ],
    'ExactFilterDataNotExact' => [
      '',
      [
        KeywordFilter::WORDS => '/^This is a Title$/ui',
        KeywordFilter::WORD_BOUNDARIES => FALSE,
        KeywordFilter::EXACT => TRUE,
        KeywordFilter::CASE_SENSITIVE => FALSE,
        KeywordFilter::INVERT => FALSE,
        KeywordFilter::WORD_LIST => [
          '/^This is a Title$/ui',
        ],
        KeywordFilter::REGEX => TRUE,
        KeywordFilter::FUNCTION => 'matchRegex',
      ],
    ],
    'WordBoundariesFilter' => [
      '',
      [
        KeywordFilter::WORDS => '/\\btitle\\b/ui',
        KeywordFilter::WORD_BOUNDARIES => TRUE,
        KeywordFilter::EXACT => FALSE,
        KeywordFilter::CASE_SENSITIVE => FALSE,
        KeywordFilter::INVERT => FALSE,
        KeywordFilter::WORD_LIST => [
          '/\\btitle\\b/ui',
        ],
        KeywordFilter::REGEX => TRUE,
        KeywordFilter::FUNCTION => 'matchRegex',
      ],
    ],
    'InvertEnablingResult' => [
      'This is atitle',
      [
        KeywordFilter::WORDS => 'booya',
        KeywordFilter::WORD_BOUNDARIES => FALSE,
        KeywordFilter::EXACT => FALSE,
        KeywordFilter::CASE_SENSITIVE => FALSE,
        KeywordFilter::INVERT => TRUE,
        KeywordFilter::WORD_LIST => [
          'booya',
        ],
        KeywordFilter::REGEX => FALSE,
        KeywordFilter::FUNCTION => 'stripos',
      ],
    ],
    'InvertFilteringResult' => [
      '',
      [
        KeywordFilter::WORDS => 'this',
        KeywordFilter::WORD_BOUNDARIES => FALSE,
        KeywordFilter::EXACT => FALSE,
        KeywordFilter::CASE_SENSITIVE => FALSE,
        KeywordFilter::INVERT => TRUE,
        KeywordFilter::WORD_LIST => [
          'this',
        ],
        KeywordFilter::REGEX => FALSE,
        KeywordFilter::FUNCTION => 'stripos',
      ],
    ],
    'InvertEnablingFailedCaseResult' => [
      'This is atitle',
      [
        KeywordFilter::WORDS => 'this',
        KeywordFilter::WORD_BOUNDARIES => FALSE,
        KeywordFilter::EXACT => FALSE,
        KeywordFilter::CASE_SENSITIVE => TRUE,
        KeywordFilter::INVERT => TRUE,
        KeywordFilter::WORD_LIST => [
          'this',
        ],
        KeywordFilter::REGEX => FALSE,
        KeywordFilter::FUNCTION => 'strpos',
      ],
    ],
    'InvertEnablingFailedExactResult' => [
      'This is atitle',
      [
        KeywordFilter::WORDS => '/^a title$/ui',
        KeywordFilter::WORD_BOUNDARIES => TRUE,
        KeywordFilter::EXACT => TRUE,
        KeywordFilter::CASE_SENSITIVE => FALSE,
        KeywordFilter::INVERT => TRUE,
        KeywordFilter::WORD_LIST => [
          '/^a title$/ui',
        ],
        KeywordFilter::REGEX => TRUE,
        KeywordFilter::FUNCTION => 'matchRegex',
      ],
    ],
    'InvertFilteringPassedExactResult' => [
      'This is atitle',
      [
        KeywordFilter::WORDS => '/^This is a title$/ui',
        KeywordFilter::WORD_BOUNDARIES => TRUE,
        KeywordFilter::EXACT => TRUE,
        KeywordFilter::CASE_SENSITIVE => FALSE,
        KeywordFilter::INVERT => TRUE,
        KeywordFilter::WORD_LIST => [
          '/^This is a title$/ui',
        ],
        KeywordFilter::REGEX => TRUE,
        KeywordFilter::FUNCTION => 'matchRegex',
      ],
    ],
    'InvertWordBoundariesFilter' => [
      'This is atitle',
      [
        KeywordFilter::WORDS => '/\\btitle\\b/ui',
        KeywordFilter::WORD_BOUNDARIES => TRUE,
        KeywordFilter::EXACT => FALSE,
        KeywordFilter::CASE_SENSITIVE => FALSE,
        KeywordFilter::INVERT => TRUE,
        KeywordFilter::WORD_LIST => [
          '/\\btitle\\b/ui',
        ],
        KeywordFilter::REGEX => TRUE,
        KeywordFilter::FUNCTION => 'matchRegex',
      ],
    ],
  ];
}