Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sebastianbergmann/phpunit-memprof-listener

Test Listener for PHPUnit that can dump memory profile information
https://github.com/sebastianbergmann/phpunit-memprof-listener

Last synced: about 2 months ago
JSON representation

Test Listener for PHPUnit that can dump memory profile information

Awesome Lists containing this project

README

        

# phpunit-memprof-listener

Test Listener for [PHPUnit](https://github.com/sebastianbergmann/phpunit/) that uses the [memprof](https://github.com/arnaud-lb/php-memory-profiler) extension to dump memory profile information.

## Installation

You can add this library as a local, per-project, development-time dependency to your project using [Composer](https://getcomposer.org/):

composer require --dev phpunit/phpunit-memprof-listener

## Usage

The example below shows how you activate and configure this test listener in your PHPUnit XML configuration file:

```xml


tests



src




/tmp
callgrind


```

The following elements are relevant to this test listener and its configuration:

* `` is the configuration section for test listeners
* `` configures (an instance of) the `PHPUnit\MemoryProfiler\TestListener` class as a test listener
* `` is the configuration for that test listener
* The first argument is the path to the directory where the memory profile information is to be dumped, in this example `/tmp`
* The second argument is the desired format for the memory profile information dump, in this example `callgrind` (valid values are `callgrind` and `pprof`)

The rest of the `phpunit.xml` example shown above are best practice configuration defaults that were generated using `phpunit --generate-configuration`.