danrspencer / phpunit-expect-syntax
Expect syntax for PHPUnit assertions
Installs: 6 062
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 3
Open Issues: 0
Requires
- php: >=7.0
- phpunit/phpunit: >=6
This package is not auto-updated.
Last update: 2024-04-27 12:27:06 UTC
README
A wrapper for PHPUnit which allows expect assertion syntax inspired by JavaScript's Jasmine.
Note: currently incomplete - if I'm missing a matcher you need create an issue or pull request
Installation
Step 1. Install via Composer
The preferred way to install this bundle is via Composer. Just add it to your composer.json:
{ "require": { // ... "danrspencer/phpunit-expect-syntax": "2.0.0" } }
Step 2. Include the expect-syntax.php file
To begin using the syntax you'll need to include the expect-syntax.php file. This can be done in your PHPUnit bootstrap (recommended) or in invididual tests.
e.g.
require_once '../vendor/danrspencer/phpunit-expect-syntax/ExpectSyntax.php';
Example usage
/** @test */ function it_tests_something() { expect($this)->toEqual($that); }