TS 67 PHP Formating and Indentation

PHP Editor Test Specification for NetBeans 6.7

Author: 6.7 by Filip Zamboj, updated by Vladimir Riha
Version: 1.1

Introduction: Formatting, Indentation and Code Folding in PHP Editor
Comments: Draft

Contents


Test suite: Formatting

Purpose: Check Format code feature for PHP and HTML.
Prerequisites: a PHP project is created in the Netbeans IDE.

  1. Create a PHP web page.
    1. In the main menu, choose File -> New File...
    2. In the Categories list, select Scripting. In the File Types list, choose PHP Web Page. Click Next.
    3. Accept default values by pressing Finish button.
    • EXPECTED RESULT: A new PHP web page is created and opened in the editor.
  2. Format default code of PHP web page.
    1. Invoke Format from the popup menu in the editor.
    • EXPECTED RESULT: The page source isn't changed, since it's already formatted properly.
  3. Undo Formatting of PHP web page.
    1. Invoke Format from the popup menu in the editor.
    2. Choose Edit->Undo in the main menu.
    • EXPECTED RESULT: All formatting changes are reverted.
  4. Create a PHP file.
    1. In the main menu, choose File -> New File...
    2. In the Categories list, select Scripting. In the File Types list, choose PHP File. Click Next.
    3. Accept default values by pressing Finish button.
    • EXPECTED RESULT: A new PHP file is created and opened in the editor.
  5. Format default code of PHP file.
    1. Invoke Format from the popup menu in the editor.
    • EXPECTED RESULT: The source isn't changed, since it's already formatted properly.
  6. Undo Formatting of PHP file.
    1. Invoke Format from the popup menu in the editor.
    2. Choose Edit->Undo in the main menu.
    • EXPECTED RESULT: All formatting changes are reverted.
  7. Formatting of folded code.
    1. Add code with code foldings, collapse several folds.
    2. Invoke Format from the popup menu in the editor.
    3. Expand those folds back.
    • EXPECTED RESULT: Folded code is formatted as well as unfolded.
  8. Line wrap.
    1. Create new php web page and paste some huge amount of text inside it.
    2. Go to Tools|Options|Editor|Formatting and select Line wrap After words.
    3. Click OK, the text you have pasted should be wrapped after words.
    4. Change the choice After words to Anywhere, hit OK
    • EXPECTED RESULT: Text is wrap without any respect to words.


Test suite: Code Folding

Purpose: Check that PHP code and HTML is folded properly for PHP source and PHP web page.
Prerequisites: a PHP project is created in the Netbeans IDE.

  1. Create a PHP web page.
    1. In the main menu, choose File > New File...
    2. In the Categories list, select Scripting. In the File Types list, choose PHP Web Page. Click Next.
    3. Accept default values by pressing Finish button.
    • EXPECTED RESULT: A new PHP web page is created and opened in the editor.
  2. Verify code fold tooltip.
    1. Collapse a code fold.
    2. Move mouse cursor onto {...} folding symbols.
    • EXPECTED RESULT: Full content of folded code should appear as a tooltip.
  3. Expand code fold by double-click.
    1. Collapse a code fold.
    2. Double-click {...} folding symbols.
    • EXPECTED RESULT: Code fold is expanded.
  4. Recurrent code folding.
    1. Collapse several code folds.
    2. Collapse a code fold containing all of them.
    3. Expand that code fold back.
    4. Expand all other code folds.
    5. Collapse that main code fold again.
    6. Expand that code fold back.
    • EXPECTED RESULT: When expanding the main code fold back, other code fold should be in the same states as they were before collapsing the main code fold.
  5. Repeat all previous testcases for HTML folding.
    • EXPECTED RESULT: Same as in previous testcases.
  6. PHP functions code folding.
    1. Add a PHP code with function definition to the page.
    2. Collapse a code fold with this function.
    3. Expand that code fold back.
    • EXPECTED RESULT: The code fold should exist and work properly. The function title should be displayed outside of code fold.
  7. PHP /**/ comments code folding.
    1. Add a PHP code with /**/ style comment to the page.
    2. Collapse a code fold with this comment.
    3. Expand that code fold back.
    • EXPECTED RESULT: The code fold should exist and work properly.
  8. PHP // comments code folding.
    1. Add a PHP code with several lines of // style comments to the page.
    • EXPECTED RESULT: No code fold should exist for that comments.
  9. Copy/Paste code folds.
    1. Add a PHP function with the body.
    2. Collapse its fold.
    3. Copy the fold (mark it and press Ctrl-C).
    4. Paste code in some other place.
    • EXPECTED RESULT: Code is pasted properly and is unfolded.
  10. Verify code folding from the main menu.
    1. In the IDE main menu, choose View -> Code Folds.
    2. Try each item of this submenu: Collapse Fold, Expand Fold, Collapse All, Expand All.
    • EXPECTED RESULT: Code folds behave correspondingly.
  11. Verify code folding via keyboard shortcuts.
    1. In the IDE main menu, choose View -> Code Folds.
    2. Behold keyboard shortcuts for each item of this submenu.
    3. Press shortcut for each item of this submenu: Collapse Fold, Expand Fold, Collapse All, Expand All.
    • EXPECTED RESULT: Code folds behave correspondingly.


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