/bulletproof

[WIP] QuickCheck like PHP library for easier property based testing

Primary LanguagePHPMIT LicenseMIT

Bulletproof

Latest Stable Version Build Status Coverage Status

The union of PHPStan type analysis (type inference) and property based testing by Eris.

The idea is that PHPStan will deduce types of parameters and return type of the given method. Then Bulletproof (currently AbstractTestCase) lib will create generators from Eris to generate the input for property based test.

For those who knows QuickCheck, this might be something similar for PHP (hopefully one day).

Disclaimer

@Ocramius said:

It would be cool to have a library which do that!

So here it is ...

Well I hope I (or we 😉) will implement this library in the future in the way we discuss it with @ocramius, but for now it is basically only the idea... because PHPStan is not meant to be used like this now... so it could take some time...

Present

For now there is just a PR #1 which I will retain open till it will actually do something.

I might (and probably will) do some implementation to the PR, some more playing and prototyping of what it would/could/should do in the future, but it will still be just a naive and dummy implementation for now.

Future

We have to wait for PHPStan (or other tool 🤔) to get types we need for creating proper generators.

If you have some idea of your own feel free to open an issue or send PR and we can discuss it.

Installation

  • NOT YET AVAILABLE
composer require mf/bulletproof

Usage

Run tests and see the output

composer tests

Changelog

For latest changes see CHANGELOG.md file. We follow Semantic Versioning.

Contributing and development

Install dependencies

composer install

Run tests

For each pull-request, unit tests as well as static analysis and codestyle checks must pass.

To run all those checks execute:

composer all