Page MenuHomeIn-Portal Phabricator

INP-1079 - Routing Ideas
ClosedPublic

Authored by alex on May 8 2015, 3:54 AM.

Details

Test Plan
NOTE: Descendant tags of ItemLink tag (e.g. ProductLink) can be used in tests as well.

Mod-rewrite url engine (used for url building/parsing on Front-End) consists of following components:

  • MainRouter class - responsible for adding language, theme, template, category to the url
  • AbstractCategoryItemRouter class - responsible for category item filename to the url
  • AbstractReviewRouter - responsible for pagination on category item review lists
  • engine that connects all routers together to build/parse final url

Each of components needs to be tested separately and then all of them together.

Plan 1

  • /<path/to/primary-item-category>/<category-item-filename>.html
    1. default category item url, that can be found in category's item list
  • /<path/to/primary-item-category>/<category-item-filename>/<path/to/custom_template_name>.html
    1. category item url, that is using custom template (specified in template parameter of ItemLink tag)
    2. the /path/to/custom_template_name.tpl template is listed in .smsignore and that's why _ isn't converted to -
  • /<path/to/primary-item-category>/<category-item-filename>/<path/to/custom-template-name>.html
    1. category item url, that is using custom template (specified in template parameter of ItemLink tag)
    2. the /path/to/custom_template_name.tpl template is not listed in .smsignore and that's why _ is converted to -

