TS 69 PHP Miscellaneous

PHP Editor Test Specification for NetBeans 6.9

Author: Filip Zamboj, updates by Vladimir Riha
Version: 1.1
Last Update: 4th September 2011 Introduction: This specification provides usecases for PHP editor in the NetBeans IDE

Contents



Test suite: Mark Occurrences

Purpose: Check that occurrences of PHP identifier highlighted when of the identifiers is selected.
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.
    4. Copy/paste a large PHP code peace into the editor.
    • EXPECTED RESULT: A new PHP web page is created and opened in the editor. The code is added there.
  2. Verify local variable occurrences marking.
    1. Create several PHP functions.
    2. Introduce a global variable.
    3. Introduce a variable with the same name in each of these functions.
    4. Add operators which use each of these variables.
    5. Place the cursor onto usage one of these variables.
    • EXPECTED RESULT: Definition and usages of this variable are highlighted. Definition and usages of other variables aren't.
  3. Verify function occurrences marking.
    1. Create a PHP function.
    2. Add several calls of that function, both inside and outside of its code.
    3. Place the cursor onto one of these calls.
    • EXPECTED RESULT: Definition and calls of this function are highlighted.
  4. Verify parameter occurrences marking.
    1. Create a PHP function with a parameter.
    2. Use that parameter in the function body.
    3. Place the cursor onto one of these usages.
    • EXPECTED RESULT: Definition and usages of this parameter are highlighted.



Test suite: HTML Palette

Purpose: Check adding the HTML Palette components to PHP source.
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. Palette window on the right is opened and displays HTML and HTML Forms groups.
  2. DnD Table HTML component to HTML code.
    1. DnD Table HTML component to the editor, not into PHP code.
    2. In the "Insert Table" dialog, press OK.
    • EXPECTED RESULT: HTML tags added to DnD position. They correspond to visual representation of Table HTML component in the "Insert Table" dialog.
  3. DnD Table HTML component to PHP code.
    1. DnD Table HTML component to the editor, into PHP code.
    2. In the "Insert Table" dialog, press OK.
    • EXPECTED RESULT: HTML tags added to DnD position. They correspond to visual representation of Table HTML component in the "Insert Table" dialog. Editor lines are marked with red, and tooltip reads "Syntax error".
  4. DnD Table HTML component outside of editor view.
    1. DnD Table HTML component to the Projects window.
    2. DnD Table HTML component to the Navigator window.
    • EXPECTED RESULT: In both cases, mouse cursor indicates that DnD is impossible.
  5. DnD big Table HTML component to HTML code.
    1. DnD Table HTML component to the editor.
    2. In the "Insert Table" dialog, specify large values for rows and columns (like 1000), change values of other fields and press OK.
    • EXPECTED RESULT: After reasonable time (few seconds), HTML tags added to DnD position. They correspond to the visual representation of Table HTML component in the "Insert Table" dialog (with made changes).
  6. DnD Table HTML component with given parameters to HTML code.
    1. DnD Table HTML component to the editor.
    2. In the "Insert Table" dialog, change values of each field and press OK.
    • EXPECTED RESULT: HTML tags added to DnD position. They correspond to the visual representation of Table HTML component in the "Insert Table" dialog (with made changes).
  7. Add Table HTML component with given parameters to HTML code using double-click.
    1. Place the cursor to some position in editor.
    2. Double-click Table HTML component.
    3. In the "Insert Table" dialog, change values of each field and press OK.
    • EXPECTED RESULT: HTML tags added to DnD position. They correspond to the visual representation of Table HTML component in the "Insert Table" dialog (with made changes).
  8. Undo adding Table HTML component to HTML code.
    1. DnD Table HTML component to the editor.
    2. In the "Insert Table" dialog, change values of each field and press OK.
    3. In the main menu, choose Edit -> Undo.
    • EXPECTED RESULT: HTML tags added to DnD position, but reverted after Undo.
  9. DnD Form HTML component with given parameters to HTML code.
    1. DnD Form HTML component to the editor.
    2. In "Insert Table" dialog, change values of each field and press OK.
    • EXPECTED RESULT: HTML tags added to DnD position. They correspond to the visual representation of Form HTML component in the "Insert Form" dialog (with made changes).
  10. DnD other HTML components with given parameters to HTML code.
    1. Same as previous, for other components in HTML Palette.
    • EXPECTED RESULT: HTML tags added to DnD position. They correspond to the visual representation of an HTML component in the insert dialog (with made changes).



Test suite: Navigation

Purpose: Check Navigation in PHP code.
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. Navigate to a specified line.
    1. In the editor popup menu, choose Navigation -> Line...
    2. Type a valid line number and press GoTo.
    • EXPECTED RESULT: The caret is moved to the specified line.
  3. Navigate to an invalid line.
    1. In the editor popup menu, choose Navigation -> Line...
    2. Type a line number which is greater that number of lines in the file and press GoTo.
    • EXPECTED RESULT: The caret is moved to the end of file.



Test suite: PHPUnit

Purpose: Check PHPUnit testing in PHP project.
Prerequisites: a PHP project is created in the Netbeans IDE, PHPUnit is installed.

  1. Test PHPUnit groups.
    1. Create PHP project, in Projects window right click on the project node and select Properties
    2. In Categories section, select PHPUnit and check "Ask for test groups..."
    3. Create new class (you can use the code below) called Foo

class Foo {

   function plus($a, $b) {
       return $a + $b;
   }
   function minus($a, $b) {
       return $a - $b;
   }
   
   function toString(){
       return "Foo toString()";
   }

}

    1. In Projects window, right click on the Foo.php file and select Tools->Create PHPUnit tests (for the first time, you will have to specify target folder)
    2. New file called FooTest.php is created and opened in the editor
    3. There are 3 test functions: testMinus, testPlus, testToString
    4. To each of these function, add annotation @group with some different value (see the code below)

    /**
    * @group mathTests
    */
   public function testPlus() {
      ...
   }

    1. Run the FooTest.php
    • EXPECTED RESULT: You are asked to specify which test groups you want to run.


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