Code Monkey home page Code Monkey logo

vscode-phpunit's Introduction

PHPUnit for VSCode

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

Screenshot

Features

  • Shows a Test Explorer in the Test view in VS Code's sidebar with all detected tests and suites and their state
  • Shows a failed test's log when the test is selected in the explorer
  • Lets you choose test suites or individual tests in the explorer that should be run automatically after each file change

Extension Settings

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

This extension contributes the following settings:

  • phpunit.php: Absolute path to php. Fallback to global php if it exists on the command line.
  • phpunit.phpunit: Path to phpunit. Can be the phpunit file or phpunit.phar.\n\nAutomatically finds it in common places:\n - Composer vendor directory\n - phpunit.phar in your project\n - phpunit (or phpunit.bat for windows) globally on the command line
  • phpunit.command: Custom command to run. Ex: docker exec -t container_name.
  • phpunit.args: Any phpunit args (phpunit --help) E.g. --configuration ./phpunit.xml.dist
  • phpunit.clearOutputOnRun: True will clear the output when we run a new test. False will leave the output after every test.
  • phpunit.showAfterExecution Specify if the test report will automatically be shown after execution

Commands

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

  • phpunit.reload: PHPUnit: Reload tests
  • phpunit.run-all: PHPUnit: Run all tests
  • phpunit.run-file: PHPUnit: Run tests in current file
  • phpunit.run-test-at-cursor: PHPUnit: Run the test at the current cursor position
  • phpunit.rerun: PHPUnit: Repeat the last test run

Configuration

{
  "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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.