Download the PHP package sergey-bel/phpinvariant without Composer
On this page you can find all versions of the php package sergey-bel/phpinvariant. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sergey-bel/phpinvariant
More information about sergey-bel/phpinvariant
Files in sergey-bel/phpinvariant
Package phpinvariant
Short Description PHP property-based testing framework
License MIT
Informations about the package phpinvariant
PhpInvariant
PhpInvariant is a property-based testing framework for php
It runs your code on customized random data and checks predefined invariants (similar to QuickCheck)
Installation
The recommended way to install PhpInvariant is through Composer
Quick start
- Create a folder
invariants
- Create
...Invariant
class inside this folder- Class must extends
BaseInvariant
- Each public method with a name 'check...' will be launched
- Class must extends
- Run command
vendor/bin/phpinvariant run --path=invariants
See examples
Example
Provider
Provider is a main class to generate random data
This example will generate a alphabetic string with length between 5 and 10 (inclusive)
Finish conditions
Finish conditions are used to determine when to end the check execution
Finish condition is specified by method attribute
Command Line Options
--path
Specifies directory with Check classes
--config
Specifies the path to a configuration file
--no-progress
Do not show progress bar
--quiet
Do not output any message
--seed
Specifies random seed
Configuration file
PhpInvariant uses YAML configuration format. All command line options are supported in configuration file parameters
section
Example:
A config file can be passed in --config
option:
vendor/bin/phpinvariant run --config=phpinvariant.yml
Development
git clone https://github.com/SergeyBel/phpinvariant.git
docker-compose up -d
Use Makefile commands:
fix
- run code style fixer
static
- run static analyzer
test
- run tests
All versions of phpinvariant with dependencies
symfony/console Version ^6.0
symfony/finder Version ^6.0
phpunit/phpunit Version ^9.5
nikic/php-parser Version ^4.15
symfony/config Version ^6.2
symfony/yaml Version ^6.2
webmozart/assert Version ^1.11