public function MachineNameTest::providerTestMachineNames in Drupal 9
Provides test cases for MachineNameTest::testMachineNames().
Return value
array An array of test cases.
File
- core/
modules/ migrate/ tests/ src/ Unit/ process/ MachineNameTest.php, line 71
Class
- MachineNameTest
- Tests the machine name process plugin.
Namespace
Drupal\Tests\migrate\Unit\processCode
public function providerTestMachineNames() : array {
return [
// Tests the following transformations:
// - non-alphanumeric character (including spaces) -> underscore,
// - Uppercase -> lowercase,
// - Multiple consecutive underscore -> single underscore.
'default' => [
'human_name' => 'foo2, the.bar;2*&the%baz!YEE____HaW áéő',
'configuration' => [],
'expected_result' => 'foo2_the_bar_2_the_baz_yee_haw_aeo',
],
// Tests with a different pattern that allows periods.
'period_allowed' => [
'human_name' => '2*&the%baz!YEE____HaW áéő.jpg',
'configuration' => [
'replace_pattern' => '/[^a-z0-9_.]+/',
],
'expected_result' => '2_the_baz_yee_haw_aeo.jpg',
],
];
}