function IconFinderTest::providerExtractIconIdFromFilename

Data provider for ::testExtractIconIdFromFilename().

Return value

\Generator The test cases.

File

core/tests/Drupal/Tests/Core/Theme/Icon/IconFinderTest.php, line 712

Class

IconFinderTest
Tests Drupal\Core\Theme\Icon\IconFinder.

Namespace

Drupal\Tests\Core\Theme\Icon

Code

public static function providerExtractIconIdFromFilename() : iterable {
  yield 'no pattern' => [
    'foo bar baz',
    '',
    'foo bar baz',
  ];
  yield 'no pattern and wildcard' => [
    'foo*bar*baz',
    '',
    'foo*bar*baz',
  ];
  yield 'simple pattern' => [
    'foo bar baz',
    'foo {icon_id} baz',
    'bar',
  ];
  yield 'simple pattern and wildcard included' => [
    'foo*bar*baz',
    'foo{icon_id}baz',
    '*bar*',
  ];
  yield 'wrong pattern' => [
    'foo bar baz',
    'foo {ico_id} baz',
    'foo bar baz',
  ];
  yield 'pattern with special chars' => [
    'foO1o,-O 5 (B,ar)_b-az',
    'fo{icon_id}az',
    'O1o,-O 5 (B,ar)_b-',
  ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.