recca0120 / vscode-phpunit

The VS Code Test Explorer extension for PHPUnit
MIT License
127 stars 44 forks source link
php phpunit test test-explorer testing vscode vscode-extension

PHPUnit for VSCode

Run your PHPUnit tests in Node using the Test Explorer UI.

Screenshot

Features

Extension Settings

Include if your extension adds any VS Code settings through the contributes.configuration extension point.

This extension contributes the following settings:

Commands

The following commands are available in VS Code's command palette, use the ID to add them to your keyboard shortcuts:

Configuration

ParaTest

{
  "phpunit.php": "php",
  "phpunit.phpunit": "vendor/bin/paratest",
  "phpunit.args": [
    "-c",
    "phpunit.xml"
  ],
  "phpunit.paths": {
    // ${pwd} (current directory) is mounted to /app
    "${workspaceFolder}": "/app",
    // ${workspaceFolder} is mapped to /app
  },
}

Docker

{
  "phpunit.command": "docker exec -t [container_id] /bin/sh -c",
  "phpunit.php": "php",
  "phpunit.phpunit": "vendor/bin/phpunit",
  "phpunit.args": [
    "-c",
    "phpunit.xml"
  ],
  "phpunit.paths": {
    // ${pwd} (current directory) is mounted to /app
    "${workspaceFolder}": "/app",
    // ${workspaceFolder} is mapped to /app
  },
}
{
  "phpunit.command": "docker run --rm -t -v ${pwd}:/app -w /app php:latest php",
  "phpunit.php": "php",
  "phpunit.phpunit": "vendor/bin/phpunit",
  "phpunit.args": [
    "-c",
    "phpunit.xml"
  ],
  "phpunit.paths": {
    // ${pwd} (current directory) is mounted to /app
    "${workspaceFolder}": "/app",
    // ${workspaceFolder} is mapped to /app
  },
}

SSH

{
  "phpunit.command": "ssh -i dockerfiles/sshd/id_rsa -p 2222 root@localhost -o StrictHostKeyChecking=no",
  "phpunit.php": "php",
  "phpunit.phpunit": "/app/vendor/bin/phpunit",
  "phpunit.args": [
    "-c",
    "/app/phpunit.xml"
  ],
  "phpunit.paths": {
    // ${pwd} (current directory) is mounted to /app
    "${workspaceFolder}": "/app",
    // ${workspaceFolder} is mapped to /app
  }
}

Troubleshooting