diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -275,6 +275,7 @@ 'AphrontResponse' => 'aphront/response/AphrontResponse.php', 'AphrontResponseProducerInterface' => 'aphront/interface/AphrontResponseProducerInterface.php', 'AphrontRoutingMap' => 'aphront/site/AphrontRoutingMap.php', + 'AphrontRoutingMapTestCase' => 'aphront/__tests__/AphrontRoutingMapTestCase.php', 'AphrontRoutingResult' => 'aphront/site/AphrontRoutingResult.php', 'AphrontSchemaQueryException' => 'infrastructure/storage/exception/AphrontSchemaQueryException.php', 'AphrontScopedUnguardedWriteCapability' => 'aphront/writeguard/AphrontScopedUnguardedWriteCapability.php', @@ -6283,6 +6284,7 @@ 'AphrontRequestTestCase' => 'PhabricatorTestCase', 'AphrontResponse' => 'Phobject', 'AphrontRoutingMap' => 'Phobject', + 'AphrontRoutingMapTestCase' => 'PhabricatorTestCase', 'AphrontRoutingResult' => 'Phobject', 'AphrontSchemaQueryException' => 'AphrontQueryException', 'AphrontScopedUnguardedWriteCapability' => 'Phobject', diff --git a/src/aphront/__tests__/AphrontRoutingMapTestCase.php b/src/aphront/__tests__/AphrontRoutingMapTestCase.php new file mode 100644 --- /dev/null +++ b/src/aphront/__tests__/AphrontRoutingMapTestCase.php @@ -0,0 +1,85 @@ +getRoutingMaps(); + foreach ($maps as $map) { + foreach ($map->getRoutes() as $rule => $value) { + $this->assertRoutable($site, $map, array(), $rule, $value); + $count++; + } + } + } + + if (!$count) { + $this->assertSkipped( + pht('No sites define any routing rules.')); + } + } + + private function assertRoutable( + AphrontSite $site, + AphrontRoutingMap $map, + array $path, + $rule, + $value) { + + $path[] = $rule; + + $site_description = $site->getDescription(); + $rule_path = implode(' > ', $path); + + $pattern = implode('', $path); + $pattern = '('.$pattern.')'; + $ok = @preg_match($pattern, ''); + + $this->assertTrue( + ($ok !== false), + pht( + 'Routing rule ("%s", for site "%s") does not compile into a '. + 'valid regular expression.', + $rule_path, + $site_description)); + + if (is_array($value)) { + $this->assertTrue( + (count($value) > 0), + pht( + 'Routing rule ("%s", for site "%s") does not have any targets.', + $rule_path, + $site_description)); + + foreach ($value as $sub_rule => $sub_value) { + $this->assertRoutable($site, $map, $path, $sub_rule, $sub_value); + } + return; + } + + if (is_string($value)) { + $this->assertTrue( + class_exists($value), + pht( + 'Routing rule ("%s", for site "%s") points at controller ("%s") '. + 'which does not exist.', + $rule_path, + $site_description, + $value)); + return; + } + + $this->assertFailure( + pht( + 'Routing rule ("%s", for site "%s") points at unknown value '. + '(of type "%s"), expected a controller class name string.', + $rule_path, + $site_description, + phutil_describe_type($value))); + } + +} diff --git a/src/applications/config/application/PhabricatorConfigApplication.php b/src/applications/config/application/PhabricatorConfigApplication.php --- a/src/applications/config/application/PhabricatorConfigApplication.php +++ b/src/applications/config/application/PhabricatorConfigApplication.php @@ -38,11 +38,7 @@ return array( '/config/' => array( '' => 'PhabricatorConfigConsoleController', - 'application/' => 'PhabricatorConfigApplicationController', - 'all/' => 'PhabricatorConfigAllController', - 'history/' => 'PhabricatorConfigHistoryController', 'edit/(?P[\w\.\-]+)/' => 'PhabricatorConfigEditController', - 'group/(?P[^/]+)/' => 'PhabricatorConfigGroupController', 'database/'. '(?:(?P[^/]+)/'. '(?:(?P[^/]+)/'. diff --git a/src/applications/countdown/application/PhabricatorCountdownApplication.php b/src/applications/countdown/application/PhabricatorCountdownApplication.php --- a/src/applications/countdown/application/PhabricatorCountdownApplication.php +++ b/src/applications/countdown/application/PhabricatorCountdownApplication.php @@ -42,8 +42,6 @@ '/countdown/' => array( '(?:query/(?P[^/]+)/)?' => 'PhabricatorCountdownListController', - 'comment/(?P[1-9]\d*)/' - => 'PhabricatorCountdownCommentController', $this->getEditRoutePattern('edit/') => 'PhabricatorCountdownEditController', ), diff --git a/src/applications/differential/application/PhabricatorDifferentialApplication.php b/src/applications/differential/application/PhabricatorDifferentialApplication.php --- a/src/applications/differential/application/PhabricatorDifferentialApplication.php +++ b/src/applications/differential/application/PhabricatorDifferentialApplication.php @@ -76,11 +76,7 @@ => 'DifferentialRevisionInlinesController', ), 'comment/' => array( - 'preview/(?P[1-9]\d*)/' => 'DifferentialCommentPreviewController', - 'save/(?P[1-9]\d*)/' => 'DifferentialCommentSaveController', 'inline/' => array( - 'preview/(?P[1-9]\d*)/' - => 'DifferentialInlineCommentPreviewController', 'edit/(?P[1-9]\d*)/' => 'DifferentialInlineCommentEditController', ), diff --git a/src/applications/files/application/PhabricatorFilesApplication.php b/src/applications/files/application/PhabricatorFilesApplication.php --- a/src/applications/files/application/PhabricatorFilesApplication.php +++ b/src/applications/files/application/PhabricatorFilesApplication.php @@ -81,7 +81,6 @@ 'upload/' => 'PhabricatorFileUploadController', 'dropupload/' => 'PhabricatorFileDropUploadController', 'compose/' => 'PhabricatorFileComposeController', - 'comment/(?P[1-9]\d*)/' => 'PhabricatorFileCommentController', 'thread/(?P[^/]+)/' => 'PhabricatorFileLightboxController', 'delete/(?P[1-9]\d*)/' => 'PhabricatorFileDeleteController', $this->getEditRoutePattern('edit/') diff --git a/src/applications/harbormaster/application/PhabricatorHarbormasterApplication.php b/src/applications/harbormaster/application/PhabricatorHarbormasterApplication.php --- a/src/applications/harbormaster/application/PhabricatorHarbormasterApplication.php +++ b/src/applications/harbormaster/application/PhabricatorHarbormasterApplication.php @@ -81,7 +81,6 @@ $this->getQueryRoutePattern() => 'HarbormasterPlanListController', $this->getEditRoutePattern('edit/') => 'HarbormasterPlanEditController', - 'order/(?:(?P\d+)/)?' => 'HarbormasterPlanOrderController', 'disable/(?P\d+)/' => 'HarbormasterPlanDisableController', 'behavior/(?P\d+)/(?P[^/]+)/' => 'HarbormasterPlanBehaviorController', diff --git a/src/applications/people/application/PhabricatorPeopleApplication.php b/src/applications/people/application/PhabricatorPeopleApplication.php --- a/src/applications/people/application/PhabricatorPeopleApplication.php +++ b/src/applications/people/application/PhabricatorPeopleApplication.php @@ -81,8 +81,6 @@ ), '/p/(?P[\w._-]+)/' => array( '' => 'PhabricatorPeopleProfileViewController', - 'item/' => $this->getProfileMenuRouting( - 'PhabricatorPeopleProfileMenuController'), ), ); } diff --git a/src/applications/phame/application/PhabricatorPhameApplication.php b/src/applications/phame/application/PhabricatorPhameApplication.php --- a/src/applications/phame/application/PhabricatorPhameApplication.php +++ b/src/applications/phame/application/PhabricatorPhameApplication.php @@ -49,7 +49,6 @@ 'view/(?P\d+)/(?:(?P[^/]+)/)?' => 'PhamePostViewController', '(?Ppublish|unpublish)/(?P\d+)/' => 'PhamePostPublishController', - 'preview/(?P\d+)/' => 'PhamePostPreviewController', 'preview/' => 'PhabricatorMarkupPreviewController', 'move/(?P\d+)/' => 'PhamePostMoveController', 'archive/(?P\d+)/' => 'PhamePostArchiveController', @@ -66,20 +65,7 @@ 'picture/(?P[1-9]\d*)/' => 'PhameBlogProfilePictureController', 'header/(?P[1-9]\d*)/' => 'PhameBlogHeaderPictureController', ), - ) + $this->getResourceSubroutes(), - ); - } - - public function getResourceRoutes() { - return array( - '/phame/' => $this->getResourceSubroutes(), - ); - } - - private function getResourceSubroutes() { - return array( - 'r/(?P\d+)/(?P[^/]+)/(?P.*)' => - 'PhameResourceController', + ), ); } diff --git a/src/applications/phortune/application/PhabricatorPhortuneApplication.php b/src/applications/phortune/application/PhabricatorPhortuneApplication.php --- a/src/applications/phortune/application/PhabricatorPhortuneApplication.php +++ b/src/applications/phortune/application/PhabricatorPhortuneApplication.php @@ -101,11 +101,8 @@ 'product/' => array( '' => 'PhortuneProductListController', 'view/(?P\d+)/' => 'PhortuneProductViewController', - 'edit/(?:(?P\d+)/)?' => 'PhortuneProductEditController', ), 'provider/' => array( - 'edit/(?:(?P\d+)/)?' => 'PhortuneProviderEditController', - 'disable/(?P\d+)/' => 'PhortuneProviderDisableController', '(?P\d+)/(?P[^/]+)/' => 'PhortuneProviderActionController', ), diff --git a/src/applications/search/application/PhabricatorSearchApplication.php b/src/applications/search/application/PhabricatorSearchApplication.php --- a/src/applications/search/application/PhabricatorSearchApplication.php +++ b/src/applications/search/application/PhabricatorSearchApplication.php @@ -30,7 +30,6 @@ return array( '/search/' => array( '(?:query/(?P[^/]+)/)?' => 'PhabricatorSearchController', - 'index/(?P[^/]+)/' => 'PhabricatorSearchIndexController', 'hovercard/' => 'PhabricatorSearchHovercardController', 'handle/(?P[^/]+)/'