How To Install Phpunit In Debian, Ubuntu, Kali, Fedora, Raspbian And MacOS?

How To Install Phpunit In Debian, Ubuntu, Kali, Fedora, Raspbian And MacOS?

phpunit

PHPUnit command-line test runner.

Maintainer: Debian PHP PEAR Maintainers



Section: php

Install phpunit

  • Debian apt-get install phpunit Click to copy
  • Ubuntu apt-get install phpunit Click to copy
  • Kali Linux apt-get install phpunit Click to copy
  • Fedora dnf install phpunit Click to copy
  • Raspbian apt-get install phpunit Click to copy
  • macOS brew install phpunit Click to copy

PHPUnit command-line test runner.

How to use phpunit?

Below are few example commands for phpunit that you can use in the terminal.

Run tests in the current directory. Note: Expects you to have a 'phpunit.xml':
phpunitClick to copy
Run tests in a specific file:
phpunit path/to/TestFile.phpClick to copy
Run tests annotated with the given group:
phpunit --group nameClick to copy
Run tests and generate a coverage report in HTML:
phpunit --coverage-html directoryClick to copy
Install the latest version of phpunit in Debian, Ubuntu, Kali, Fedora, Raspbian and macOS from terminal. To install the phpunit just copy the above command for your OS and run into terminal. After you run the command it will grab the latest version of phpunit from the respository and install it in your computer/server.