TS 71 PHP Smarty

PHP Smarty Framework Test Specification for NetBeans 7.1

Author: Vladimir Riha
Version: 1.0
Last Update: 9th November 2011
Introduction: This specification provides usecases for Smarty support in NetBeans

Mac OS specific details: To find Options on MacOS, go to Netbeans menu -> Preferences

Contents

Test suite: New template wizard

Purpose: "This test suite checks creating of Smarty template file *tpl"
Setup: "Already created PHP project (without any framework)"

  1. "New template file wizard"
    1. "Select File | New File... to open New File dialog
    2. Select "PHP" in Categories and "Smarty Template" in File Types
    3. Press Next
    4. Select some name and specify the path where to save the template
    5. Press Finish
    • EXPECTED RESULT: "New template file is created and opened in editor window."

Test suite: Syntax highlighting

Purpose: "This test suite checks syntax highlighting of Smarty syntax in template file"
Setup: "Already created tpl file"

  1. "Syntax highlighting"
<h1 class="heading">{$sekce|escape:'html'}</h1>
{if isset($user)}Hello {$foo[0].name|escape:'html'}{/if}
<div class="text">
    {foreach from=$articles item=article}
        <div class="content">
            {$article.perex|escape:'html'|lower}
        </div>
    {/foreach}
</div>
    1. Copy the code above to tpl file
    • EXPECTED RESULT: "The syntax is highlighted as on the picture below, no errors are shown."

File:SmartySyntax.png

Test suite: Code Completion

Purpose: "This test suite checks code completion of Smarty tags"
Setup: "Already created tpl file"

{foreach from=$array key=key item=val}
  {$val|}
{/foreach}
  1. "Smarty keywords"
    1. In tpl file, type { and invoke CC.
    2. List of Smarty tags should be offered.
    3. Type "fo" so in result you should have "{fo".
    4. Offered list is reduce to 2 items (foreach and foreachelse) and help window displays help text for "foreach".
    5. Press Enter, {foreach should be completed.
    6. Press Space and invoke CC using Ctrl+Space.
    7. Four items are offered: from, item, key and value. Pick one and press Enter.
    8. Selected item is completed.
    9. Finnish the code to looked like the one above.
    10. Invoke code completion after "|".
    11. List of modifiers is offered (cat, html...). Pick one and press Enter
    • EXPECTED RESULT: "Code completion works as described"
  1. "Custom delimiters - project scope"
    1. Right click on project node in Projects window, select properties.
    2. Select Smarty section (below Frameworks).
    3. Change both delimiters to custom values.
    4. Open tpl file and type the open delimiter you've just defined and try code completion (tpl files have to be reopened to apply changes)
    • EXPECTED RESULT: "Code completion works the same way like in previous test case."
  1. "Custom delimiters - project scope II"
    1. Having open the project from previous test case, create new PHP project and add Smarty template file to it.
    2. Open template file
    3. Type "{" and invoke code completion
    • EXPECTED RESULT: "Code completion works and setting custom delimiters to other project doesn't effect other projects."


  1. "Custom delimiters - IDE scope"
    1. Having open both projects from previous test cases, go to Tools|Options|PHP|Smarty.
    2. Change both delimiters to custom values.
    3. Open tpl file from project that doesn't have set custom delimeters.
    4. Type open delimiter you define in Tools|Options... and invoke code completion.
    • EXPECTED RESULT: "Code completion works and project that doesn't have set custom delimiters via project properties uses settings from IDE."

Test suite: HTML in template files

  1. "HTML editing in template file"
    1. Open tpl file.
    2. Check common features for HTML tags in tpl file (code completion, code folding, syntax highlighting, reformatting) as described in TS_60_HTMLeditor
    • EXPECTED RESULT: "HTML editing works the same way as in html file."

Test suite: PHP in template files

  1. "PHP editing in template file"
    1. Open tpl file.
    2. Use {php} and {/php} to define php code block (note that if you set custom delimiters, use them instead if "{" and "}")
    • EXPECTED RESULT: "PHP syntax is highlighted as in common php file"
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo