TS 73 PHP Test Debugging

PHP Debugging Test Specification for NetBeans 7.3

Author: Milan Molda
Original Author: Filip Zamboj, updates by Vladimir Riha, Milan Molda
Version: 1.0
Last update: 26nd April 2013
Introduction: PHP Debugging Test Specification
Documents: Xdebug installation is required. Follow instructions on XDebug. If you face any issues with xdebug installation let me know or update wiki page, please. It'll help us to keep HowTo up-to-date and make our/users lifes easier.Thanks.

Contents


Test suite: Interface

Purpose: Check that all debugging views are present in IDE and verify persistence
Setup: start NetBeans with empty userdir. Close all view opened in bottom panel.

  1. Debugging view
    1. Choose Window -> Debugging from main menu
    • EXPECTED RESULT: There should be following items present: Variables, Watches, Call Stack, Breakpoints, Sessions, Threads, Sources,
  2. Variables view
    1. Open Window -> Debugging -> Variables
    • EXPECTED RESULT: A Variables view should open.
  3. Watches view
    1. Open Window -> Debugging -> Watches
    • EXPECTED RESULT: A Watches view should open.
  4. Call Stack view
    1. Open Window -> Debugging -> Call Stack
    • EXPECTED RESULT: A Call Stack view should open.
  5. Breakpoints view
    1. Open Window -> Debugging -> Breakpoints
    • EXPECTED RESULT: A Breakpoints view should open.
  6. Sessions view
    1. Open Window -> Debugging -> Sessions
    • EXPECTED RESULT: A Sessions view should open.
  7. Threads view
    1. Open Window -> Debugging -> Threads
    • EXPECTED RESULT: A Threads view should open.
  8. Sources view
    1. Open Window -> Debugging -> Sources
    • EXPECTED RESULT: A Sources view should open.
  9. Debugging views persistence
    1. restart IDE with the same userdir
    • EXPECTED RESULT: All views are open as they were when you finished previous testcase.

Test suite: Run Debugging Session

Purpose: Verify that debugging session is running properly
Prerequisites: Apache2, Xdebug
Setup: start NetBeans with empty userdir. Close all view opened in bottom panel.

  1. Run debugging session
    1. Create some PHP project (in server document root)
    2. Open Project Properties -> Run Configuration -> set Project URL to your project directory that is handled by web server
    3. Run Debugg -> Debug Project
    • EXPECTED RESULT: Debugger will start your browser and stop on the first line of the index.php. If debugging won't start then stop session and verify your xdebug installation.
    1. teardown: stop debugging session
  1. Check array size in Variable window

File:TS 72 PHP Debuggin.png

    1. Create new PHP project
    2. Declare some dummy array variable and add some items to it
    3. On some lines below the array usage, perform "Toggle Line Breakpoint" (for example from context menu)
    4. Debug file
    • EXPECTED RESULT: In Variable window, there should be displayed size of the array (check the image).

Test suite: Debugging options

  1. Show requested URLs
    1. Create new PHP project
    2. Go to Tools|Options|PHP|Debugging and check "Show Requested URLs" and press OK
    3. Debug file
    • EXPECTED RESULT: New window called "Output - PHP Requested Urls" is shown and it contains currently requested URLs. Addresses are clickable, clicking on some cause its opening in browser.
  1. Show debugger console
    1. Set output_buffering = Off in your php.ini
    2. Create new PHP project (or use some existing)
    3. Go to Tools|Options|PHP|Debugging and check "Show Debugger Console" and press OK
    4. Debug file
    • EXPECTED RESULT: New window called "PHP Debugger Console" is shown and it contains output of the debugged code.
  1. Maximum Number of Children
    1. Set output_buffering = Off in your php.ini
    2. Create new PHP project (or use some existing)
    3. Declare some dummy array variable and add some items to it
 $aa = array(array((array(1,2)),2,2,3), array(4, 5, 6));
    1. Go to Tools|Options|PHP|Debugging and set "Maximum Number of Children" to 1 and press OK
    2. Add watch for the declared array (right click on array and New Watch)
    3. On some lines below the array usage, perform "Toggle Line Breakpoint" (for example from context menu)
    4. Debug file
    • EXPECTED RESULT: In Watches window, there is the declared array, if you click on the "+" mark, only first item of the array is displayed.
  1. Set Maximum Depth of Structures
    1. Create new PHP project (or use some existing)
    2. Go to Tools|Options|PHP|Debugging and set "Maximum Depth of Structures" to 1 and press OK
    3. Create 2 classes classA and classB. In classA declare some variable of type classB. In classB declare some string variable.
    4. Use object called "foo" of classA type somewhere in your code and debug the file
    class B{
            public $foo = true;
        }
        
        class A{
            public $bar;
            function __construct() {
                $this->bar = new B();
            }
        }
        $fooBar = new A();
    1. In Variables window, there should be variable foo
    • EXPECTED RESULT: The string variable of classB is not vissible in Variables window under the foo variable.
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