=== modified file 'includes/common.inc' --- includes/common.inc 2008-10-29 22:46:24 +0000 +++ includes/common.inc 2008-10-29 22:46:52 +0000 @@ -1471,9 +1471,10 @@ $path = drupal_get_path_alias($path, isset($options['language']) ? $options['language']->language : ''); } - if (function_exists('custom_url_rewrite_outbound')) { + foreach (module_implements('url_rewrite_outbound') as $module) { // Modules may alter outbound links by reference. - custom_url_rewrite_outbound($path, $options, $original_path); + $function = $module . '_url_rewrite_outbound'; + $function($path, $options, $original_path); } $base = $options['absolute'] ? $options['base_url'] . '/' : base_path(); === modified file 'includes/path.inc' --- includes/path.inc 2008-10-29 22:46:24 +0000 +++ includes/path.inc 2008-10-29 22:46:52 +0000 @@ -131,9 +131,10 @@ if ($src = drupal_lookup_path('source', $path, $path_language)) { $result = $src; } - if (function_exists('custom_url_rewrite_inbound')) { + foreach (module_implements('url_rewrite_inbound') as $module) { // Modules may alter the inbound request path by reference. - custom_url_rewrite_inbound($result, $path, $path_language); + $function = $module . '_url_rewrite_inbound'; + $function($result, $path, $path_language); } return $result; } === modified file 'modules/simpletest/drupal_web_test_case.php' --- modules/simpletest/drupal_web_test_case.php 2008-10-29 22:46:24 +0000 +++ modules/simpletest/drupal_web_test_case.php 2008-10-29 23:04:20 +0000 @@ -771,7 +771,7 @@ $this->_logged_in = FALSE; // Reload module list to ensure that test module hooks aren't called after tests. - module_list(TRUE); + module_implements(MODULE_IMPLEMENTS_CLEAR_CACHE); // Rebuild caches. $this->refreshVariables(); === added file 'modules/simpletest/tests/hook_url_rewrite.info' --- modules/simpletest/tests/hook_url_rewrite.info 1970-01-01 00:00:00 +0000 +++ modules/simpletest/tests/hook_url_rewrite.info 2008-10-29 23:00:57 +0000 @@ -0,0 +1,8 @@ +; $Id$ +name = "Hook url_rewrite tests" +description = "Support module for url_rewrite hook testing." +package = Testing +version = VERSION +core = 7.x +files[] = hook_url_rewrite.module +hidden = TRUE === added file 'modules/simpletest/tests/hook_url_rewrite.module' --- modules/simpletest/tests/hook_url_rewrite.module 1970-01-01 00:00:00 +0000 +++ modules/simpletest/tests/hook_url_rewrite.module 2008-10-29 22:46:52 +0000 @@ -0,0 +1,27 @@ + t('Path rewriting'), + 'description' => t('Test hook_url_rewrite_inbound and hook_url_rewrite_outbound.'), + 'group' => t('Path'), + ); + } + + /** + * Implementation of setUp(). + */ + function setUp() { + // Enable dummy module that implements hook_url_rewrite_inbound and + // hook_url_rewrite_outbound. + parent::setUp('hook_url_rewrite'); + } + + /** + * Test url_rewrite hooks. + */ + function testHookUrlRewrite() { + // First get /user which is not rewritten. This should contain a link to + // user/password which should be rewritten to member/password. + $this->drupalGet('user'); + $this->assertPattern('::'); + + // Get the aliased path and check that the right page is returned. + $this->drupalGet('member/password'); + $this->assertText(t('Username or e-mail address:')); + } +}