function IconPackManagerTest::providerIconPackLibraryName

Data provider for ::testLibraryName().

Return value

array Provide test data as:

  • (string) Library name to test
  • (bool) Flag for validity

File

core/tests/Drupal/Tests/Core/Theme/Icon/IconPackManagerTest.php, line 36

Class

IconPackManagerTest
Tests Drupal\Core\Theme\Icon\Plugin\IconPackManager.

Namespace

Drupal\Tests\Core\Theme\Icon

Code

public static function providerIconPackLibraryName() : array {
  return [
    'valid name with underscore' => [
      'my_theme/my_library',
      TRUE,
    ],
    'valid name with hyphen' => [
      'my_theme/my-library',
      TRUE,
    ],
    'valid name with hyphen and numbers' => [
      'my_theme/my-long-library_with_mixed-hyphens123',
      TRUE,
    ],
    'invalid theme name case 1' => [
      'my-theme/my-library',
      FALSE,
    ],
    'invalid theme name case 2' => [
      'my-theme/my_library',
      FALSE,
    ],
    'Invalid library name case 1' => [
      'my_theme/my library',
      FALSE,
    ],
    'Invalid library name special characters' => [
      'my-theme/$#random!',
      FALSE,
    ],
  ];
}

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