Next level assertion and matcher library for PHP

Maintainers

πŸ‘ brianium

Package info

github.com/peridot-php/leo

pkg:composer/peridot-php/leo

Statistics

Installs: 368 178

Dependents: 63

Suggesters: 0

Stars: 36

Open Issues: 5

1.6.1 2017-08-16 21:40 UTC

Requires

  • php: >=5.4

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 2a6f60f237498cd7c3e912d71dcb90424ab66e72

  • Brian Scaturro <scaturrob.woop@gmail.com>

testingmatcherassertexpectexpectation


README

πŸ‘ Leo logo

Leo

Next level assertion library for PHP

πŸ‘ This project uses semantic versioning
πŸ‘ Current build status for the master branch
πŸ‘ Current Scrutinizer code quality for the master branch
πŸ‘ Current test coverage for the master branch

Visit the main site and documentation at peridot-php.github.io/leo/.

Expect Interface

Leo supports a chainable interface for writing assertions via the expect function:

expect($obj)->to->have->property('name');
expect($value)->to->be->ok
expect($fn)->to->throw('InvalidArgumentException', 'Expected message');
expect($array)->to->be->an('array');
expect($result)->to->not->be->empty;

Assert Interface

Leo supports a more object oriented, non-chainable interface via Assert:

use Peridot\Leo\Interfaces\Assert;

$assert = new Assert();
$assert->ok(true);
$assert->doesNotThrow($fn, 'Exception');
$assert->isResource(tmpfile());
$assert->notEqual($actual, $expected);

Detailed error messages

Leo matchers generate detailed error messages for failed assertions:

πŸ‘ Leo messages

Plugins

Leo can be easily customized. For an example see LeoHttpFoundation. Read more on the plugin guide.

Running Tests

make test

Generating Docs

Documentation is generated via ApiGen. Simply run:

make docs

Thanks

Leo was inspired by several great projects:

And of course our work on Peridot gave incentive to make a useful complement.