Skip to content

Visual Studio Code Integration

Mark Metcalfe 👽 edited this page Sep 18, 2025 · 5 revisions

Running PHPUnit Tests

  1. Install the PHPUnit extension
  2. Add the following to your settings.json:
    "phpunit.command": "tphp debug",
    "phpunit.phpunit": "phpunit",

You should now be able to run PHPUnit tests by clicking on "Run test" above test methods or classes in any test file.

Debugging via XDebug

  1. Install the PHP Debug extension
  2. Open 'launch.json' from the Run and Debug sidebar panel
    image
  3. Add the following to configurations:
    {
        "name": "Listen for Xdebug",
        "type": "php",
        "request": "launch",
        "port": 9003,
        "pathMappings": {
            "/var/www/totara/src": "${workspaceFolder}/.." 
        }
    }
    So your launch.json looks like this:
    image

Now whenever you want to debug a PHP script, simply add breakpoints wherever you wish, and then ensure you start listening for the debugger within the Run and Debug sidebar.

image

Viewing Your Databases

  1. Install a database viewer extension such as DBCode
  2. Add a new connection for the database you wish
    image
  3. Set the Port, User and Password values to be the same as what is listed in this table
    image

You should now be able to view the tables for the DBMS you added.

Performance Improvements

Todo

Clone this wiki locally