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
- 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
- category item url, that is using custom template (specified in template parameter of ItemLink tag)
- 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
- category item url, that is using custom template (specified in template parameter of ItemLink tag)
- 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:
- category-specific item template should be used (can be found in Properties tab during top level category editing)
- template name isn't added to the url
- when category-specific item template is specified in template parameter of ItemLink tag, then:
- 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:
- category-specific list template should be used (specified in "Template" field of the category)
- template name isn't added to the url
- when category-specific list template is specified in template parameter of CategoryLink tag, then:
- 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:
- page links (in pagination control) contains "?page=N" parameter (N is page number) only, when N isn't 1
- 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:
- page links (in pagination control) contains "?page=N" parameter (N is page number) only, when N isn't 1
- 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.
- create 1 enabled language (Name=Russian, PackName=RusPack)
- create 1 disabled language (Name=Latvian, PackName=LatPack)
- change language from English to Russian
- confirm, that /ruspack/ is added in front of the url
- change language from Russian to English
- confirm, that /ruspack/ was removed from url
- add /latpack/ in front of the url
- confirm, that 404 page is shown (because it's disabled language)
- add /russian/ in front of the url
- confirm, that 404 page is shown (because only PackName column is used for url building)
- add "/english/" to url
- confirm, that that language is used, but all links on the page doesn't include "/english/" because it's primary language
Plan 4 - theme.
- there should already be enabled "advanced" theme and disabled "simple" and "default" themes
- enable "default" theme
- add "/default/" in front of the url
- confirm, that "default" theme is shown
- remove "/default/" from the url
- confirm, that primary theme is shown
- add /simple/ in front of the url
- confirm, that 404 page is shown (because it's disabled theme)
- add /wow/ in front of the url
- confirm, that 404 page is shown (because only it's non-existing theme)
- add "/advanced/" to url
- confirm, that that theme is shown, but all links on the page doesn't include "/advanced/" because it's primary theme
- type url like this /ruspack/default/ (including domain of course)
- confirm that both language and theme were detected and are included in all built links on the page
Plan 5 - categories.
- open 2nd level category page
- in it's template place the <inp2:m_Link template="any_existing_template"/>
- confirm, that current category isn't included in the url
- in it's template place the <inp2:m_Link template="any_existing_template" pass_category="1"/>
- confirm, that current category is included in the url
- in it's template place the <inp2:m_Link template="X"/>, where "X" is category path from url (e.g. "path/to/sub-category")
- confirm, that category path isn't listed twice in the url
- 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")
- confirm, that category path isn't listed twice in the url
- open category page, that has 10+ sub-categories
- confirm, that pagination links end up with _N.html, where N is page number (only if N > 1)
- confirm, that pagination links works (you stay in same category and see different sub-categories)
- in it's template place the <inp2:m_Link template="__default__" m_cat_page="5"/>
- confirm, that link contains "_5.html" at the end
- in it's template place the <inp2:m_Link template="__default__" m_cat_page="5" reset="1"/>
- confirm, that link contains "_1.html" at the end
- on any template place <inp2:m_Link template="index"/>
- confirm that build url doesn't contain /index.html
- on any template place <inp2:m_Link template="index" m_lang="X"/> (X is ID of non-primary enabled language)
- confirm that build url doesn't contain /index.html
- edit any category in admin console and set "Short URL" to it
- on front-end type that url (can contain "/" too)
- confirm proper category content is shown and url stayed as you typed
- type "Short URL" without last letter
- confirm, that 404 page is shown
- in admin console specify CategoryA as CategoryB symlink
- on front-end open CategoryA
- confirm, that you're seeing contents from CategoryB despite it's CategoryA in the url
Plan 6 - widgets.
- add some (>1) widgets in admin console
- create /widgets/ folder in theme
- create /widgets/detail.tpl with <inp2:widget_Field name="Title"/> tag on it
- create /widgets/detail_custom.tpl with <inp2:widget_Field name="Title"/> tag on it
- 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
- 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