You are here

public function SanitizeNameTest::providerSanitizeName in Transliterate filenames for uploads 8

Provides data for self::testSanitizeName().

File

tests/src/Unit/SanitizeNameTest.php, line 46

Class

SanitizeNameTest
@coversDefaultClass \Drupal\transliterate_filenames\SanitizeName @group transliterate_filenames

Namespace

Drupal\Tests\transliterate_filenames\Unit

Code

public function providerSanitizeName() {
  return [
    // Transliterate Non-US-ASCII.
    [
      'ąęółżźćśń.pdf',
      'aeolzzcsn.pdf',
    ],
    // Remove unknown unicodes.
    [
      chr(0xf8) . chr(0x80) . chr(0x80) . '.txt',
      '.txt',
    ],
    // Force lowercase.
    [
      'LOWERCASE.txt',
      'lowercase.txt',
    ],
    // Replace whitespace.
    [
      'test whitespace.txt',
      'test-whitespace.txt',
    ],
    [
      'test   whitespace.txt',
      'test-whitespace.txt',
    ],
    // Remove multiple consecutive non-alphabetical characters.
    [
      '---___.txt',
      '-_.txt',
    ],
    [
      '--  --.txt',
      '-.txt',
    ],
  ];
}