## Preparations - make following changes in system files:
# add test settings to `supportedSettings` property in `core/units/helpers/template_comment_parser.php`:
* 'PRIORITY' => array('type' => 'integer', 'default' => 1),
* 'INCLUDE_IN_SITEMAP' => array('type' => 'boolean', 'default' => false),
# add test code to the `core/admin_templates/themes/file_edit.tpl`, after `<div id="scroll_container">` line:
* <?php
* global $application;
* $object = $application->recallObject('theme-file');
* echo '<pre>';
* print_r(unserialize($object->GetDBField('FileMetaInfo')));
* echo '</pre>';
* ?>
## Part 1 - test that non-existing template produces exception
# change code of `core/units/helpers/themes_helper.php` add
* $file_path = 'no_such_file';
before $this->_getTemplateMetaInfo(trim($file_path, '/'), $theme_id) call in the FindThemeFiles method
# go to {nav Configuration > Website > Themes}
# press `Rescan Themes` button
# confirm, that exception like `Template file "/web/5.2.x/themes/advanced/no_such_file" not found.` happens.
# restore code of `core/units/helpers/themes_helper.php` method, changed above
## Part 2 - test that template without meta comment get default values from template comment parser
# go to {nav Configuration > Website > Themes}
# open `advanced` theme to edit
# go to `Files` tab
# open some template, that have no meta comment (for example, one from action_box.elm.tpl templates) to edit
# confirm, that no meta tag is visible in editor under `Description` label
# confirm, that test output on edit page contains:
* [name] =>
* [desc] =>
* [section] =>
* [priority] => 1
* [include_in_sitemap] =>
## Part 3 - test that template with one line long meta comment get default values from template comment parser
# add test meta comment `<!--## ##-->` to the `/in-news/elements/side_boxes/action_box.elm.tpl` template
# go to {nav Configuration > Website > Themes}
# press `Rescan Themes` button
# open `advanced` theme to edit
# go to `Files` tab
# open template `/in-news/elements/side_boxes/action_box.elm.tpl` to edit
# confirm, that added meta comment is visible in editor under `Description` label
# confirm, that test output on edit page contains:
* [name] =>
* [desc] =>
* [section] =>
* [priority] => 1
* [include_in_sitemap] =>
## Part 4 - test that invalid XML produces exception
# add test settings to the meta comment of the `platform/login/forgot_password.tpl' template:
* <PRIORITY>5<PRIORITY>
* <INCLUDE_IN_SITEMAP>yes</INCLUDE_IN_SITEMAP>
# go to {nav Configuration > Website > Themes}
# press `Rescan Themes` button
# confirm, that exception like `Meta-comment syntax error in "/web/5.2.x/themes/advanced/platform/login/forgot_password.tpl" template file.` happens.
## Part 5 - test that unsupported setting produces exception
# change test setting in the meta comment of the `platform/login/forgot_password.tpl' template:
* <PRIORITI>5</PRIORITI>
# go to {nav Configuration > Website > Themes}
# press `Rescan Themes` button
# confirm, that exception like `Meta-comment in "/web/5.2.x/themes/advanced/platform/login/forgot_password.tpl" template file contains unsupported setting "PRIORITI". Supported settings are: "NAME", "DESC", "SECTION", "PRIORITY", "INCLUDE_IN_SITEMAP".` happens.
## Part 6 - test that unknown format of setting value produces exception
# change test setting in the meta comment of the `platform/login/forgot_password.tpl' template:
* <PRIORITY>top</PRIORITY>
# go to {nav Configuration > Website > Themes}
# press `Rescan Themes` button
# confirm, that exception like `Only positive numbers are allowed as "PRIORITY" setting value in "/web/5.2.x/themes/advanced/platform/login/forgot_password.tpl" template file.` happens.
# change test setting in the meta comment of the `platform/login/forgot_password.tpl' template:
* <PRIORITY>0</PRIORITY>
# go to {nav Configuration > Website > Themes}
# press `Rescan Themes` button
# confirm, that exception like `Only positive numbers are allowed as "PRIORITY" setting value in "/web/5.2.x/themes/advanced/platform/login/forgot_password.tpl" template file.` happens.
# change test settings in the meta comment of the `platform/login/forgot_password.tpl' template:
* <PRIORITY>5</PRIORITY>
* <INCLUDE_IN_SITEMAP>true</INCLUDE_IN_SITEMAP>
# go to {nav Configuration > Website > Themes}
# press `Rescan Themes` button
# confirm, that exception like `Only "yes" or "no" are allowed as "INCLUDE_IN_SITEMAP" setting value in "/web/5.2.x/themes/advanced/platform/login/forgot_password.tpl" template file.` happens.
## Part 7 - test regular output when all settings values are valid
# change test settings in the meta comment of the `platform/login/forgot_password.tpl' template:
* <NAME>Forgot Password</NAME>
* <DESC>test description</DESC>
* <SECTION>My Account||Login</SECTION>
* <PRIORITY>5</PRIORITY>
* <INCLUDE_IN_SITEMAP>yes</INCLUDE_IN_SITEMAP>
# go to {nav Configuration > Website > Themes}
# press `Rescan Themes` button
# open `advanced` theme to edit
# go to `Files` tab
# open template `/platform/login/forgot_password.tpl` to edit
# confirm, that added meta comment is visible in editor under `Description` label
# confirm, that test output on edit page contains:
* [name] => Forgot Password
* [desc] => test description
* [section] => My Account||Login
* [priority] => 5
* [include_in_sitemap] => 1