1.20.x path_pattern.test | PathPatternUnitTestCase::testCleanAlias() |
Test path_clean_alias().
File
- modules/
path/ tests/ path_pattern.test, line 226 - Functionality tests for automatic path generation.
Class
- PathPatternUnitTestCase
- Unit tests for Path pattern functions.
Code
function testCleanAlias() {
$tests = array();
$tests['one/two/three'] = 'one/two/three';
$tests['/one/two/three/'] = 'one/two/three';
$tests['one//two///three'] = 'one/two/three';
$tests['one/two--three/-/--/-/--/four---five'] = 'one/two-three/four-five';
$tests['one/-//three--/four'] = 'one/three/four';
foreach ($tests as $input => $expected) {
$output = path_clean_alias($input);
$this->assertEqual($output, $expected, format_string("path_clean_alias('@input') expected '@expected', actual '@output'", array('@input' => $input, '@expected' => $expected, '@output' => $output)));
}
}