PHP code example of fr3on / php-hypothesis
1. Go to this page and download the library: Download fr3on/php-hypothesis library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fr3on / php-hypothesis example snippets
use Fr3on\Hypothesis\PHPUnit\PropertyTestCase;
use Fr3on\Hypothesis\Attribute\Given;
use Fr3on\Hypothesis\Shape\ListShape;
use Fr3on\Hypothesis\Shape\IntegerShape;
class SortingTest extends PropertyTestCase
{
#[Given(new ListShape(new IntegerShape()))]
public function prop_sort_is_idempotent(array $list): void
{
$sorted = $list;
sort($sorted);
$doubleSorted = $sorted;
sort($doubleSorted);
$this->assertSame($sorted, $doubleSorted);
}
}
bash
composer