phpunit/phpunit
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
myclabs/deep-copy | 1.11.1 | 22.96 kB | MIT | prod | |
phar-io/manifest | 2.0.3 | 35.48 kB | BSD-3-Clause | prod | |
phar-io/version | 3.2.1 | 18.12 kB | BSD-3-Clause | prod | |
phpunit/php-code-coverage | 10.1.9 | 294.29 kB | BSD-3-Clause | prod | |
phpunit/php-file-iterator | 4.1.0 | 9.41 kB | BSD-3-Clause | prod | |
phpunit/php-invoker | 4.0.0 | 7.45 kB | BSD-3-Clause | prod | |
phpunit/php-text-template | 3.0.1 | 7.22 kB | BSD-3-Clause | prod | |
phpunit/php-timer | 6.0.0 | 9.36 kB | BSD-3-Clause | prod | |
sebastian/cli-parser | 2.0.0 | 8.3 kB | BSD-3-Clause | prod | |
sebastian/code-unit | 2.0.0 | 14.94 kB | BSD-3-Clause | prod | |
sebastian/comparator | 5.0.1 | 19.55 kB | BSD-3-Clause | prod | |
sebastian/diff | 5.0.3 | 23.94 kB | BSD-3-Clause | prod | |
sebastian/environment | 6.0.1 | 9.41 kB | BSD-3-Clause | prod | |
sebastian/exporter | 5.1.1 | 8.15 kB | BSD-3-Clause | prod | |
sebastian/global-state | 6.0.1 | 11.23 kB | BSD-3-Clause | prod | |
sebastian/object-enumerator | 5.0.0 | 5.55 kB | BSD-3-Clause | prod | |
sebastian/recursion-context | 5.0.0 | 5.15 kB | BSD-3-Clause | prod | |
sebastian/type | 4.0.0 | 20.88 kB | BSD-3-Clause | prod | |
sebastian/version | 4.0.1 | 5.02 kB | BSD-3-Clause | prod |
PHPUnit is a programmer-oriented testing framework for PHP. It follows an instance of the xUnit architecture for unit testing frameworks, serving as a robust system designed to facilitate easy and efficient testing of the individual units of source code in your PHP applications. This ensures that your code is thoroughly vetted and expected to perform optimally.
To use PHPUnit, first you'll need to install it. There are primarily two ways to do this:
You can download a PHP Archive (PHAR) that contains all the required dependencies of PHPUnit in a single file. Here's how to do it:
$ wget https://phar.phpunit.de/phpunit-X.Y.phar
$ php phpunit-X.Y.phar --version
Please replace X.Y
with the version of PHPUnit you are interested in.
Another way to install PHPUnit is by using Composer, a tool for dependency management in PHP.
$ composer require --dev phpunit/phpunit ^10
After installation, you can write PHPUnit tests for your PHP applications. For example:
use PHPUnit\Framework\TestCase;
class SomeClassTest extends TestCase
{
public function testPerform()
{
$instance = new SomeClass();
$result = $instance->perform('action');
$this->assertSame('expected', $result);
}
}
And then run them using the PHPUnit PHAR or vendor/bin/phpunit:
$ ./phpunit-X.Y.phar tests
or
$ ./vendor/bin/phpunit tests
The documentation for PHPUnit is available on the official PHPUnit website and it provides an in-depth guide on getting started with PHPUnit and its various modules. You can also check the documentation and contribution guidelines on their official GitHub repository. The contributors to the documentation can be found here.