PHP code example of bound1ess / essence

1. Go to this page and download the library: Download bound1ess/essence 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/ */

    

bound1ess / essence example snippets


this("someValue")->should_have_length_of(10); # => "someValue should have length of 10"
expect(123)->toBeAbove(120); # => "expect 123 to be above 120"

$elements = [1, 2, 3, 4, 5];
these($elements)->values->should_contain(5); # => "these elements should contain a value '5'"

expect(null)->not()->to()->beNull(); => "expect NULL not to be NULL"

spl_object_hash(essence()) == spl_object_hash(essence());

essence()->configure(function($config) {
    return array_merge($config, [
        "exception" => "Your\Custom\AssertionException",
    ]);
});

essence()->configure(function() {
    return [
        "implicit_validation" => true,
    ];
});

class MyTestCase extends Essence\Extensions\PhpunitExtension
{

    // Your assertions here.
}

expect(10)->to_be_equal_to(15)->validate(); // You can also use "go" instead of "validate".

expect(10)->to_be_equal_to(15)->validate(true);