Download the PHP package jonathrg/proposition without Composer

On this page you can find all versions of the php package jonathrg/proposition. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package proposition

Proposition

Lightweight property-based testing library for PHP. Inspired by Python's Hypothesis library.

Installation

Because the API is not fully stable yet, you must specify dev-master to composer install:

composer install jonathrg/proposition:dev-master

What is property-based testing?

According to the first blog post I found about it,

Property-based tests make statements about the output of your code based on the input, and these statements are verified for many different possible inputs. A property-based testing framework runs the same test over and over with generated input.

This is in contrast to example-based testing, where you have to hand-write your inputs. A property-based testing library like Proposition lets you test your code with thousands and thousands of input combinations (including all sorts of edge cases) with just a few lines of code. As an example, Proposition uses itself to test itself, and does so with about 4000 assertions per line of test code.

Documentation

See the Wiki, especially the Quick reference

Example usage

There are some examples of the values Proposition generates in the examples folder. Run them with PHP from the command line (see the readme.md there)

Here's a toy example showing how you would use Proposition to check whether your awesome reimplementation of abs($a) == abs($b) actually works.

use Proposition/Proposition;

function equal_magnitude($a, $b)
{
    return ($a = $b) || ($a == -$b);
}

$proposition = new Proposition();

$proposition
    ->given(Proposition::integers(), Proposition::integers())
    ->call(function($a, $b) {
        if(equal_magnitude($a, $b) != (abs($a) == abs($b))) {
            echo "ERROR!! equal_magnitude is wrong when \$a is $a and \$b is $b!\n"; 
        }
    });

Oops! We're getting a lot of error messages. We will quickly discover that we used a = where we should have used a == in our function.

In practice, you will be using this to pass a huge, automatically generated range of values into your functions and check that some property always holds. You might for example want to check that the output of a function has a certain relationship to your input, that the function did or did not throw an exception, and so on.

Project goals

Status

Most core functionality and documentation is complete. The plan is to fix issue #1 and issue #3, make some PHPUnit tests which test it with itself, then release it on packagist.

Contributors are welcome!


All versions of proposition with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jonathrg/proposition contains the following files

Loading the files please wait ...