## 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 `__constructor` method in the `core/kernel/utility/template_comment_parser.php` to
* $this->templateFile = 'no_such_file';
# go to {nav Configuration > Website > Themes}
# press `Rescan Themes` button
# confirm, that `Template file "no_such_file" not found.` exception happens.
# restore code of `__constructor` 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 `Template file "/home/sites/dev/web/SVN/5.3.x/themes/advanced/platform/login/forgot_password.tpl" have invalid XML in the comment.` exception 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 `Template file "/home/sites/dev/web/SVN/5.3.x/themes/advanced/platform/login/forgot_password.tpl" have unsupported setting "PRIORITI".` exception 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 `Template file "/home/sites/dev/web/SVN/5.3.x/themes/advanced/platform/login/forgot_password.tpl" have must have integer value in setting "PRIORITY".` exception 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 `Template file "/home/sites/dev/web/SVN/5.3.x/themes/advanced/platform/login/forgot_password.tpl" have may have only positive value in setting "PRIORITY".` exception 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 `Template file "/home/sites/dev/web/SVN/5.3.x/themes/advanced/platform/login/forgot_password.tpl" have must have "yes" or "no" value in setting "INCLUDE_IN_SITEMAP".` exception 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