You are here

public function HtmlFilterTest::altConfigurationDataProvider in Search API 8

Data provider method for testAltConfiguration().

Return value

array An array of argument arrays for testAltConfiguration().

File

tests/src/Unit/Processor/HtmlFilterTest.php, line 107

Class

HtmlFilterTest
Tests the "HTML filter" processor.

Namespace

Drupal\Tests\search_api\Unit\Processor

Code

public function altConfigurationDataProvider() {
  return [
    [
      'word',
      [
        Utility::createTextToken('word'),
      ],
      FALSE,
    ],
    [
      'word',
      [
        Utility::createTextToken('word'),
      ],
      TRUE,
    ],
    [
      '<img src="href" />word',
      [
        Utility::createTextToken('word'),
      ],
      TRUE,
    ],
    [
      '<img alt="ALT"/> word',
      [
        Utility::createTextToken('ALT', 2),
        Utility::createTextToken('word'),
      ],
      TRUE,
    ],
    [
      '<img alt="ALT" /> word',
      [
        Utility::createTextToken('word'),
      ],
      FALSE,
    ],
    [
      '<img data-alt="ALT"/> word',
      [
        Utility::createTextToken('word'),
      ],
      TRUE,
    ],
    [
      '<img src="href" alt="ALT" title="Bar" /> word </a>',
      [
        Utility::createTextToken('ALT', 2),
        Utility::createTextToken('word'),
      ],
      TRUE,
    ],
    // Test fault tolerance.
    [
      'a < b',
      [
        Utility::createTextToken('a < b'),
      ],
      TRUE,
    ],
  ];
}