Plan 2

  • when __default__ is specified in template parameter of ItemLink tag, then:
    1. category-specific item template should be used (can be found in Properties tab during top level category editing)
    2. template name isn't added to the url
  • when category-specific item template is specified in template parameter of ItemLink tag, then:
    1. template name isn't added to the url.
  • url to link/article/product uses Filename column as last component
  • url to topic uses bb_{TopicId} (e.g. bb_43434) as last component (create 2 level category structure and place topics on last level)
  • when __default__ is specified in template parameter of CategoryLink tag, then:
    1. category-specific list template should be used (specified in "Template" field of the category)
    2. template name isn't added to the url
  • when category-specific list template is specified in template parameter of CategoryLink tag, then:
    1. template name isn't added to the url.
  • when template parameter of ItemLink or CategoryLink or m_Link tag contains some other (not list and not item category-specific) template, then template should be added to the end of url
  • when there are 10+ category items in the category confirm, that:
    1. page links (in pagination control) contains "?page=N" parameter (N is page number) only, when N isn't 1
    2. page links (in pagination control) contains "?per_page=M" parameter (M is item count per page) only, when M isn't 10 (change per page using on page control to see how pagination links change)
  • when there are 10+ category item reviews (you can add reviews on Front-End or in Admin Console) on category item detail page confirm, that:
    1. page links (in pagination control) contains "?page=N" parameter (N is page number) only, when N isn't 1
    2. page links (in pagination control) contains "?per_page=M" parameter (M is item count per page) only, when M isn't 10 (change per page using on page control to see how pagination links change)
  • category item detail page opens and proper category item is shown (also for topics)
  • adding a post to the topic will bring user back to topic page, that will include category and topic id
  • if category, in category item link, is changed to another existing category, then 404 page should be found (because item's filename doesn't match to the category)
  • if category, in category item link, is changed to another non-existing category, then 404 page should be found (because category doesn't exist)
  • if category, in category link, is changed to another non-existing category, then 404 page should be found (because category doesn't exist)

Plan 3 - language.

  1. create 1 enabled language (Name=Russian, PackName=RusPack)
  2. create 1 disabled language (Name=Latvian, PackName=LatPack)
  3. change language from English to Russian
  4. confirm, that /ruspack/ is added in front of the url
  5. change language from Russian to English
  6. confirm, that /ruspack/ was removed from url
  7. add /latpack/ in front of the url
  8. confirm, that 404 page is shown (because it's disabled language)
  9. add /russian/ in front of the url
  10. confirm, that 404 page is shown (because only PackName column is used for url building)
  11. add "/english/" to url
  12. confirm, that that language is used, but all links on the page doesn't include "/english/" because it's primary language

Plan 4 - theme.

  1. there should already be enabled "advanced" theme and disabled "simple" and "default" themes
  2. enable "default" theme
  3. add "/default/" in front of the url
  4. confirm, that "default" theme is shown
  5. remove "/default/" from the url
  6. confirm, that primary theme is shown
  7. add /simple/ in front of the url
  8. confirm, that 404 page is shown (because it's disabled theme)
  9. add /wow/ in front of the url
  10. confirm, that 404 page is shown (because only it's non-existing theme)
  11. add "/advanced/" to url
  12. confirm, that that theme is shown, but all links on the page doesn't include "/advanced/" because it's primary theme
  13. type url like this /ruspack/default/ (including domain of course)
  14. confirm that both language and theme were detected and are included in all built links on the page

Plan 5 - categories.

  1. open 2nd level category page
  2. in it's template place the <inp2:m_Link template="any_existing_template"/>
  3. confirm, that current category isn't included in the url
  4. in it's template place the <inp2:m_Link template="any_existing_template" pass_category="1"/>
  5. confirm, that current category is included in the url
  6. in it's template place the <inp2:m_Link template="X"/>, where "X" is category path from url (e.g. "path/to/sub-category")
  7. confirm, that category path isn't listed twice in the url
  8. in it's template place the <inp2:m_Link template="X" pass_category="1"/>, where "X" is category path from url (e.g. "path/to/sub-category")
  9. confirm, that category path isn't listed twice in the url
  10. open category page, that has 10+ sub-categories
  11. confirm, that pagination links end up with _N.html, where N is page number (only if N > 1)
  12. confirm, that pagination links works (you stay in same category and see different sub-categories)
  13. in it's template place the <inp2:m_Link template="__default__" m_cat_page="5"/>
  14. confirm, that link contains "_5.html" at the end
  15. in it's template place the <inp2:m_Link template="__default__" m_cat_page="5" reset="1"/>
  16. confirm, that link contains "_1.html" at the end
  17. on any template place <inp2:m_Link template="index"/>
  18. confirm that build url doesn't contain /index.html
  19. on any template place <inp2:m_Link template="index" m_lang="X"/> (X is ID of non-primary enabled language)
  20. confirm that build url doesn't contain /index.html
  21. edit any category in admin console and set "Short URL" to it
  22. on front-end type that url (can contain "/" too)
  23. confirm proper category content is shown and url stayed as you typed
  24. type "Short URL" without last letter
  25. confirm, that 404 page is shown
  26. in admin console specify CategoryA as CategoryB symlink
  27. on front-end open CategoryA
  28. confirm, that you're seeing contents from CategoryB despite it's CategoryA in the url

Plan 6 - widgets.

  1. add some (>1) widgets in admin console
  2. create /widgets/ folder in theme
  3. create /widgets/detail.tpl with <inp2:widget_Field name="Title"/> tag on it
  4. create /widgets/detail_custom.tpl with <inp2:widget_Field name="Title"/> tag on it
  5. create /widgets/index.tpl template in theme that would:
    • use <inp2:widget_PrintList .../> tag to output widgets (no pagination needed)
    • the <inp2:ItemLink template="widgets/detail" pass="m,$PrefixSpecial"/> tag to build a link to a widget
    • the <inp2:ItemLink template="widgets/detail_custom" pass="m,$PrefixSpecial"/> tag to build a link to a widget
  6. confirm, that:
    • widgets are displayed
    • 1st widget link looks like `/widgets/<widget-title>.html
    • 2nd widget link looks like `/widgets/<widget-title>/widgets/detail_custom.html
    • both links open corresponding templates
    • detail pages shows it's title

Diff Detail

Repository
rINP In-Portal
Branch
/in-portal/branches/5.3.x
Lint
Lint ErrorsExcuse: Won't be fixing licensing DocBlocks this time
Unit
No Unit Test Coverage

Event Timeline

alex updated this revision to Diff 175.May 8 2015, 3:54 AM
alex retitled this revision from to INP-1079 - Routing Ideas.
alex updated this object.
alex edited the test plan for this revision. (Show Details)
alex added 1 JIRA issue(s): INP-1079.
alex updated this revision to Diff 176.May 8 2015, 4:11 AM
alex edited edge metadata.

Included changes to application.php and cache_manager.php that were missing from previous diff.

alex edited the test plan for this revision. (Show Details)May 8 2015, 5:13 AM
alex edited the test plan for this revision. (Show Details)May 8 2015, 5:32 AM
glebs accepted this revision.May 12 2015, 2:44 AM
glebs edited edge metadata.
This revision is now accepted and ready to land.May 12 2015, 2:44 AM
This revision was automatically updated to reflect the committed changes.