How To Install phpunit on Kali Linux
Introduction
In this tutorial we learn how to install phpunit on Kali Linux.
What is phpunit
phpunit is:
Unit testing allows you to write small test methods which verify units of functionality in your program. It is a powerful technique for improving the quality of your software, preventing regressions, and allowing confident refactoring of your code.
PHPUnit is a unit testing suite for the PHP language, modelled on the xUnit testing framework, designed by Kent Beck and Erich Gamma. If you’ve used JUnit (for Java), PyUnit (for Python), CxxUnit (for C++), or any of the other equivalents for other languages, the API for this package should seem fairly familiar. If you’ve never written unit tests before, the PHPUnit API is simple to learn and use.
There are three methods to install phpunit on Kali Linux. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.
Install phpunit Using apt-get
Update apt database with apt-get using the following command.
sudo apt-get updateAfter updating apt database, We can install phpunit using apt-get by running the following command:
sudo apt-get -y install phpunitInstall phpunit Using apt
Update apt database with apt using the following command.
sudo apt updateAfter updating apt database, We can install phpunit using apt by running the following command:
sudo apt -y install phpunitInstall phpunit Using aptitude
If you want to follow this method, you might need to install aptitude on Kali Linux first since aptitude is usually not installed by default on Kali Linux. Update apt database with aptitude using the following command.
sudo aptitude updateAfter updating apt database, We can install phpunit using aptitude by running the following command:
sudo aptitude -y install phpunitHow To Uninstall phpunit on Kali Linux
To uninstall only the phpunit package we can use the following command:
sudo apt-get remove phpunitUninstall phpunit And Its Dependencies
To uninstall phpunit and its dependencies that are no longer needed by Kali Linux, we can use the command below:
sudo apt-get -y autoremove phpunitRemove phpunit Configurations and Data
To remove phpunit configuration and data from Kali Linux we can use the following command:
sudo apt-get -y purge phpunitRemove phpunit configuration, data, and all of its dependencies
We can use the following command to remove phpunit configurations, data and all of its dependencies, we can use the following command:
sudo apt-get -y autoremove --purge phpunitDependencies
phpunit have the following dependencies:
- php-cli
- php-common
- php-xml
- php-json
- php-mbstring
- php-doctrine-instantiator
- php-doctrine-instantiator
- php-deepcopy
- php-deepcopy
- php-phar-io-manifest
- php-phar-io-manifest
- php-phar-io-version
- php-phar-io-version
- php-phpspec-prophecy
- php-phpspec-prophecy
- php-codecoverage
- php-codecoverage
- php-file-iterator
- php-file-iterator
- php-invoker
- php-invoker
- php-text-template
- php-text-template
- php-timer
- php-timer
- phpunit-cli-parser
- phpunit-cli-parser
- phpunit-code-unit
- phpunit-code-unit
- phpunit-comparator
- phpunit-comparator
- phpunit-diff
- phpunit-diff
- phpunit-environment
- phpunit-environment
- phpunit-exporter
- phpunit-exporter
- phpunit-global-state
- phpunit-global-state
- phpunit-object-enumerator
- phpunit-object-enumerator
- phpunit-resource-operations
- phpunit-resource-operations
- phpunit-type
- phpunit-type
- phpunit-version
- phpunit-version
References
Summary
In this tutorial we learn how to install phpunit package on Kali Linux using different package management tools: apt, apt-get and aptitude.