acro5piano / pest
A php unit testing library with Rspec style
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/acro5piano/pest
Requires (Dev)
- phpunit/phpunit: ^6.4
This package is not auto-updated.
Last update: 2025-11-16 09:30:27 UTC
README
A php unit testing library with Rspec style.
[Under developing]
Example
use Acro5piano\Pest\Spec; function add(int $x, int $y) { return $x + $y; } Spec::describe('add', function ($it) { $it('returns 3 given 1, 2', function ($expect) { $expect(add(1, 2))->toBe(3); }); $it('a failing test', function ($expect) { $expect(add(1, 2))->toBe(4); }); });
Result:
Documentation
Install
composer require --dev acro5piano/pest
Grouping
You can nest with Type Hint.
use Acro5piano\Pest\Describe; Spec::describe('1: first describe', function (Describe $describe) { $describe('2: second describe', function ($it) { $it('3: finally it comes', function ($expect) { $expect([1, 2])->not()->toContain(1); }); }); });
Result:
Failed
1: first describe
2: second describe
3: finally it comes
Assertions
toBetoContain
not() invert the condition. e.g.)
$expect([1, 2])->not()->toContain(3); // -> Fails
