function PathautoUnitTestCase::testCleanAlias in Pathauto 7
Same name and namespace in other branches
- 6.2 pathauto.test \PathautoUnitTestCase::testCleanAlias()
Test pathauto_clean_alias().
File
- ./
pathauto.test, line 202 - Functionality tests for Pathauto.
Class
- PathautoUnitTestCase
- Unit tests for Pathauto 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 = pathauto_clean_alias($input);
$this
->assertEqual($output, $expected, t("pathauto_clean_alias('@input') expected '@expected', actual '@output'", array(
'@input' => $input,
'@expected' => $expected,
'@output' => $output,
)));
}
}