public function UtilityTest::testSanitizeMachineName in Menu Item Extras 8.2
Test string sanitizing.
File
- tests/
src/ Unit/ UtilityTest.php, line 20
Class
- UtilityTest
- Class UtilityTest.
Namespace
Drupal\Tests\menu_item_extras\UnitCode
public function testSanitizeMachineName() {
$matrix = [
'test_1_suggestion_' => 'test-1.suggestion ',
'test__2__suggestion' => 'test -2- suggestion*',
'test__3__suggestion' => 'tes!t_-_-_ @# - -3- =%---/ suggestion*',
];
foreach ($matrix as $expected => $input) {
$this
->assertEquals($expected, Utility::sanitizeMachineName($input), "\"{$input}\" sanitized not properly");
}
}